6 #include "SDL_rotozoom.h"
9 #include "menu.h" /* for paint_menu_fps() */
16 #include "widget/widgets.h"
29 void init_game(void *vdata
, struct xuni_t
*xuni
,
30 struct widget_t
*panel
, struct resource_t
*settings
) {
32 /*struct game_data_t *data = vdata;*/
33 struct widget_t
*temppanel
;
35 init_wid(xuni
->gui
->widget
, xuni
->gui
->widget
,
37 init_wid(xuni
->gui
->widget
, xuni
->gui
->widget
,
38 PANEL_GAME_MENU
, "game menu");
40 init_wid(xuni
->gui
->widget
, panel
, WID_MENU
, "game/menu");
41 init_wid(xuni
->gui
->widget
, panel
, WID_MENU_BACK
, "game menu/back");
42 init_wid(xuni
->gui
->widget
, panel
, WID_MENU_QUIT
, "game menu/quit");
44 /*add_widget_accelerator(panel,
45 widget_nameid_access(panel, WID_MENU), SDLK_F10, KMOD_NONE);*/
47 temppanel
= widget_nameid_access(xuni
->gui
->widget
, PANEL_GAME_MENU
);
48 add_widget_accelerator(xuni
, temppanel
,
49 widget_nameid_access(panel
, WID_MENU_BACK
), SDLK_ESCAPE
, KMOD_NONE
);
50 /*add_widget_accelerator(temppanel,
51 widget_nameid_access(panel, WID_MENU_BACK), SDLK_F10, KMOD_NONE);*/
54 void start_game(void *vdata
, struct xuni_t
*xuni
) {
55 /*struct game_data_t *data = vdata;*/
56 struct widget_t
*cursor
;
57 struct widget_t
*panel
58 = widget_nameid_access(xuni
->gui
->widget
, PANEL_GAME
);
60 set_caption("Explore the Universe");
62 cursor
= widget_nameid_access(xuni
->theme
->current
, THEME_DEFAULT_CURSOR
);
64 if(cursor
&& cursor
->p
.image
->image
&& panel
->p
.panel
->frameupdate
) {
69 int game_event(void *vdata
, struct xuni_t
*xuni
, panel_type_t
*mode
,
74 switch(event
->key
.keysym
.sym
) {
76 /* there is currently no widget for this */
77 if(*mode
== PANEL_GAME
) {
78 *mode
= PANEL_MAIN_MENU
;
86 *mode
= PANEL_MAIN_MENU
;
95 void paint_game(void *vdata
, panel_type_t mode
, struct xuni_t
*xuni
) {
96 /*struct game_data_t *data = vdata;*/
97 struct widget_t
*panel
98 = widget_nameid_access(xuni
->gui
->widget
, PANEL_GAME
);
100 clear_screen(xuni
->smode
->screen
);
102 widget_event(xuni
, widget_nameid_access(xuni
->gui
->widget
, PANEL_GAME
),
105 if(mode
== PANEL_GAME_MENU
) {
106 widget_event(xuni
, widget_nameid_access(xuni
->gui
->widget
,
107 PANEL_GAME_MENU
), WIDGET_EVENT_PAINT
);
110 paint_menu_fps(xuni
, THEME_FONT_MONO
);
112 if(panel
->p
.panel
->frameupdate
) {
113 paint_cursor(xuni
->smode
,
114 widget_nameid_access(xuni
->theme
->current
, THEME_DEFAULT_CURSOR
));
120 int game_perform_click(struct widget_t
*widget
, panel_type_t
*mode
,
121 void *vdata
, struct xuni_t
*xuni
) {
123 /*struct game_data_t *data = vdata;*/
127 *mode
= PANEL_GAME_MENU
;
129 clear_gui(xuni
, PANEL_GAME_MENU
, 0);
134 clear_gui(xuni
, PANEL_GAME
, 0);
137 *mode
= PANEL_MAIN_MENU
;
141 return 0; /* ignored */
144 void free_game(void *vdata
, struct xuni_t
*xuni
) {