static void menu_config_start(GcomprisBoard *agcomprisBoard, GcomprisProfile *aProfile) { if(gcomprisBoard!=NULL) { menu_pause(TRUE); gc_config_start(); } }
static void menu_config () { if(gcomprisBoard!=NULL) { menu_pause(TRUE); gc_config_start(); } }
static void menu_start (GcomprisBoard *agcomprisBoard) { current_x = 0.0; current_y = 0.0; /* initialisations */ /* in case we will make this parametrable */ panel_x = P_X; panel_y = P_Y; panel_w = P_W; panel_h = P_H; top_x = T_X; top_y = T_Y; top_w = T_W; top_h = T_H; top_int_x = T_INT_X; top_arrow_size = T_ARROW_SIZE; display_x = D_X; display_y = D_Y; display_w = D_W; display_h = D_H; display_int_x = D_INT_X; display_int_y = D_INT_Y; info_x = I_X; info_y = I_Y; info_w = I_W; info_h = I_H; icon_size = ICON_SIZE; icon_size_panel = ICON_SIZE_PANEL; icon_size_top = ICON_SIZE_TOP; if(agcomprisBoard != NULL) { RsvgHandle *svg_handle; gcomprisBoard=agcomprisBoard; /* set initial values for this level */ gcomprisBoard->level = 1; gcomprisBoard->maxlevel=1; /* Set back the bar to it's original location */ gc_bar_set(GC_BAR_CONFIG|GC_BAR_ABOUT|GC_BAR_JOURNAL|GC_BAR_SHARE); menuitems = g_new(MenuItems, 1); svg_handle = gc_skin_rsvg_get(); gc_set_background_by_id (goo_canvas_get_root_item(gcomprisBoard->canvas), svg_handle, "#BACKGROUND"); boardRootItem = \ goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas), NULL); g_object_set_data_full(G_OBJECT (boardRootItem), "menuitems", menuitems, g_free); goo_canvas_svg_new (boardRootItem, svg_handle, "svg-id", "#SELECTOR", "pointer-events", GOO_CANVAS_EVENTS_NONE, NULL); goo_canvas_svg_new (boardRootItem, svg_handle, "svg-id", "#BUTTON_HORIZONTAL", "pointer-events", GOO_CANVAS_EVENTS_NONE, NULL); create_info_area(boardRootItem, menuitems); create_panel(boardRootItem); if (menu_position) display_section(menu_position); else display_welcome(menuitems); { if ( strcmp(gc_prop_get()->profile->name, GC_PROFILE_DEFAULT) != 0 ) { gchar *text = g_strdup_printf(_("Profile: %s"), gc_prop_get()->profile->name); goo_canvas_text_new (boardRootItem, text, BOARDWIDTH - 10, BOARDHEIGHT - 30, -1, GTK_ANCHOR_EAST, "font", gc_skin_font_board_tiny, "fill-color-rgba", gc_skin_get_color("menu/text"), "alignment", PANGO_ALIGN_RIGHT, NULL); g_free(text); } } { gchar *text = g_strdup_printf(_("Number of activities: %d"), gc_board_get_number_of_activity()); goo_canvas_text_new (boardRootItem, text, BOARDWIDTH - 10, BOARDHEIGHT - 10, -1, GTK_ANCHOR_EAST, "font", gc_skin_font_board_tiny, "fill-color-rgba", gc_skin_get_color("menu/text"), "alignment", PANGO_ALIGN_RIGHT, NULL); g_free(text); } menu_pause(FALSE); } }
int main(int argc, char **argv) { GRRLIB_Init(); // Initialise the attached controllers WPAD_Init(); WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); // Initialise the audio subsystem AESND_Init(NULL); MODPlay_Init(&play); MODPlay_SetMOD(&play,bg_music); MODPlay_SetVolume(&play,63,63); MODPlay_Start(&play); cui_cursor cursor; cursor.tex[0]=GRRLIB_LoadTexture(player1_point_png); cursor.tex[1]=GRRLIB_LoadTexture(player1_grab_png); cursor.is_grabbing=false; cui_board board; ENGINE engine = FIRSTCHESS; if(engine == TSCP){ int i; for (i=0; i < CUI_TILE_NB; i++) { board.piece[i]=init_piece[i]; if(init_color[i] == 1){ board.color[i]=CUI_BLACK; }else if (init_color[i] == 6){ board.color[i]=CUI_EMPTY; }else if (init_color[i] == 0){ board.color[i]=CUI_WHITE; } } init_hash(); init_board(); open_book(); gen(); } cui_board_read_core(&board, engine); GRRLIB_SetBackgroundColour(0x030, 0x30, 0x42, 0xFF); board.tile_color1 = 0xAAAAAAFF; board.tile_color2 = 0x444444FF; board.piece_color1 = 0xAAAAAAFF; board.piece_color2 = 0x444444FF; cui_board_init(&board); cui_game game; game.board = &board; game.engine = engine; game.cursor = &cursor; game.is_mute = false; GRRLIB_texImg *tex_wallpaper = GRRLIB_LoadTexture(wall_jpg); game.tex_wallpaper = tex_wallpaper; voice = AESND_AllocateVoice(aesnd_callback); AESND_SetVoiceVolume(voice, 0xFF, 0xFF); AESND_SetVoiceStream(voice, true); cui_menu current_state = CUI_MENU_MAIN; while(current_state != CUI_MENU_EXIT) { switch(current_state){ case CUI_MENU_MAIN: current_state=menu_main(&game);break; case CUI_MENU_PLAY: current_state=menu_play(&game);break; case CUI_MENU_OPTION:current_state=menu_option(&game);break; case CUI_MENU_OPTION_GENERAL:current_state=menu_option_general(&game);break; case CUI_MENU_OPTION_GFX:current_state=menu_option_gfx(&game);break; case CUI_MENU_OPTION_SND:current_state=menu_option_snd(&game);break; case CUI_MENU_CREDITS:current_state=menu_credits(&game);break; case CUI_MENU_PAUSE:current_state=menu_pause(&game);break; case CUI_MENU_HOME:current_state=menu_home(&game);break; case CUI_MENU_EXIT:current_state=menu_exit(&game);break; default:break; } } GRRLIB_FreeTexture(tex_wallpaper); GRRLIB_FreeTexture(cursor.tex[0]); GRRLIB_FreeTexture(cursor.tex[1]); GRRLIB_Exit(); return 0; }