예제 #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 display_paying_note(guint note, guint x, guint y)
{
  gchar *note_str = g_strdup_printf("money/n%de.svgz", note);
  RsvgHandle *svg_handle;
  svg_handle = gc_rsvg_load(note_str);
  GooCanvasItem *item = goo_canvas_svg_new(boardRootItem,
					   svg_handle,
					   NULL);
  goo_canvas_item_translate(item, x, y);
  goo_canvas_item_scale(item, 0.25, 0.25);
  g_object_unref(svg_handle);
  g_free(note_str);
}
예제 #4
0
/* ==================================== */
static GooCanvasItem *canal_lock_create_item(GooCanvasItem *boardRootItem)
{
  RsvgHandle *svg_handle;

  svg_handle = gc_rsvg_load("canal_lock/canal_lock.svgz");

  /* The background */
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#BACKGROUND",
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);

  /* The boat */
  tuxboat_item = goo_canvas_svg_new (boardRootItem, svg_handle,
				     "svg-id", "#BOAT_NO_SAIL", NULL);

  g_signal_connect(tuxboat_item, "button-press-event",
                   (GtkSignalFunc) item_event,
                   NULL);
  gc_item_focus_init(tuxboat_item, NULL);

  GooCanvasBounds bounds;
  goo_canvas_item_get_bounds(tuxboat_item, &bounds);
  tuxboat_width = bounds.x2 - bounds.x1 + 20;

  /* The left lights */
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#LEFT_RED_OFF",
		      "visibility", GOO_CANVAS_ITEM_VISIBLE,
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#LEFT_GREEN_OFF",
		      "visibility", GOO_CANVAS_ITEM_VISIBLE,
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);
  left_red_on_item =
    goo_canvas_svg_new (boardRootItem, svg_handle,
			"svg-id", "#LEFT_RED_ON",
			"visibility", GOO_CANVAS_ITEM_INVISIBLE,
			"pointer-events", GOO_CANVAS_EVENTS_NONE,
			NULL);
  left_green_on_item =
    goo_canvas_svg_new (boardRootItem, svg_handle,
			"svg-id", "#LEFT_GREEN_ON",
			"visibility", GOO_CANVAS_ITEM_INVISIBLE,
			"pointer-events", GOO_CANVAS_EVENTS_NONE,
			NULL);
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#LEFT_LIGHT_BASE",
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);

  /* The right lights */
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#RIGHT_RED_OFF",
		      "visibility", GOO_CANVAS_ITEM_VISIBLE,
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);
  goo_canvas_svg_new (boardRootItem, svg_handle,
		      "svg-id", "#RIGHT_GREEN_OFF",
		      "visibility", GOO_CANVAS_ITEM_VISIBLE,
		      "pointer-events", GOO_CANVAS_EVENTS_NONE,
		      NULL);
  right_red_on_item = goo_canvas_svg_new (boardRootItem, svg_handle,
					 "svg-id", "#RIGHT_RED_ON",
					 "visibility", GOO_CANVAS_ITEM_INVISIBLE,
					 "pointer-events", GOO_CANVAS_EVENTS_NONE,
					 NULL);
  right_green_on_item = goo_canvas_svg_new (boardRootItem, svg_handle,
					 "svg-id", "#RIGHT_GREEN_ON",
					 "visibility", GOO_CANVAS_ITEM_INVISIBLE,
					 "pointer-events", GOO_CANVAS_EVENTS_NONE,
					 NULL);
  goo_canvas_svg_new (boardRootItem, svg_handle,
					 "svg-id", "#RIGHT_LIGHT_BASE",
					 "pointer-events", GOO_CANVAS_EVENTS_NONE,
					 NULL);

  /* This is the middle canal */
  canal_middle_item = goo_canvas_rect_new (boardRootItem,
					   LEFT_CANAL_WIDTH,
					   BASE_LINE - LEFT_CANAL_HEIGHT,
					   MIDDLE_CANAL_WIDTH,
					   LEFT_CANAL_HEIGHT,
					   "fill_color_rgba", CANAL_COLOR,
					   "line-width", (double) 0,
					   NULL);
  goo_canvas_item_raise(tuxboat_item, canal_middle_item);

  /* This is the left lock */
  lock_left_item = goo_canvas_rect_new (boardRootItem,
					LEFT_CANAL_WIDTH - LOCK_WIDTH / 2,
					BASE_LINE - LOCK_HEIGHT_MAX,
					LOCK_WIDTH,
					LOCK_HEIGHT_MAX,
					"fill_color_rgba", LOCK_COLOR,
					"line-width", (double) 0,
					NULL);
  set_lock_event(lock_left_item);

  /* This is the right lock */
  lock_right_item = goo_canvas_rect_new (boardRootItem,
					 LEFT_CANAL_WIDTH + MIDDLE_CANAL_WIDTH - LOCK_WIDTH / 2,
					 BASE_LINE - LOCK_HEIGHT_MAX,
					 LOCK_WIDTH,
					 LOCK_HEIGHT_MAX,
					 "fill_color_rgba", LOCK_COLOR,
					 "line-width", (double) 0,
					 NULL);
  set_lock_event(lock_right_item);

  /* And to finish, the 2 canal locks */
  canallock_left_item =
    goo_canvas_rect_new (boardRootItem,
			 LEFT_CANAL_WIDTH + MIDDLE_CANAL_WIDTH * 0.1,
			 SUBCANAL_BASE_LINE - SUBCANAL_HEIGHT,
			 LOCK_WIDTH / 2,
			 SUBCANAL_HEIGHT,
			 "fill_color_rgba", CANALLOCK_COLOR,
			 "line-width", (double) 0,
			 NULL);
  set_lock_event(canallock_left_item);

  canallock_right_item =
    goo_canvas_rect_new (boardRootItem,
			 LEFT_CANAL_WIDTH + MIDDLE_CANAL_WIDTH * 0.9,
			 SUBCANAL_BASE_LINE - SUBCANAL_HEIGHT,
			 LOCK_WIDTH / 2,
			 SUBCANAL_HEIGHT,
			 "fill_color_rgba", CANALLOCK_COLOR,
			 "line-width", (double) 0,
			 NULL);
  set_lock_event(canallock_right_item);

  g_object_unref (svg_handle);

  return NULL;
}
예제 #5
0
파일: maze.c 프로젝트: GNOME/gcompris
/* =====================================================================
 * set initial values for the next level
 * =====================================================================*/
