1 #ifndef WINDOWMANAGER_H
2 #define WINDOWMANAGER_H
36 unsigned char scancode
;
38 unsigned char key_mod
;
42 struct wm_active_event
49 struct wm_keyboard_event
56 struct wm_resize_event
62 struct wm_expose_event
72 struct wm_custom_event
80 // Basically a generic SDL_Event
84 wm_active_event active
;
85 wm_keyboard_event key
;
86 MouseEvent mouse_event
;
87 wm_resize_event resize
;
88 wm_expose_event expose
;
90 wm_custom_event custom
;
93 // custom timer callback function
94 typedef unsigned int (*wm_timer_callback
)(unsigned int interval
);
99 // To silence pre 4.3 g++ compiler warnings
100 virtual ~WindowManager() {};
102 // Static Alloc/deallocators
103 // Note: Write this function in each implementation-specific file,
104 // e.g. windowmanager-sdl.cc has its own WindowManager::create().
105 static void create();
106 static void shutdown();
109 virtual int init(coord_def
*m_windowsz
) = 0;
111 // Environment state functions
112 virtual void set_window_title(const char *title
) = 0;
113 virtual bool set_window_icon(const char* icon_name
) = 0;
114 virtual key_mod
get_mod_state() const = 0;
115 virtual void set_mod_state(key_mod mod
) = 0;
116 virtual int byte_order() = 0;
118 // System time functions
119 virtual void set_timer(unsigned int interval
,
120 wm_timer_callback callback
) = 0;
121 virtual unsigned int get_ticks() const = 0;
122 virtual void delay(unsigned int ms
) = 0;
125 virtual int raise_custom_event() = 0;
126 virtual int wait_event(wm_event
*event
) = 0;
127 virtual unsigned int get_event_count(wm_event_type type
) = 0;
130 virtual void resize(coord_def
&m_windowsz
) = 0;
131 virtual void swap_buffers() = 0;
132 virtual int screen_width() const = 0;
133 virtual int screen_height() const = 0;
134 virtual int desktop_width() const = 0;
135 virtual int desktop_height() const = 0;
138 virtual bool load_texture(GenericTexture
*tex
, const char *filename
,
139 MipMapOptions mip_opt
, unsigned int &orig_width
,
140 unsigned int &orig_height
,
141 tex_proc_func proc
= NULL
,
142 bool force_power_of_two
= true) = 0;
146 // Main interface for UI functions
147 extern WindowManager
*wm
;
150 #endif //include guard