gcompris r3506 - in branches/gcomprixogoo/src: boards colors-activity crane-activity crane-activity/resources/crane gcompris superbrain-activity superbrain-activity/resources/superbrain
- From: bcoudoin svn gnome org
- To: svn-commits-list gnome org
- Subject: gcompris r3506 - in branches/gcomprixogoo/src: boards colors-activity crane-activity crane-activity/resources/crane gcompris superbrain-activity superbrain-activity/resources/superbrain
- Date: Sat, 23 Aug 2008 21:59:52 +0000 (UTC)
Author: bcoudoin
Date: Sat Aug 23 21:59:52 2008
New Revision: 3506
URL: http://svn.gnome.org/viewvc/gcompris?rev=3506&view=rev
Log:
fixed crane to work again
now menu set back the back to its original position so
that activities don't have to manage this.
Added:
branches/gcomprixogoo/src/crane-activity/resources/crane/crane-bg.svgz (contents, props changed)
Removed:
branches/gcomprixogoo/src/crane-activity/resources/crane/crane-bg.png
Modified:
branches/gcomprixogoo/src/boards/menu2.c
branches/gcomprixogoo/src/colors-activity/colors.c
branches/gcomprixogoo/src/crane-activity/crane.c
branches/gcomprixogoo/src/crane-activity/resources/crane/Makefile.am
branches/gcomprixogoo/src/gcompris/bar.c
branches/gcomprixogoo/src/gcompris/gcompris.h
branches/gcomprixogoo/src/superbrain-activity/resources/superbrain/Makefile.am
branches/gcomprixogoo/src/superbrain-activity/superbrain.c
Modified: branches/gcomprixogoo/src/boards/menu2.c
==============================================================================
--- branches/gcomprixogoo/src/boards/menu2.c (original)
+++ branches/gcomprixogoo/src/boards/menu2.c Sat Aug 23 21:59:52 2008
@@ -221,6 +221,10 @@
gc_bar_set(GC_BAR_CONFIG|GC_BAR_ABOUT);
gc_bar_set_level(gcomprisBoard);
+ /* Set back the bar to it's original location */
+ gc_bar_location (-1, -1, -1);
+
+
menuitems = g_new(MenuItems, 1);
img = gc_skin_image_get("gcompris-menu2bg.png");
Modified: branches/gcomprixogoo/src/colors-activity/colors.c
==============================================================================
--- branches/gcomprixogoo/src/colors-activity/colors.c (original)
+++ branches/gcomprixogoo/src/colors-activity/colors.c Sat Aug 23 21:59:52 2008
@@ -408,7 +408,8 @@
listColors = g_list_remove(listColors, g_list_nth_data(listColors,0));
- if( g_list_length(listColors) <= 0 ) { // the current board is finished : bail out
+ if( g_list_length(listColors) <= 0 )
+ { // the current board is finished : restart it
gc_bonus_end_display(GC_BOARD_FINISHED_TUXLOCO);
return;
}
Modified: branches/gcomprixogoo/src/crane-activity/crane.c
==============================================================================
--- branches/gcomprixogoo/src/crane-activity/crane.c (original)
+++ branches/gcomprixogoo/src/crane-activity/crane.c Sat Aug 23 21:59:52 2008
@@ -102,7 +102,6 @@
static GooCanvasItem *red_hands = NULL;
static GooCanvasItem *crane_rope_item = NULL;
static gint timer_id = 0;
-static gint nb_move = 0;
static gboolean moving = FALSE;
static move_object my_move;
static int list_answer[CRANE_FRAME_LINE * CRANE_FRAME_COLUMN];
@@ -199,7 +198,6 @@
{
if (agcomprisBoard != NULL) {
- gchar *img;
gcomprisBoard = agcomprisBoard;
gcomprisBoard->level = 1;
@@ -207,11 +205,10 @@
gcomprisBoard->sublevel = 1;
gcomprisBoard->number_of_sublevel = 1; /* Go to next level after this number of 'play' */
gc_bar_set(GC_BAR_LEVEL);
+ gc_bar_location (BOARDWIDTH-BARWIDTH/2, -1, 0.5);
- img = gc_skin_image_get("gcompris-bg.jpg");
gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas),
- img);
- g_free(img);
+ "crane/crane-bg.svgz");
/* disable im_context */
@@ -342,20 +339,11 @@
{
int i;
int nb_element;
- GdkPixbuf *pixmap;
boardRootItem = \
goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
NULL);
- pixmap = gc_pixmap_load("crane/crane-bg.png");
- goo_canvas_image_new (boardRootItem,
- pixmap,
- 0.0,
- 0.0,
- NULL);
- gdk_pixbuf_unref(pixmap);
-
// The four arrows on the crane
draw_arrow();
@@ -698,10 +686,13 @@
}
-static guint smooth_move(move_object *move) {
+static guint smooth_move(move_object *move)
+{
+ static gint nb_move = 0;
GooCanvasBounds bounds;
+ int speed = 4;
- if (nb_move == 0) {
+ if (nb_move <= 0) {
moving = TRUE;
nb_move = move->nb;
}
@@ -716,11 +707,13 @@
"points", crane_rope,
NULL);
- goo_canvas_item_translate(selected_item, move->x, move->y);
- goo_canvas_item_translate(red_hands, move->x, move->y);
- nb_move--;
+ goo_canvas_item_translate(selected_item,
+ move->x * speed, move->y * speed);
+ goo_canvas_item_translate(red_hands,
+ move->x * speed, move->y * speed);
+ nb_move -= speed;
- if (nb_move == 0) {
+ if (nb_move <= 0) {
moving = FALSE;
return FALSE;
}
Modified: branches/gcomprixogoo/src/crane-activity/resources/crane/Makefile.am
==============================================================================
--- branches/gcomprixogoo/src/crane-activity/resources/crane/Makefile.am (original)
+++ branches/gcomprixogoo/src/crane-activity/resources/crane/Makefile.am Sat Aug 23 21:59:52 2008
@@ -9,7 +9,7 @@
arrow_u.png \
arrow_up.png \
bulb.png \
- crane-bg.png \
+ crane-bg.svgz \
letter-a.png \
letter-b.png \
rectangle1.png \
Added: branches/gcomprixogoo/src/crane-activity/resources/crane/crane-bg.svgz
==============================================================================
Binary file. No diff available.
Modified: branches/gcomprixogoo/src/gcompris/bar.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/bar.c (original)
+++ branches/gcomprixogoo/src/gcompris/bar.c Sat Aug 23 21:59:52 2008
@@ -74,6 +74,10 @@
static gboolean _click_mode; /* Need to click on the bar to
bring it up or just enter it */
+/* Default position for the bar */
+static int _default_x;
+static int _default_y;
+static int _default_zoom;
static void confirm_quit(gboolean answer);
@@ -92,23 +96,26 @@
{
GcomprisProperties *properties = gc_prop_get();
GdkPixbuf *pixmap = NULL;
- gint16 width, height, startx;
+ gint16 width, height;
gint16 buttony;
double zoom;
- width = BOARDWIDTH/2;
+ width = BARWIDTH;
height = BARHEIGHT-2;
- startx = width / 2;
+
+ _default_x = width / 2;
+ _default_y = BOARDHEIGHT - BARHEIGHT;
+ _default_zoom = 1.0;
bar_reset_sound_id();
rootitem = goo_canvas_group_new (goo_canvas_get_root_item(theCanvas), NULL);
- goo_canvas_item_translate(rootitem, 0, BOARDHEIGHT - BARHEIGHT);
+ goo_canvas_item_translate(rootitem, _default_x, _default_y);
pixmap = gc_skin_pixmap_load("bar_bg.png");
bar_item = goo_canvas_image_new (rootitem,
pixmap,
- startx,
+ 0,
0,
NULL);
setup_item_signals(bar_item, "bar");
@@ -123,7 +130,7 @@
pixmap = gc_skin_pixmap_load("button_exit.png");
exit_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 0,
+ (width/NUMBER_OF_ITEMS) * 0,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -136,7 +143,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
home_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 4,
+ (width/NUMBER_OF_ITEMS) * 4,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -149,7 +156,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
level_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 3,
+ (width/NUMBER_OF_ITEMS) * 3,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -163,7 +170,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
repeat_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 0,
+ (width/NUMBER_OF_ITEMS) * 0,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -176,7 +183,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
help_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 1,
+ (width/NUMBER_OF_ITEMS) * 1,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -190,7 +197,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
config_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 2,
+ (width/NUMBER_OF_ITEMS) * 2,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -203,7 +210,7 @@
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
about_item = goo_canvas_image_new (rootitem,
pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 3,
+ (width/NUMBER_OF_ITEMS) * 3,
buttony,
NULL);
gdk_pixbuf_unref(pixmap);
@@ -293,6 +300,24 @@
NULL);
}
+/** Setting the bar location
+ * @param[in] x the bar x coordinate, -1 to set the default
+ * @param[in] y the bar x coordinate, -1 to set the default
+ * @param[in] zoom the bar zoom factor, -1 to set the default
+ */
+void
+gc_bar_location (int x, int y, double zoom)
+{
+ goo_canvas_item_set_transform(rootitem, NULL);
+ goo_canvas_item_translate(rootitem,
+ (x == -1 ? _default_x : x),
+ (y == -1 ? _default_y : y));
+ goo_canvas_item_scale(rootitem,
+ (zoom == -1 ? _default_zoom : zoom),
+ (zoom == -1 ? _default_zoom : zoom));
+
+}
+
/* Setting list of available icons in the control bar */
void
gc_bar_set (const GComprisBarFlags flags)
Modified: branches/gcomprixogoo/src/gcompris/gcompris.h
==============================================================================
--- branches/gcomprixogoo/src/gcompris/gcompris.h (original)
+++ branches/gcomprixogoo/src/gcompris/gcompris.h Sat Aug 23 21:59:52 2008
@@ -65,6 +65,7 @@
#define BOARDWIDTH 800
#define BOARDHEIGHT 520
#define BARHEIGHT 40
+#define BARWIDTH (BOARDWIDTH/2)
#define DEFAULT_SKIN "gartoon"
@@ -108,6 +109,7 @@
void gc_bar_set (const GComprisBarFlags flags);
void gc_bar_hide (gboolean hide);
+void gc_bar_location (int x, int y, double zoom);
/* General */
GooCanvas *gc_get_canvas(void);
Modified: branches/gcomprixogoo/src/superbrain-activity/resources/superbrain/Makefile.am
==============================================================================
--- branches/gcomprixogoo/src/superbrain-activity/resources/superbrain/Makefile.am (original)
+++ branches/gcomprixogoo/src/superbrain-activity/resources/superbrain/Makefile.am Sat Aug 23 21:59:52 2008
@@ -1,5 +1,5 @@
imgdir = $(pkgdatadir)/@PACKAGE_DATA_DIR@/superbrain
img_DATA = \
- superbrain_background.jpg
+ superbrain_background.svgz
EXTRA_DIST = $(img_DATA)
Modified: branches/gcomprixogoo/src/superbrain-activity/superbrain.c
==============================================================================
--- branches/gcomprixogoo/src/superbrain-activity/superbrain.c (original)
+++ branches/gcomprixogoo/src/superbrain-activity/superbrain.c Sat Aug 23 21:59:52 2008
@@ -165,6 +165,7 @@
gcomprisBoard->sublevel=1;
gcomprisBoard->number_of_sublevel=6; /* Go to next level after this number of 'play' */
gc_bar_set(GC_BAR_LEVEL);
+ gc_bar_location(30, -1, -1);
gc_set_background(goo_canvas_get_root_item(gcomprisBoard->canvas),
"superbrain/superbrain_background.svgz");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]