static void maze_next_level() {
  GdkPixbuf *pixmap = NULL;

  maze_destroy_all_items();
  gc_bar_set_level(gcomprisBoard);
  setlevelproperties();

  mapActive = FALSE;

  ind = 0;
  gamewon = FALSE;
  initMaze();
  generateMaze((g_random_int()%breedte),(g_random_int()%hoogte));
  removeSet();
  /* Try the next level */
  maze_create_item(goo_canvas_get_root_item(gcomprisBoard->canvas));
  draw_background(wallgroup);

  if(modeIsInvisible) {
    g_object_set (wallgroup, "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
  }

  /* make a new group for the items */
  begin=g_random_int()%hoogte;
  end=g_random_int()%hoogte;

  /* Draw the tux */
  RsvgHandle *svg_handle = gc_rsvg_load("maze/tux_top_south.svg");
  tuxitem = goo_canvas_svg_new (tuxgroup, svg_handle,
				NULL);
  g_object_unref (svg_handle);

  goo_canvas_item_translate(tuxgroup,
			    cellsize*(0)-breedte + board_border_x,
			    cellsize*(begin)-hoogte + board_border_y);

  g_signal_connect(tuxitem,
		   "button_press_event",
		   (GCallback) tux_event, NULL);

  if(run_fast_possible) {
	  /* Load the tux shoes */
	  svg_handle = gc_rsvg_load("maze/tux_shoes_top_south.svgz");
	  tuxshoes = goo_canvas_svg_new (tuxgroup, svg_handle,
					"pointer-events", GOO_CANVAS_EVENTS_NONE, NULL);
	  g_object_unref (svg_handle);

	  /* Load fast-mode switch button */
	  svg_handle = gc_rsvg_load("maze/fast-mode-button.svgz");
	  fast_mode_button = goo_canvas_svg_new (boardRootItem, svg_handle,
					NULL);
	  g_object_unref (svg_handle);
	  goo_canvas_item_translate(fast_mode_button, 10, 10);
	  g_signal_connect(fast_mode_button,
			   "button_press_event",
			   (GCallback) on_fast_mode_button_press, NULL);
	  gc_item_focus_init(fast_mode_button, NULL);
  }

  /* Draw the target */
  pixmap = gc_pixmap_load("maze/door.png");
  if(pixmap)
    {
      draw_image(mazegroup,breedte-1,end,pixmap);
#if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24
      gdk_pixbuf_unref(pixmap);
#else
      g_object_unref(pixmap);
#endif
    }

  position[ind][0]=0;
  position[ind][1]=begin;
  Maze[0][begin]=Maze[0][begin]+SET;
  viewing_direction=EAST;
  threeDactive=FALSE;

  if(run_fast_possible) {
	  // run_fast-mode should be initialized at every level, whether TRUE or FALSE
	  if (gcomprisBoard->level < 14) set_run_fast(FALSE);
	  if (gcomprisBoard->level >= 14) set_run_fast(TRUE);
  }

  update_tux(viewing_direction);

  if(!modeIs2D)
    threeDdisplay();

}
예제 #6
0
void
money_widget_add (MoneyWidget *moneyWidget, MoneyEuroType value)
{
  GooCanvasItem *item;
  RsvgHandle    *svg_handle;
  RsvgDimensionData dimension;
  double	 xratio, yratio, ratio;
  double	 block_width, block_height;
  MoneyItem	*moneyitem;
  guint		 i, length;

  g_return_if_fail (moneyWidget != NULL);

  /* Search for an hidden item with the same value */
  length = g_list_length(moneyWidget->priv->moneyItemList);
  for(i=0; i<length; i++)
    {
      moneyitem = \
	(MoneyItem *)g_list_nth_data(moneyWidget->priv->moneyItemList,
				     i);

      if(moneyitem && !moneyitem->inPocket && moneyitem->value == value)
	{
	  g_object_set (moneyitem->item,
			"visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);
	  moneyitem->inPocket = TRUE;
	  moneyWidget->priv->total += euroList[value].value;
	  money_display_total(moneyWidget);
	  return;
	}
    }

  /* There is no already suitable item create, create a new one */

  if(moneyWidget->priv->next_spot
     > moneyWidget->priv->columns * moneyWidget->priv->lines)
    g_message("More money items requested than the pocket size\n");

  block_width  = \
    (moneyWidget->priv->x2 - moneyWidget->priv->x1)
    / moneyWidget->priv->columns;
  block_height = \
    (moneyWidget->priv->y2 - moneyWidget->priv->y1) / moneyWidget->priv->lines;

  svg_handle = gc_rsvg_load(euroList[value].image);

  rsvg_handle_get_dimensions(svg_handle, &dimension);

  xratio =  block_width  / (dimension.width + BORDER_GAP);
  yratio =  block_height / (dimension.height + BORDER_GAP);
  ratio = yratio = MIN(xratio, yratio);

  item =  goo_canvas_svg_new(moneyWidget->priv->rootItem,
			   svg_handle,
			   NULL);

  goo_canvas_item_translate(item,
			    moneyWidget->priv->x1 +
			    (moneyWidget->priv->next_spot % moneyWidget->priv->columns) * block_width
			    +  block_width/2 - (dimension.width * ratio)/2,
			    moneyWidget->priv->y1 +
			    (moneyWidget->priv->next_spot / moneyWidget->priv->columns)
			    * (block_height + BORDER_GAP)
			    + block_height/2 - (dimension.height * ratio)/2);
  goo_canvas_item_scale(item,
			ratio,
  			ratio);

  moneyitem = g_malloc(sizeof(MoneyItem));
  moneyitem->moneyWidget = moneyWidget;
  moneyitem->item   = item;
  moneyitem->value  = value;
  moneyitem->inPocket = TRUE;

  moneyWidget->priv->moneyItemList = \
    g_list_append (moneyWidget->priv->moneyItemList,
		   moneyitem);

  g_signal_connect(item,
		   "button_press_event", (GCallback) item_event,
		   moneyitem);

  g_object_unref(svg_handle);

  moneyWidget->priv->next_spot++;

  moneyWidget->priv->total += euroList[value].value;

  money_display_total(moneyWidget);
}
예제 #7
0
static GooCanvasItem *planegame_create_item(GooCanvasItem *parent)
{
    RsvgHandle *svg_handle;
    RsvgDimensionData dimension;
    GooCanvasItem *itemgroup;
    GooCanvasItem *item;
    char *number = NULL;
    int i, min;
    guint y;

    /* Random cloud number */
    if(g_random_int()%2==0)
    {
        /* Put the target */
        i = plane_target;
    }
    else
    {
        min = MAX(1, plane_target - 1);
        i   = min + g_random_int()%(plane_target - min + 3);
    }
    number = g_strdup_printf("%d", i);

    itemgroup = goo_canvas_group_new (parent, NULL);

    g_object_set_data (G_OBJECT (itemgroup),
                       "cloud_number", GINT_TO_POINTER (i));

    svg_handle = gc_rsvg_load("planegame/cloud.svgz");
    rsvg_handle_get_dimensions(svg_handle, &dimension);

    y = (g_random_int()%(BOARDHEIGHT - 40 -
                         (guint)(dimension.height * imageZoom)));

    goo_canvas_item_translate(itemgroup,
                              BOARDWIDTH,
                              y);

    item = goo_canvas_svg_new (itemgroup,
                               svg_handle,
                               NULL);
    goo_canvas_item_scale(item, imageZoom, imageZoom);

    g_object_unref(svg_handle);

    g_object_set_data (G_OBJECT (item),
                       "cloud_number", GINT_TO_POINTER (i));

    item = goo_canvas_text_new (itemgroup,
                                number,
                                dimension.width*imageZoom/2,
                                dimension.height*imageZoom/2,
                                -1,
                                GTK_ANCHOR_CENTER,
                                "font", gc_skin_font_board_big,
                                "fill-color", "red",
                                NULL);

    g_object_set_data (G_OBJECT (item),
                       "cloud_number", GINT_TO_POINTER (i));

    goo_canvas_item_animate(itemgroup,
                            -dimension.width*imageZoom,
                            y,
                            1.0,
                            0,
                            TRUE,
                            40*BOARDWIDTH,
                            40,
                            GOO_CANVAS_ANIMATE_FREEZE);

    /* The plane is always on top */
    goo_canvas_item_raise(itemgroup, NULL);
    goo_canvas_item_raise(planeitem, NULL);

    g_free (number);

    return (itemgroup);
}
예제 #8
0
/* set initial values for the next level */
static void planegame_next_level()
{
    RsvgHandle *svg_handle = NULL;
    GooCanvasItem *item;

    gc_bar_set_level(gcomprisBoard);

    planegame_destroy_all_items();

    rootitem = goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                     NULL);

    clouds_rootitem = goo_canvas_group_new (rootitem, NULL);

    /* Try the next level */
    speed=100+(40/(gcomprisBoard->level));
    fallSpeed=10000-gcomprisBoard->level*200;
    /* Make the images tend to 0.5 ratio */
    imageZoom=0.3+(0.5/(gcomprisBoard->level));

    /* Setup and Display the plane */
    planespeed_y = 0;
    planespeed_x = 0;
    svg_handle = gc_rsvg_load("planegame/tuxhelico.svgz");
    plane_x = 50;
    plane_y = 300;

    planeitem = goo_canvas_group_new (rootitem,
                                      NULL);

    goo_canvas_item_translate(planeitem, plane_x, plane_y);

    item = goo_canvas_svg_new (planeitem,
                               svg_handle,
                               NULL);

    goo_canvas_item_scale(item,
                          0.4 * imageZoom,
                          0.4 * imageZoom);

    g_object_unref(svg_handle);

    /* Game rules */
    plane_target = 1;
    plane_last_target = 10;

    gcomprisBoard->number_of_sublevel=plane_last_target;

    gcomprisBoard->sublevel=plane_target;

    if(gcomprisBoard->level>1)
    {
        /* No scoring after level 1 */
        gc_score_end();
    }
    else
    {
        gc_score_start(SCORESTYLE_NOTE,
                       BOARDWIDTH - 195,
                       BOARDHEIGHT - 30,
                       gcomprisBoard->number_of_sublevel);
        gc_score_set(gcomprisBoard->sublevel);
    }

}
예제 #9
0
/* set initial values for the next level */
static void money_next_level()
{
  guint		   min_price = 0, max_price = 0;
  guint		   paid = 0;
  guint		   number_of_item = 0;
  guint		   i;
  gchar		  *display_format;

  gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas),
		    "money/money-bg.png");

  gc_bar_set_level(gcomprisBoard);

  money_destroy_all_items();
  gamewon = FALSE;

  boardRootItem = goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
					NULL);


  /* The OK Button */
  GooCanvasItem *item = goo_canvas_svg_new( boardRootItem,
					    gc_skin_rsvg_get(),
					    "svg-id", "#OK",
					    NULL);
  SET_ITEM_LOCATION(item, 725, 230);
  g_signal_connect(item, "button_press_event",
		   (GtkSignalFunc) moneyactivity_process_ok, NULL);
  gc_item_focus_init(item, NULL);

  tux_money = MONEY_WIDGET(money_widget_new());
  money_widget_set_position(tux_money,
			    boardRootItem,
			    100.0, 380.0,
			    700.0, 490.0,
			    5, 2,
			    FALSE);

  /* Select level difficulty */
  switch(currentMode)
    {
    case WITHOUT_CENTS:
      switch(gcomprisBoard->level)
	{
	case 1:
	  number_of_item = 1;
	  min_price      = 3;
	  max_price      = 10;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 2:
	  number_of_item = 1;
	  min_price      = 10;
	  max_price      = 20;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 3:
	  number_of_item = 2;
	  min_price      = 20;
	  max_price      = 30;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 4:
	  number_of_item = 2;
	  min_price      = 30;
	  max_price      = 40;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 5:
	  number_of_item = 3;
	  min_price      = 40;
	  max_price      = 50;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 6:
	  number_of_item = 3;
	  min_price      = 50;
	  max_price      = 60;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 7:
	  number_of_item = 4;
	  min_price      = 60;
	  max_price      = 70;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 8:
	  number_of_item = 4;
	  min_price      = 70;
	  max_price      = 80;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 9:
	  number_of_item = 4;
	  min_price      = 50;
	  max_price      = 100;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  break;
	}
      break;
    case WITH_CENTS:
      switch(gcomprisBoard->level)
	{
	case 1:
	  number_of_item = 1;
	  min_price      = 1;
	  max_price      = 3;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 2:
	  number_of_item = 1;
	  min_price      = 1;
	  max_price      = 3;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 3:
	  number_of_item = 2;
	  min_price      = 1;
	  max_price      = 3;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 4:
	  number_of_item = 3;
	  min_price      = 1;
	  max_price      = 3;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 5:
	  number_of_item = 4;
	  min_price      = 0;
	  max_price      = 4;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	}
      break;
    case BACK_WITHOUT_CENTS:
      switch(gcomprisBoard->level)
	{
	case 1:
	  number_of_item = 1;
	  min_price      = 3;
	  max_price      = 9;
	  paid		 = 10;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 2:
	  number_of_item = 1;
	  min_price      = 1;
	  max_price      = 19;
	  paid		 = 20;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 3:
	  number_of_item = 2;
	  min_price      = 2;
	  max_price      = 29;
	  paid		 = 30;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 4:
	  number_of_item = 2;
	  min_price      = 2;
	  max_price      = 39;
	  paid		 = 40;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 5:
	  number_of_item = 3;
	  min_price      = 3;
	  max_price      = 49;
	  paid		 = 50;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 6:
	  number_of_item = 3;
	  min_price      = 3;
	  max_price      = 60;
	  paid		 = 100;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 7:
	  number_of_item = 4;
	  min_price      = 4;
	  max_price      = 70;
	  paid		 = 100;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 8:
	  number_of_item = 4;
	  min_price      = 4;
	  max_price      = 80;
	  paid		 = 100;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  break;
	case 9:
	  number_of_item = 4;
	  min_price      = 4;
	  max_price      = 99;
	  paid		 = 100;
	  money_widget_add(tux_money, MONEY_EURO_PAPER_10E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_50E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_20E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  money_widget_add(tux_money, MONEY_EURO_PAPER_5E);
	  break;
	}
      break;
    case BACK_WITH_CENTS:
      switch(gcomprisBoard->level)
	{
	case 1:
	  number_of_item = 1;
	  min_price      = 1;
	  max_price      = 3;
	  paid		 = 5;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 2:
	  number_of_item = 1;
	  min_price      = 1;
	  max_price      = 3;
	  paid		 = 5;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 3:
	  number_of_item = 2;
	  min_price      = 1;
	  max_price      = 3;
	  paid		 = 5;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 4:
	  number_of_item = 3;
	  min_price      = 1;
	  max_price      = 3;
	  paid		 = 5;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	case 5:
	  number_of_item = 4;
	  min_price      = 0;
	  max_price      = 4;
	  paid		 = 5;
	  money_widget_add(tux_money, MONEY_EURO_COIN_2E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1E);
	  money_widget_add(tux_money, MONEY_EURO_COIN_5C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_2C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_50C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_20C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_10C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  money_widget_add(tux_money, MONEY_EURO_COIN_1C);
	  break;
	}
      break;
    }

  seller_money = MONEY_WIDGET(money_widget_new());
  money_widget_set_position(seller_money,
			    boardRootItem,
			    100.0,  20.0,
			    700.0, 130.0,
			    5, 2,
			    FALSE);

  money_widget_set_target(seller_money, tux_money);
  money_widget_set_target(tux_money, seller_money);

  /* Display what to buy */
  price_target = 0;
  for(i=1; i<=number_of_item; i++)
  {
    gdouble object_price;
    gchar *text;
    GooCanvasItem *item;
    RsvgHandle *svg_handle;
    RsvgDimensionData dimension;
    double xratio, yratio;
    guint offset_x = 50;
    guint boardwidth = BOARDWIDTH - offset_x * 2;

    /* Display the price */
    object_price  = (double) g_random_int_range(min_price/number_of_item,
						max_price/number_of_item);

    {
      /* Select an image list depending on the price */
      gchar **imageList;
      guint number_of_images;
      if ( object_price < 5 )
	{
	  imageList = imageList1;
	  number_of_images = NUMBER_OF_IMAGES1;
	}
      else if ( object_price < 10 )
	{
	  imageList = imageList2;
	  number_of_images = NUMBER_OF_IMAGES2;
	}
      else
	{
	  imageList = imageList3;
	  number_of_images = NUMBER_OF_IMAGES3;
	}

      svg_handle =							\
	gc_rsvg_load(imageList[g_random_int_range(0, number_of_images - 1)]);

      rsvg_handle_get_dimensions(svg_handle, &dimension);

      item = goo_canvas_svg_new ( boardRootItem,
				  svg_handle,
				  NULL);
    }
    xratio =  (gdouble)(boardwidth/(number_of_item+1)) / dimension.width;
    yratio =  100.0 / dimension.height;

    xratio = yratio = MIN(xratio, yratio);
    goo_canvas_item_translate(item,
			      offset_x +
			      (i*boardwidth)/(number_of_item+1)
    			      - dimension.width*xratio/2,
    			      200);

    goo_canvas_item_scale(item, xratio, xratio);

    if( (currentMode == WITH_CENTS) ||
	(currentMode == BACK_WITH_CENTS) )
      {
	/* Set here the way to display money. Change only the money sign, and it's place, always keep %.2f, it will be replaced by 0,34 if decimal is ',' in your locale */
	display_format = _("$ %.2f");
	/* Add random cents */
	if(gcomprisBoard->level == 1)
	  {
	    object_price += (double)((double) g_random_int_range(1, 9))/10.0;
	  }
	else
	  {
	    object_price += (double)((double) g_random_int_range(1, 99))/100.0;
	  }
      }
    else
      {
	/* Set here the way to display money. Change only the money sign, and it's place, always keep %.2f, it will be replaced by 0,34 if decimal is ',' in your locale */
	display_format = _("$ %.0f");
      }

    price_target += object_price;
    text = g_strdup_printf(display_format, object_price);
    goo_canvas_text_new(boardRootItem,
			text,
			offset_x + (i*boardwidth)/(number_of_item+1),
			185,
			-1,
			GTK_ANCHOR_CENTER,
			"font", gc_skin_font_board_big,
			"fill-color", "white",
			NULL);
    g_free(text);
    g_object_unref(svg_handle);
  }

  if (paid)
    {
      // Calc the money back instead of the objects price
      price_target = paid - price_target;
      // Display Tux and his money
      display_paying_tux(paid);
    }
}
예제 #10
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);

    }

}