/* a GcomprisConfCallback */ static gboolean conf_ok(GHashTable *table) { if (!table){ if (gcomprisBoard) pause_board(FALSE); return TRUE; } g_hash_table_foreach(table, save_table, NULL); if (gcomprisBoard){ GHashTable *config; if (profile_conf) config = gc_db_get_board_conf(); else config = table; gc_locale_set(g_hash_table_lookup( config, "locale")); gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only"); if (up_init_str && (strcmp(up_init_str, "True")==0)) uppercase_only = TRUE; else uppercase_only = FALSE; gchar *control_sound = g_hash_table_lookup( config, "with_sound"); if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) with_sound = TRUE; else with_sound = FALSE; if (profile_conf) g_hash_table_destroy(config); load_default_charset(); level_set_score(); gletters_next_level(); pause_board(FALSE); } board_conf = NULL; profile_conf = NULL; return TRUE; }
static gboolean conf_ok(GHashTable *table) { if (!table){ if (gcomprisBoard_missing) pause_board(FALSE); return TRUE; } g_hash_table_foreach(table, (GHFunc) save_table, NULL); if (gcomprisBoard_missing){ GHashTable *config; if (profile_conf) config = gc_db_get_board_conf(); else config = table; gc_locale_set(g_hash_table_lookup( config, "locale")); gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only"); if (up_init_str) { if(strcmp(up_init_str, "True")==0) uppercase_only = TRUE; else uppercase_only = FALSE; } if (profile_conf) g_hash_table_destroy(config); missing_destroy_board_list(board_list); board_list = NULL; init_xml(gcomprisBoard_missing->level); missing_letter_next_level(); } board_conf = NULL; profile_conf = NULL; pause_board(FALSE); return TRUE; }
/* ===================================================================== * * =====================================================================*/ static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->maxlevel=LAST_BOARD; gcomprisBoard->sublevel = 1; gcomprisBoard->number_of_sublevel = 8; gc_bar_set(GC_BAR_LEVEL); gc_score_start(SCORESTYLE_NOTE, BOARDWIDTH - 195, BOARDHEIGHT - 30, gcomprisBoard->number_of_sublevel); gamewon = FALSE; init_xml(); g_signal_connect(goo_canvas_get_root_item(gcomprisBoard->canvas), "button_press_event", (GtkSignalFunc) item_event, NULL); colors_next_level(); pause_board(FALSE); } }
/* ===================================================================== * * =====================================================================*/ static void end_board () { if(gcomprisBoard!=NULL){ pause_board(TRUE); submarine_destroy_all_items(); } gcomprisBoard = NULL; }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; /* disable im_context */ gcomprisBoard->disable_im_context = TRUE; gcomprisBoard->level=1; gcomprisBoard->maxlevel=NUMBER_OF_TARGET; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */ gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas), "target/target_background.svgz"); gc_bar_set(GC_BAR_LEVEL); gc_bar_location(BOARDWIDTH-200, -1, 0.8); target_next_level(); gamewon = FALSE; pause_board(FALSE); } }
static void end_board () { if(gcomprisBoard!=NULL) { pause_board(TRUE); gc_score_end(); #if GLIB_CHECK_VERSION(2, 31, 0) g_mutex_lock (&items_lock); #else g_static_mutex_lock (&items_lock); #endif wordsgame_destroy_all_items(); #if GLIB_CHECK_VERSION(2, 31, 0) g_mutex_unlock (&items_lock); #else g_static_mutex_unlock (&items_lock); #endif if (preedit_text){ goo_canvas_item_remove(preedit_text); preedit_text=NULL; } gc_im_reset(); gcomprisBoard = NULL; if (gc_wordlist != NULL){ gc_wordlist_free(gc_wordlist); gc_wordlist = NULL; } } gc_locale_set( NULL ); }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->maxlevel=6; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */ gc_bar_set(GC_BAR_LEVEL); gc_set_default_background(goo_canvas_get_root_item(gcomprisBoard->canvas)); gc_drag_start(goo_canvas_get_root_item(gcomprisBoard->canvas), (GcDragFunc)item_event, GC_DRAG_MODE_DEFAULT); hanoi_next_level(); gamewon = FALSE; pause_board(FALSE); } }
static void start_board (GcomprisBoard *agcomprisBoard) { GHashTable *config = gc_db_get_board_conf(); gc_locale_set(g_hash_table_lookup( config, "locale")); gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only"); if (up_init_str && (strcmp(up_init_str, "True")==0)) uppercase_only = TRUE; else uppercase_only = FALSE; g_hash_table_destroy(config); if(agcomprisBoard!=NULL) { gcomprisBoard_missing=agcomprisBoard; gc_set_background(goo_canvas_get_root_item(gcomprisBoard_missing->canvas), "missing_letter/missingletter-bg.jpg"); _init(agcomprisBoard); gc_bar_set(GC_BAR_CONFIG | GC_BAR_LEVEL); gc_bar_location(10, -1, 0.9); missing_letter_next_level(); gamewon = FALSE; pause_board(FALSE); } }
static void config_start(GcomprisBoard *agcomprisBoard, GcomprisProfile *aProfile) { board_conf = agcomprisBoard; profile_conf = aProfile; if (gcomprisBoard_missing) pause_board(TRUE); else { gcomprisBoard_missing=agcomprisBoard; _init(agcomprisBoard); } gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"), agcomprisBoard->name, aProfile ? aProfile->name : ""); GcomprisBoardConf *bconf; bconf = gc_board_config_window_display( label, conf_ok); g_free(label); /* init the combo to previously saved value */ GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *locale = g_hash_table_lookup( config, "locale"); gc_board_config_combo_locales(bconf, locale); config_missing_letter(bconf, config); }
static void end_board () { if (currentUiMode == UIMODE_SOUND) { gc_sound_policy_set(sound_policy); gc_sound_bg_resume(); } if(gcomprisBoard!=NULL) { pause_board(TRUE); memory_destroy_all_items(); if (currentMode == MODE_TUX){ if (tux_memory) g_queue_free(tux_memory); tux_memory = NULL; } } g_free(op_add); op_add = NULL; g_free(op_minus); op_minus = NULL; g_free(op_mult); op_mult = NULL; g_free(op_div); op_div = NULL; gcomprisBoard = NULL; }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; /* disable im_context */ gcomprisBoard->disable_im_context = TRUE; gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas), "planegame/background.svgz"); /* set initial values for this level */ gcomprisBoard->level = 1; gcomprisBoard->maxlevel = 2; gc_bar_set(GC_BAR_LEVEL); gc_bar_location(10, -1, 0.6); planegame_next_level(); pause_board(FALSE); } }
/* Called with items_lock locked */ static void wordsgame_next_level_unlocked() { gcomprisBoard->number_of_sublevel = 10 + ((gcomprisBoard->level-1) * 5); gc_score_start(SCORESTYLE_NOTE, BOARDWIDTH - 195, BOARDHEIGHT - 30, gcomprisBoard->number_of_sublevel); gc_bar_set_level(gcomprisBoard); gc_score_set(gcomprisBoard->sublevel); wordsgame_destroy_all_items(); if (preedit_text){ goo_canvas_item_remove(preedit_text); preedit_text=NULL; } gc_im_reset(); items=g_ptr_array_new(); items2del=g_ptr_array_new(); /* Increase speed only after 5 levels */ if(gcomprisBoard->level > 5) { gint temp = fallSpeed-gcomprisBoard->level*200; if (temp > MIN_FALLSPEED) fallSpeed=temp; } pause_board(FALSE); }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->maxlevel=2; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */ boardRootItem = goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas), NULL); /* Try the next level */ canal_lock_create_item(boardRootItem); canal_lock_next_level(); gc_bar_set(0); gc_bar_location(5, -1, -1); animation = FALSE; pause_board(FALSE); } }
/* ======================================= */ static void end_board () { if(gcomprisBoard!=NULL) { pause_board(TRUE); wordprocessor_destroy_all_items(); } gcomprisBoard = NULL; }
/* ===================================================================== * * =====================================================================*/ static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; /* disable im_context */ gcomprisBoard->disable_im_context = TRUE; gc_set_default_background(goo_canvas_get_root_item(gcomprisBoard->canvas)); gcomprisBoard->level=1; gcomprisBoard->maxlevel=20; /* The mode defines if we run 2D or 3D */ /* Default mode is 2D */ modeRelative=FALSE; modeIsInvisible=FALSE; run_fast_possible=TRUE; if(!gcomprisBoard->mode) modeIs2D=TRUE; else if(g_ascii_strncasecmp(gcomprisBoard->mode, "2DR", 3)==0) { /* 2D Relative */ modeIs2D=TRUE; modeRelative=TRUE; } else if(g_ascii_strncasecmp(gcomprisBoard->mode, "2DI", 3)==0) { modeIs2D=TRUE; modeIsInvisible=TRUE; } else if(g_ascii_strncasecmp(gcomprisBoard->mode, "2D", 2)==0) { modeIs2D=TRUE; } else if(g_ascii_strncasecmp(gcomprisBoard->mode, "3D", 2)==0) { modeIs2D=FALSE; run_fast_possible=FALSE; } if(!modeIs2D || modeIsInvisible) { RsvgHandle *svg_handle; svg_handle = gc_rsvg_load("maze/maze-2d-bubble.svg"); if(svg_handle) { gc_bar_set_repeat_icon(svg_handle); g_object_unref(svg_handle); gc_bar_set(GC_BAR_LEVEL|GC_BAR_REPEAT_ICON); } else { gc_bar_set(GC_BAR_LEVEL|GC_BAR_REPEAT); } } else { /* 2D Regular mode */ gc_bar_set(GC_BAR_LEVEL); } gc_bar_location(-1, -1, 0.6); gamewon = FALSE; maze_next_level(); pause_board(FALSE); } }
/* ======================================= */ static void end_board () { if(gcomprisBoard!=NULL) { gc_drag_stop(goo_canvas_get_root_item(gcomprisBoard->canvas)); pause_board(TRUE); hanoi_destroy_all_items(); } gcomprisBoard = NULL; }
/* ===================================================================== * * =====================================================================*/ static void end_board () { if(gcomprisBoard!=NULL){ pause_board(TRUE); gc_score_end(); colors_destroy_all_items(); // free list while (g_list_length(listColors) > 0) listColors = g_list_remove(listColors, g_list_nth_data(listColors,0)); } gcomprisBoard = NULL; }
/* ===================================================================== * * =====================================================================*/ static void end_board () { if(gcomprisBoard!=NULL){ pause_board(TRUE); submarine_destroy_all_items(); } gcomprisBoard = NULL; if(backgroundRootItem != NULL){ goo_canvas_item_remove(backgroundRootItem); } backgroundRootItem = NULL; }
static void end_board () { if(gcomprisBoard!=NULL) { pause_board(TRUE); gc_score_end(); planegame_destroy_all_items(); gcomprisBoard->level = 1; // Restart this game to zero } gcomprisBoard = NULL; }
static void gletter_config_start(GcomprisBoard *agcomprisBoard, GcomprisProfile *aProfile) { board_conf = agcomprisBoard; profile_conf = aProfile; gchar *label; if (gcomprisBoard) pause_board(TRUE); label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"), agcomprisBoard->name, aProfile ? aProfile->name : ""); GcomprisBoardConf *bconf = gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok); g_free(label); /* init the combo to previously saved value */ GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *locale = g_hash_table_lookup( config, "locale"); gc_board_config_combo_locales( bconf, locale); gboolean up_init = FALSE; gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only"); if (up_init_str && (strcmp(up_init_str, "True")==0)) up_init = TRUE; gc_board_conf_separator(bconf); gchar *control_sound = g_hash_table_lookup( config, "with_sound"); if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) with_sound = TRUE; else with_sound = FALSE; gc_board_config_boolean_box(bconf, _("Enable sounds"), "with_sound", with_sound); gc_board_conf_separator(bconf); gc_board_config_boolean_box(bconf, _("Uppercase only text"), "uppercase_only", up_init); }
/* ===================================================================== * * =====================================================================*/ static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas), "submarine/sub_bg.jpg"); gcomprisBoard->level=1; gcomprisBoard->maxlevel=3; gcomprisBoard->sublevel=1; gc_bar_set(GC_BAR_LEVEL); gc_bar_location(0, -1, 0.6); submarine_next_level(); gamewon = FALSE; pause_board(FALSE); } }
static gboolean conf_ok(GHashTable *table) { if (!table){ if (gcomprisBoard) pause_board(FALSE); return TRUE; } g_hash_table_foreach(table, (GHFunc) save_table, NULL); if (gcomprisBoard) { GHashTable *config; if (profile_conf) config = gc_db_get_board_conf(); else config = table; gc_locale_set(g_hash_table_lookup( config, "locale")); if (profile_conf) g_hash_table_destroy(config); destroy_board_list(); init_xml(gcomprisBoard->level); imageid_next_level(); pause_board(FALSE); } board_conf = NULL; profile_conf = NULL; return TRUE; }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->sublevel=1; gc_bar_set(GC_BAR_LEVEL|GC_BAR_CONFIG); gc_bar_location(-1, -1, 0.7); if (strcmp(gcomprisBoard->mode, "count") == 0) board_mode = MODE_COUNT; else if (strcmp(gcomprisBoard->mode, "weight") == 0) board_mode = MODE_WEIGHT; else board_mode = DEFAULT_MODE; gcomprisBoard->maxlevel = (board_mode == MODE_COUNT) ? 4 : 5; gcomprisBoard->number_of_sublevel = (board_mode == MODE_COUNT) ? 5 : 3; bonus_item = (board_mode == MODE_COUNT) ? GC_BONUS_SMILEY : GC_BONUS_TUX; gamewon = FALSE; pause_board(FALSE); GHashTable *config = gc_db_get_board_conf(); gchar *drag_mode_str = g_hash_table_lookup( config, "drag_mode"); if (drag_mode_str && (strcmp (drag_mode_str, "NULL") != 0)) drag_mode = g_ascii_strtod(drag_mode_str, NULL); else drag_mode = GC_DRAG_MODE_DEFAULT; gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas), "scale/tabepice.jpg"); gc_drag_start(goo_canvas_get_root_item(gcomprisBoard->canvas), (GcDragFunc)scale_drag_event, drag_mode); gc_score_start(SCORESTYLE_NOTE, BOARDWIDTH - 220, 450 , gcomprisBoard->number_of_sublevel); scale_next_level(); } }
static void end_board () { if(gcomprisBoard!=NULL) { pause_board(TRUE); gc_score_end(); imageid_destroy_all_items(); destroy_board_list(); } gc_locale_set( NULL ); gcomprisBoard = NULL; }
/* ======================================= */ static void end_board () { // If we don't stop animation, there may be a segfault if leaving while the animation is running if (timer_id) { gtk_timeout_remove (timer_id); timer_id = 0; } animation = FALSE; if(gcomprisBoard!=NULL) { pause_board(TRUE); canal_lock_destroy_all_items(); } gcomprisBoard = NULL; }
static void end_board () { if(gcomprisBoard_missing!=NULL) { pause_board(TRUE); gc_score_end(); missing_letter_destroy_all_items(); missing_destroy_board_list(board_list); board_list = NULL; } gc_locale_set( NULL ); gcomprisBoard_missing = NULL; }
/* ======================================= */ static void end_board () { if(gcomprisBoard!=NULL) { pause_board(TRUE); gc_score_end(); click_on_letter_destroy_all_items(); g_strfreev(answers); g_strfreev(questions); g_object_unref(carriage_svg_handle); g_object_unref(cloud_svg_handle); clear_levels(); } gc_locale_set( NULL ); gcomprisBoard = NULL; gc_sound_bg_resume(); }
static gboolean load_event (GooCanvasItem *item, GooCanvasItem *target, GdkEventButton *event, gchar *data) { if (event->button != 1) return FALSE; pause_board(TRUE); gc_selector_file_load(gcomprisBoard, "wordprocessor", ".xhtml", load_buffer, NULL); return FALSE; }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->maxlevel=6; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */ gc_bar_set(GC_BAR_LEVEL); fifteen_next_level(); gamewon = FALSE; pause_board(FALSE); } }
static void start_board (GcomprisBoard *agcomprisBoard) { if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; gcomprisBoard->level=1; gcomprisBoard->maxlevel=1; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */ gc_bar_set(0); gc_bar_location(10, -1, 0.6); gc_set_default_background(goo_canvas_get_root_item(gcomprisBoard->canvas)); wordprocessor_create(); pause_board(FALSE); } }