Mercurial > MadButterfly
comparison include/mb_redraw_man.h @ 462:af4b506ad56f
Add backend layer to seperate the backend with the MBAF. Currently, X is the only backend. If we have more than one backend, we need to modify the Makefile to sleect the backend or implement a backend selection mechanism in the runtime.
author | wycc@122-116-38-188.HINET-IP.hinet.net |
---|---|
date | Wed, 28 Oct 2009 02:39:02 +0800 |
parents | 16116d84bc5e |
children | 5d0b2761f89c |
comparison
equal
deleted
inserted
replaced
461:61a0bceb369d | 462:af4b506ad56f |
---|---|
4 #include "mb_graph_engine.h" | 4 #include "mb_graph_engine.h" |
5 #include "mb_tools.h" | 5 #include "mb_tools.h" |
6 #include "mb_types.h" | 6 #include "mb_types.h" |
7 #include "mb_observer.h" | 7 #include "mb_observer.h" |
8 #include "mb_img_ldr.h" | 8 #include "mb_img_ldr.h" |
9 #include "mb_timer.h" | |
9 | 10 |
10 typedef struct _redraw_man redraw_man_t; | 11 typedef struct _redraw_man redraw_man_t; |
11 | 12 |
12 typedef void (*free_func_t)(redraw_man_t *rdman, void *obj); | 13 typedef void (*free_func_t)(redraw_man_t *rdman, void *obj); |
13 struct _free_obj { | 14 struct _free_obj { |
223 extern void sprite_set_search_path(char *path); | 224 extern void sprite_set_search_path(char *path); |
224 | 225 |
225 extern paint_t *rdman_img_ldr_load_paint(redraw_man_t *rdman, | 226 extern paint_t *rdman_img_ldr_load_paint(redraw_man_t *rdman, |
226 const char *img_id); | 227 const char *img_id); |
227 | 228 |
229 typedef void (*mb_eventcb_t )(int fd,void *arg); | |
230 #define MONITOR_READ 1 | |
231 #define MONITOR_WRITE 2 | |
232 | |
233 /*! \brief The backend engine mb_backend_t is used to define the interface to realize the MB. | |
234 * | |
235 * A backend is used to receive events from the system. The MB does not define the backend by itself. | |
236 * Instead, it define an interface which allow the lower layer to implement the event system. Each | |
237 * backend need to provides the following events. | |
238 * | |
239 * - keyboard event | |
240 * - timer event | |
241 * - image loader(?) | |
242 * - render manager(?) | |
243 */ | |
244 typedef struct { | |
245 | |
246 void *(*init)(char *display,int w,int h); | |
247 void (*free)(void *be); | |
248 void (*add_event)(void *be,int type, int fd, mb_eventcb_t f,void *arg); | |
249 void (*remove_event)(void *be,int type, int fd); | |
250 void (*loop)(void *be); | |
251 subject_t *(*kbevents)(void *be); | |
252 redraw_man_t *(*rdman)(void *be); | |
253 mb_tman_t *(*tman)(void *be); | |
254 ob_factory_t *(*factory)(void *be); | |
255 mb_img_ldr_t *(*loader)(void *be); | |
256 } mb_backend_t; | |
257 | |
258 extern mb_backend_t backend; | |
259 | |
228 #endif /* __REDRAW_MAN_H_ */ | 260 #endif /* __REDRAW_MAN_H_ */ |