示例#1
0
文件: maze.c 项目: GNOME/gcompris
/* =====================================================================
 *
 * =====================================================================*/
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);
  }
}
示例#2
0
文件: maze.c 项目: GNOME/gcompris
/*
 * Repeat let the user get a help map in 3D mode
 *
 */
static void repeat () {
  if(modeIsInvisible) {
    if(mapActive) {
      g_object_set (wallgroup, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
      /* Hide the warning */
      g_object_set (warning_item, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
      mapActive = FALSE;
    } else {
      g_object_set (wallgroup, "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);
      /* Display a warning that you can't move there */
      g_object_set (warning_item, "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);
      mapActive = TRUE;
    }
  }

  if(modeIs2D)
    return;

  if(threeDactive) {
    RsvgHandle *svg_handle;
    svg_handle = gc_rsvg_load("maze/maze-3d-bubble.svg");
    if(svg_handle) {
      gc_bar_set_repeat_icon(svg_handle);
      g_object_unref(svg_handle);
    }
    twoDdisplay();
    /* Display a warning that you can't move there */
    g_object_set (warning_item, "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);

  } else {

    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);
    }
    g_object_set (warning_item, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
    threeDdisplay();
  }

}
示例#3
0
static void start_board (GcomprisBoard *agcomprisBoard)
{
  GHashTable *config = gc_db_get_board_conf();
  guint ready;

  board_paused = TRUE;

  gc_locale_set(g_hash_table_lookup( config, "locale_sound"));

  g_hash_table_destroy(config);

  ready = sounds_are_fine();

  gc_sound_bg_pause();

  if (agcomprisBoard!=NULL)
    {
      gcomprisBoard=agcomprisBoard;

      if ( gcomprisBoard->mode && g_ascii_strcasecmp(gcomprisBoard->mode, "uppercase")==0 )
	uppercase_only = TRUE;
      else
	uppercase_only = FALSE;

      gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas),
			      "click_on_letter/background.svgz");

      gc_score_start(SCORESTYLE_NOTE,
		     50,
		     50,
		     0);

      load_datafile();

      gcomprisBoard->level=1;
      gcomprisBoard->sublevel=1;

      carriage_svg_handle = gc_rsvg_load("click_on_letter/carriage.svgz");
      rsvg_handle_get_dimensions (carriage_svg_handle, &carriage_svg_dimension);

      cloud_svg_handle = gc_rsvg_load("click_on_letter/cloud.svgz");
      rsvg_handle_get_dimensions (cloud_svg_handle, &cloud_svg_dimension);

      if(ready)
	{
	  if(ready == OK)
	    click_on_letter_next_level();

	  gamewon = FALSE;
	  pause_board(FALSE);
	}

      RsvgHandle *svg_handle;
      svg_handle = gc_rsvg_load("click_on_letter/repeat.svg");
      if(svg_handle) {
	gc_bar_set_repeat_icon(svg_handle);
	g_object_unref(svg_handle);
	gc_bar_set(GC_BAR_CONFIG|GC_BAR_LEVEL|GC_BAR_REPEAT_ICON);
      } else {
	gc_bar_set(GC_BAR_CONFIG|GC_BAR_LEVEL|GC_BAR_REPEAT);
      }
      gc_bar_location(BOARDWIDTH-300, 5, 0.7);

    }

}