1 #ifndef X11_UI_H 2 #define X11_UI_H 3 4 #include "types.h" 5 6 #define CURSOR_SEP_MASK 0 7 #define CURSOR_OWN_MASK 1 8 9 #define DIALOG_NEWGAME 0 10 #define DIALOG_PAUSEGAME 1 11 #define DIALOG_WARPLEVEL 2 12 #define DIALOG_HIGHSCORE 3 13 #define DIALOG_QUITGAME 4 14 #define DIALOG_STORY 5 15 #define DIALOG_RULES 6 16 #define DIALOG_ABOUT 7 17 #define DIALOG_SCORE 8 18 #define DIALOG_ENDGAME 9 19 #define DIALOG_ENTERNAME 10 20 #define DIALOG_MAX 10 21 22 void UI_restart_timer(void); 23 void UI_kill_timer(void); 24 25 void UI_pause_game(void); 26 void UI_resume_game(void); 27 28 void UI_initialize(const char *gui, int *argc, char **argv); 29 void UI_make_main_window(int size); 30 void UI_graphics_init(void); 31 void UI_make_dialogs(Picture *logo, Picture *icon, Picture *about); 32 33 void UI_popup_dialog(int index); 34 void UI_set_cursor(MCursor *cursor); 35 void UI_set_icon(Picture *icon); 36 void UI_clear(void); 37 void UI_refresh(void); 38 void UI_draw(Picture *picture, int x, int y); 39 void UI_draw_line(int x1, int y1, int x2, int y2); 40 void UI_draw_str(const char *str, int x, int y); 41 42 void UI_set_pausebutton(int action); 43 void UI_main_loop(void); 44 45 void UI_update_dialog(int index, const char *str); 46 47 void UI_load_picture(const char *name, int trans, Picture **pictp); 48 void UI_load_picture_indexed(const char *name, int index, int trans, 49 Picture **pictp); 50 int UI_picture_width(Picture *pict); 51 int UI_picture_height(Picture *pict); 52 53 void UI_load_cursor(const char *name, int masked, MCursor **cursorp); 54 55 int 56 UI_intersect(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); 57 58 const char *UI_dialog_string(int index); 59 const char *UI_menu_string(int index); 60 61 typedef struct UI_methods { 62 void (*set_cursor)(MCursor *cursor); 63 void (*load_cursor)(const char *name, int masked, MCursor **cursorp); 64 void (*load_picture)(const char *name, int trans, Picture **pictp); 65 void (*set_icon)(Picture *pict); 66 int (*picture_width)(Picture *pict); 67 int (*picture_height)(Picture *pict); 68 void (*graphics_init)(void); 69 void (*clear_window)(void); 70 void (*refresh_window)(void); 71 void (*draw_image)(Picture *pict, int x, int y); 72 void (*draw_line)(int x1, int y1, int x2, int y2); 73 void (*draw_string)(const char *str, int x, int y); 74 void (*start_timer)(int ms); 75 void (*stop_timer)(void); 76 int (*timer_active)(void); 77 void (*popup_dialog)(int index); 78 void (*main_loop)(void); 79 void (*initialize)(int *argc, char **argv); 80 void (*make_main_window)(int size); 81 void (*create_dialogs)(Picture *logo, Picture *icon, Picture *about); 82 void (*set_pausebutton)(int active); 83 void (*update_dialog)(int index, const char *str); 84 } UI_methods; 85 86 #endif 87