From 633c8da35c671fd49bbbcbf10418347339845991 Mon Sep 17 00:00:00 2001 From: Bruno Coudoin Date: Wed, 08 Oct 2003 22:49:57 +0000 Subject: boards/Makefile.am: added watercycle boards/gcompris/animals/flamentrosegc.jpg: animal image given by LE BERRE Daniel : released under GPL boards/gcompris/animals/girafegc.jpg: same as flamentrosegc.jpg boards/gcompris/animals/readme.txt: update with new images boards/gcompris/animals/rhinogc.jpg: same as flamentrosegc.jpg boards/gcompris/animals/singegc.jpg: same as flamentrosegc.jpg po/POTFILES.in: added watercycle src/boards/erase.c: added new animal images src/boards/hanoi.c: (hanoi_create_item): fixed alpha chanel setting (when using the aa canvas) src/boards/py-mod-skin.c: (py_gcompris_load_skin_pixmap): fixed parameter passing src/boards/py-mod-utils.c: (py_gcompris_load_pixmap): fixed parameter passing src/boards/python/Makefile.am: added watercycle src/boards/python/watercycle.py: created src/boards/reading.c: (player_win): re-indented src/boards/reversecount.c: added new animal images src/gcompris/bonus.c: (board_finished): re-indented --- diff --git a/ChangeLog b/ChangeLog index cb4597e..c6c10c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-10-09 Bruno coudoin + + * boards/Makefile.am: added watercycle + * boards/gcompris/animals/flamentrosegc.jpg: animal image given by + * LE BERRE Daniel : released under GPL + * boards/gcompris/animals/girafegc.jpg: same as flamentrosegc.jpg + * boards/gcompris/animals/readme.txt: update with new images + * boards/gcompris/animals/rhinogc.jpg: same as flamentrosegc.jpg + * boards/gcompris/animals/singegc.jpg: same as flamentrosegc.jpg + * po/POTFILES.in: added watercycle + * src/boards/erase.c: added new animal images + * src/boards/hanoi.c: (hanoi_create_item): fixed alpha chanel setting (when using the aa canvas) + * src/boards/py-mod-skin.c: (py_gcompris_load_skin_pixmap): fixed parameter passing + * src/boards/py-mod-utils.c: (py_gcompris_load_pixmap): fixed parameter passing + * src/boards/python/Makefile.am: added watercycle + * src/boards/python/watercycle.py: created + * src/boards/reading.c: (player_win): re-indented + * src/boards/reversecount.c: added new animal images + * src/gcompris/bonus.c: (board_finished): re-indented + 2003-10-07 Bruno coudoin * configure.in: Release 4.0PRE3 diff --git a/boards/Makefile.am b/boards/Makefile.am index 7c25b36..c7f2c5d 100644 --- a/boards/Makefile.am +++ b/boards/Makefile.am @@ -60,7 +60,8 @@ xml_in_files = \ leftright.xml.in \ colors.xml.in \ colors_group.xml.in \ - pythontest.xml.in + pythontest.xml.in \ + watercycle.xml.in xml_DATA = $(xml_in_files:.xml.in=.xml) diff --git a/boards/gcompris/animals/flamentrosegc.jpg b/boards/gcompris/animals/flamentrosegc.jpg new file mode 100644 index 0000000..825add8 --- /dev/null +++ b/boards/gcompris/animals/flamentrosegc.jpg Binary files differ diff --git a/boards/gcompris/animals/girafegc.jpg b/boards/gcompris/animals/girafegc.jpg new file mode 100644 index 0000000..0edefac --- /dev/null +++ b/boards/gcompris/animals/girafegc.jpg Binary files differ diff --git a/boards/gcompris/animals/readme.txt b/boards/gcompris/animals/readme.txt index a3b9bea..d67031c 100644 --- a/boards/gcompris/animals/readme.txt +++ b/boards/gcompris/animals/readme.txt @@ -1,2 +1,9 @@ Use of animal pictures is granted by Ralf Schmode (rschmode@gmx.net) WWW: http://schmode.net + +Images following are released under GPL by LE BERRE Daniel + flamentrosegc.jpg + girafegc.jpg + rhinogc.jpg + singegc.jpg + diff --git a/boards/gcompris/animals/rhinogc.jpg b/boards/gcompris/animals/rhinogc.jpg new file mode 100644 index 0000000..dd84b38 --- /dev/null +++ b/boards/gcompris/animals/rhinogc.jpg Binary files differ diff --git a/boards/gcompris/animals/singegc.jpg b/boards/gcompris/animals/singegc.jpg new file mode 100644 index 0000000..43ea20f --- /dev/null +++ b/boards/gcompris/animals/singegc.jpg Binary files differ diff --git a/po/POTFILES.in b/po/POTFILES.in index ebf4b19..8c558f7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -119,6 +119,7 @@ boards/superbrain.xml.in boards/target.xml.in boards/traffic.xml.in boards/wordsgame.xml.in +boards/watercycle.xml.in gcompris-edit.desktop.in gcompris.desktop.in src/boards/advanced_colors.c diff --git a/src/boards/erase.c b/src/boards/erase.c index 271afa9..0137365 100644 --- a/src/boards/erase.c +++ b/src/boards/erase.c @@ -50,16 +50,13 @@ static int number_of_item_y = 0; // List of images to use in the game static gchar *imageList[] = { - "gcompris/animals/bear001.jpg", - "gcompris/animals/malaybear002.jpg", - "gcompris/animals/polabear011.jpg", - "gcompris/animals/spectbear001.jpg", - "gcompris/animals/joybear001.jpg", - "gcompris/animals/polarbear001.jpg", + "gcompris/animals/flamentrosegc.jpg", + "gcompris/animals/girafegc.jpg", + "gcompris/animals/rhinogc.jpg", + "gcompris/animals/singegc.jpg", "gcompris/animals/joybear002.jpg", - "gcompris/animals/poolbears001.jpg" }; -#define NUMBER_OF_IMAGES 8 +#define NUMBER_OF_IMAGES 5 /* Description of this plugin */ BoardPlugin menu_bp = diff --git a/src/boards/hanoi.c b/src/boards/hanoi.c index 82ceeac..eae6415 100644 --- a/src/boards/hanoi.c +++ b/src/boards/hanoi.c @@ -77,21 +77,21 @@ static gint limit_column_x2[MAX_NUMBER_X]; static guint colorlist [] = { - 0x00FFFF00, - 0xA0000000, - 0xF0000000, - 0x00A00000, - 0x00F00000, - 0x0000AA00, - 0x0000FF00, - 0x50500000, - 0xA0A00000, - 0xF0F00000, - 0x00505000, - 0x00A0A000, - 0x50005000, - 0xA000A000, - 0xF000F000 + 0x00FFFFFF, + 0xA00000FF, + 0xF00000FF, + 0x00A000FF, + 0x00F000FF, + 0x0000AAFF, + 0x0000FFFF, + 0x505000FF, + 0xA0A000FF, + 0xF0F000FF, + 0x005050FF, + 0x00A0A0FF, + 0x500050FF, + 0xA000A0FF, + 0xF000F0FF }; #define NUMBER_OF_COLOR 14 @@ -445,7 +445,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) "y1", (double) baseline - item_height * number_of_item_y - gap_y - 50, "x2", (double) item_width * (i+1) - gap_x/2, "y2", (double) baseline + 50, - "fill_color_rgba", 0x036ED800, + "fill_color_rgba", 0x036ED8FF, "outline_color", "black", "width_units", (double)1, NULL); @@ -459,7 +459,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) "y1", (double) baseline - item_height * number_of_item_y - gap_y - 50, "x2", (double) item_width * (i+1) - gap_x/2, "y2", (double) baseline + 50, - "fill_color_rgba", 0x48AAF100, + "fill_color_rgba", 0x48AAF1FF, "outline_color", "black", "width_units", (double)1, NULL); @@ -473,7 +473,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) "y1", (double) baseline - item_height * number_of_item_y - gap_y, "x2", (double) item_width * i + item_width/2 + w, "y2", (double) baseline, - "fill_color_rgba", 0xFF103000, + "fill_color_rgba", 0xFF1030FF, "outline_color", "black", "width_units", (double)1, NULL); @@ -491,7 +491,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) item = gnome_canvas_item_new (boardRootItem, GNOME_TYPE_CANVAS_SHAPE, - "fill_color_rgba", 0x20FF3000, + "fill_color_rgba", 0x20FF30FF, "outline_color", "black", NULL); gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (item), path); diff --git a/src/boards/py-mod-skin.c b/src/boards/py-mod-skin.c index 5119995..72c886f 100644 --- a/src/boards/py-mod-skin.c +++ b/src/boards/py-mod-skin.c @@ -35,7 +35,7 @@ py_gcompris_load_skin_pixmap(PyObject* self, PyObject* args) char* pixmapfile; GdkPixbuf* result; /* Parse arguments */ - if(!PyArg_ParseTuple(args, "s:gcompris_load_skin_pixmap", pixmapfile)) + if(!PyArg_ParseTuple(args, "s:gcompris_load_skin_pixmap", &pixmapfile)) return NULL; /* Call the corresponding C function */ diff --git a/src/boards/py-mod-utils.c b/src/boards/py-mod-utils.c index cc217df..ab6c593 100644 --- a/src/boards/py-mod-utils.c +++ b/src/boards/py-mod-utils.c @@ -35,7 +35,8 @@ py_gcompris_load_pixmap(PyObject* self, PyObject* args) char* pixmapfile; GdkPixbuf* result; /* Parse arguments */ - if(!PyArg_ParseTuple(args, ":gcompris_load_pixmap")) + + if(!PyArg_ParseTuple(args, "s:gcompris_load_pixmap", &pixmapfile)) return NULL; /* Call the corresponding C function */ diff --git a/src/boards/python/Makefile.am b/src/boards/python/Makefile.am index 9ea9c38..d87591c 100644 --- a/src/boards/python/Makefile.am +++ b/src/boards/python/Makefile.am @@ -3,6 +3,7 @@ SUBDIRS=gcompris pythondir = $(plugindir)/python dist_python_DATA= \ - pythontest.py + pythontest.py \ + watercycle.py diff --git a/src/boards/python/watercycle.py b/src/boards/python/watercycle.py new file mode 100644 index 0000000..afdcf92 --- /dev/null +++ b/src/boards/python/watercycle.py @@ -0,0 +1,221 @@ +# PythonTest Board module +import gnome +import gnome.canvas +import gcompris +import gcompris.utils +import gcompris.skin +import gtk +import gtk.gdk + +class Gcompris_watercycle: + """The Cycle Water activity""" + + + def __init__(self, gcomprisBoard): + self.gcomprisBoard = gcomprisBoard + self.canvasitems = {} + + print("Gcompris_watercycle __init__.") + + + def start(self): + self.gcomprisBoard.level=1 + self.gcomprisBoard.maxlevel=1 + self.gcomprisBoard.sublevel=1 + self.gcomprisBoard.number_of_sublevel=1 + + # The basic tick for object moves + self.timerinc = 50 + + # Need to manage the timers to quit properly + self.boat_timer = 0 + self.sun_timer = 0 + self.vapor_timer = 0 + self.cloud_timer = 0 + + gcompris.bar_set(0) + gcompris.set_background(self.gcomprisBoard.canvas.root(), + "watercycle/background.png") + gcompris.bar_set_level(self.gcomprisBoard) + + # The Sun + self.canvasitems[1] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasPixbuf, + pixbuf = gcompris.utils.load_pixmap("watercycle/sun.png"), + x=10.0, + y=70.0 + ) + self.canvasitems[1].connect("event", self.sun_item_event) + self.sun_direction = -1 + self.sun_on = 0 + + # The sun mask object + self.canvasitems[2] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasRect, + x1=10.0, + y1=89.0, + x2=90.0, + y2=155.0, + fill_color_rgba=0x0099FFFF, + width_units=0.0 + ) + + # The tuxboat + self.canvasitems[3] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasPixbuf, + pixbuf = gcompris.utils.load_pixmap("gcompris/misc/tuxboat.png"), + x=10.0, + y=470.0 + ) + + # The rain + self.canvasitems[5] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasPixbuf, + pixbuf = gcompris.utils.load_pixmap("watercycle/rain.png"), + x=40.0, + y=40.0 + ) + self.canvasitems[5].hide() + self.rain_on = 0 + + # The cloud + self.canvasitems[4] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasPixbuf, + pixbuf = gcompris.utils.load_pixmap("gcompris/misc/cloud.png"), + x=10.0, + y=10.0 + ) + self.canvasitems[4].hide() + self.canvasitems[4].connect("event", self.cloud_item_event) + self.cloud_on = 0 + + # The vapor + self.canvasitems[6] = self.gcomprisBoard.canvas.root().add( + gnome.canvas.CanvasPixbuf, + pixbuf = gcompris.utils.load_pixmap("watercycle/vapor.png"), + x=35.0, + y=150.0 + ) + self.canvasitems[6].hide() + + # Ready GO + self.move_boat() + + print("Gcompris_watercycle start.") + + + def end(self): + # Remove all the timer first + if self.boat_timer : + gtk.timeout_remove(self.boat_timer) + if self.sun_timer : + gtk.timeout_remove(self.sun_timer) + if self.vapor_timer : + gtk.timeout_remove(self.vapor_timer) + if self.cloud_timer : + gtk.timeout_remove(self.cloud_timer) + + # Remove the canvas item we added during this plugin + for item in self.canvasitems.values(): + item.destroy() + print("Gcompris_watercycle end.") + + + def ok(self): + print("Gcompris_watercycle ok.") + + + def repeat(self): + print("Gcompris_watercycle repeat.") + + + def config(self): + print("Gcompris_watercycle config.") + + def key_press(self, keyval): + return + + def move_boat(self): + self.canvasitems[3].move(1, 0) + if( self.canvasitems[3].get_bounds()[2] < 790 ) : + self.boat_timer = gtk.timeout_add(self.timerinc, self.move_boat) + + def move_cloud(self): + if(self.cloud_on): + self.canvasitems[4].show() + else: + self.canvasitems[4].hide() + + if(self.rain_on): + self.canvasitems[5].show() + else: + self.canvasitems[5].hide() + + self.canvasitems[4].move(1, 0); + self.canvasitems[5].move(1, 0); + if( self.canvasitems[4].get_bounds()[0] > 800 ) : + self.canvasitems[4].move(-800, 0); + self.canvasitems[5].move(-800, 0); + self.cloud_on = 0 + self.show_rain = 0 + self.canvasitems[4].hide() + self.canvasitems[5].hide() + else: + self.cloud_timer = gtk.timeout_add(self.timerinc, self.move_cloud) + + def move_vapor(self): + if(self.vapor_on): + self.canvasitems[6].show() + else: + self.canvasitems[6].hide() + + self.canvasitems[6].move(0, -1); + if( self.canvasitems[6].get_bounds()[1] < 20 ) : + self.canvasitems[6].move(0, +100); + self.vapor_timer = gtk.timeout_add(self.timerinc, self.move_vapor) + + def move_sun(self): + self.canvasitems[1].move(0, self.sun_direction); + if( (self.canvasitems[1].get_bounds()[1] > 0 and + self.canvasitems[1].get_bounds()[1] < 70 ) ) : + self.sun_timer = gtk.timeout_add(self.timerinc, self.move_sun) + else : + if(self.sun_direction < 0) : + # Stop the sun + self.sun_timer = gtk.timeout_add(15000, self.move_sun) + # Start the vapor + self.vapor_timer = gtk.timeout_add(5000 , self.move_vapor) + self.vapor_on = 1 + # Start the cloud + if(not self.cloud_on): + self.cloud_timer = gtk.timeout_add(10000, self.move_cloud) + self.cloud_on = 1 + + else : + self.vapor_on = 0 + self.sun_on = 0 + + self.sun_direction = self.sun_direction * -1 + + def pause(self, pause): + print("Gcompris_watercycle pause. %i" % pause) + + def set_level(self, level): + print("Gcompris_watercycle set level. %i" % level) + + def sun_item_event(self, widget, event=None): + if event.type == gtk.gdk.BUTTON_PRESS: + if event.button == 1: + if not self.sun_on : + self.sun_timer = gtk.timeout_add(self.timerinc, self.move_sun) + self.sun_on = 1 + return gtk.TRUE + return gtk.FALSE + + def cloud_item_event(self, widget, event=None): + if event.type == gtk.gdk.BUTTON_PRESS: + if event.button == 1: + self.rain_on = 1 + return gtk.TRUE + return gtk.FALSE + diff --git a/src/boards/reading.c b/src/boards/reading.c index b38f926..a6daa06 100644 --- a/src/boards/reading.c +++ b/src/boards/reading.c @@ -1,6 +1,6 @@ /* gcompris - reading.c * - * Time-stamp: <2003/08/21 16:08:55 bcoudoin> + * Time-stamp: <2003/10/08 17:50:58 bcoudoin> * * Copyright (C) 2000 Bruno Coudoin * @@ -598,8 +598,8 @@ static void ask_yes_no() static void player_win() { gcompris_play_ogg ("bonus", NULL); - gamewon = TRUE; - wait_for_ready = TRUE; + gamewon = TRUE; + wait_for_ready = TRUE; gcompris_display_bonus(gamewon, BONUS_FLOWER); /* Try the next level */ gcomprisBoard->level++; diff --git a/src/boards/reversecount.c b/src/boards/reversecount.c index 0226f79..57066a5 100644 --- a/src/boards/reversecount.c +++ b/src/boards/reversecount.c @@ -91,8 +91,12 @@ static gchar *imageList[] = "gcompris/animals/joybear001.jpg", "gcompris/animals/polarbear001.jpg", "gcompris/animals/joybear002.jpg", + "gcompris/animals/flamentrosegc.jpg", + "gcompris/animals/girafegc.jpg", + "gcompris/animals/rhinogc.jpg", + "gcompris/animals/singegc.jpg", }; -#define NUMBER_OF_IMAGES 6 +#define NUMBER_OF_IMAGES 10 // List of fish to use in the game static gchar *fishList[] = diff --git a/src/gcompris/bonus.c b/src/gcompris/bonus.c index 7dcae3d..a18b98b 100644 --- a/src/gcompris/bonus.c +++ b/src/gcompris/bonus.c @@ -90,9 +90,9 @@ void board_finished(int type) { char * str = NULL; if (board_finished_running) - return; - else - board_finished_running = TRUE; + return; + else + board_finished_running = TRUE; /* First pause the board */ if(gcomprisBoard->plugin->pause_board != NULL) -- cgit v0.9.1