Commit 10ec7199 authored by Bruno Coudoin's avatar Bruno Coudoin

- Patch from Miguel that:

	  - fixes the digital display in clockgame.
	  - remove a momory leak in memory
parent 81fbfe99
2006-11-03 Bruno coudoin <bruno.coudoin@free.fr>
- Patch from Miguel that:
- fixes the digital display in clockgame.
- remove a momory leak in memory
* TODO:
* src/boards/clockgame.c: (start_board), (display_digital_time),
(display_hour), (display_minute), (display_second), (item_event),
(get_random_hour):
* src/boards/memory.c: (end_board), (create_item):
2006-11-02 Bruno Coudoin 2006-11-02 Bruno Coudoin
- new date system, untested. - new date system, untested.
......
...@@ -146,3 +146,4 @@ educational software that rivals many proprietary ones. ...@@ -146,3 +146,4 @@ educational software that rivals many proprietary ones.
If somebody want to work on the profile concept, we will be abble to If somebody want to work on the profile concept, we will be abble to
provide these features at least 6 monthes earlier than what I can do. provide these features at least 6 monthes earlier than what I can do.
- Replace Soudan by Sudan in boards/geography/board4_2.xml.in
\ No newline at end of file
...@@ -248,6 +248,12 @@ destroy_all_items() ...@@ -248,6 +248,12 @@ destroy_all_items()
static void display_digital_time(GnomeCanvasItem *item, GcomprisTime *time) static void display_digital_time(GnomeCanvasItem *item, GcomprisTime *time)
{ {
gchar *text = NULL; gchar *text = NULL;
int temps;
temps = (time->hour+12)*3600 + time->minute*60 + time->second;
time->hour = (temps / 3600) % 12;
time->minute = (temps / 60) % 60;
time->second = temps % 60;
if(item==NULL) if(item==NULL)
return; return;
...@@ -269,7 +275,6 @@ static void display_hour(guint hour) ...@@ -269,7 +275,6 @@ static void display_hour(guint hour)
double needle_size = clock_size*0.70; double needle_size = clock_size*0.70;
double ang; double ang;
GnomeCanvasPoints *canvasPoints; GnomeCanvasPoints *canvasPoints;
canvasPoints = gnome_canvas_points_new (2);
if(hour_item==NULL) if(hour_item==NULL)
return; return;
...@@ -279,6 +284,7 @@ static void display_hour(guint hour) ...@@ -279,6 +284,7 @@ static void display_hour(guint hour)
ang += currentTime.minute * M_PI / 360; ang += currentTime.minute * M_PI / 360;
ang += currentTime.second * M_PI / 21600; ang += currentTime.second * M_PI / 21600;
canvasPoints = gnome_canvas_points_new (2);
canvasPoints->coords[0]=cx; canvasPoints->coords[0]=cx;
canvasPoints->coords[1]=cy; canvasPoints->coords[1]=cy;
canvasPoints->coords[2]=cx + needle_size * sin(ang); canvasPoints->coords[2]=cx + needle_size * sin(ang);
...@@ -300,13 +306,11 @@ static void display_hour(guint hour) ...@@ -300,13 +306,11 @@ static void display_hour(guint hour)
display_digital_time(digital_time_item_s, &currentTime); display_digital_time(digital_time_item_s, &currentTime);
} }
static void display_minute(guint minute) static void display_minute(guint minute)
{ {
double needle_size = clock_size; double needle_size = clock_size;
double ang; double ang;
GnomeCanvasPoints *canvasPoints; GnomeCanvasPoints *canvasPoints;
canvasPoints = gnome_canvas_points_new (2);
if(minute_item==NULL) if(minute_item==NULL)
return; return;
...@@ -314,6 +318,7 @@ static void display_minute(guint minute) ...@@ -314,6 +318,7 @@ static void display_minute(guint minute)
ang = minute * M_PI / 30; ang = minute * M_PI / 30;
ang += currentTime.second * M_PI / 1800; ang += currentTime.second * M_PI / 1800;
canvasPoints = gnome_canvas_points_new (2);
canvasPoints->coords[0]=cx; canvasPoints->coords[0]=cx;
canvasPoints->coords[1]=cy; canvasPoints->coords[1]=cy;
canvasPoints->coords[2]=cx + needle_size * sin(ang); canvasPoints->coords[2]=cx + needle_size * sin(ang);
...@@ -332,6 +337,7 @@ static void display_minute(guint minute) ...@@ -332,6 +337,7 @@ static void display_minute(guint minute)
currentTime.minute=minute; currentTime.minute=minute;
display_digital_time(digital_time_item, &currentTime); display_digital_time(digital_time_item, &currentTime);
display_digital_time(digital_time_item_s, &currentTime);
} }
static void display_second(guint second) static void display_second(guint second)
...@@ -339,7 +345,6 @@ static void display_second(guint second) ...@@ -339,7 +345,6 @@ static void display_second(guint second)
double needle_size = clock_size; double needle_size = clock_size;
double ang; double ang;
GnomeCanvasPoints *canvasPoints; GnomeCanvasPoints *canvasPoints;
canvasPoints = gnome_canvas_points_new (2);
/* No seconds at first levels */ /* No seconds at first levels */
if(second_item==NULL || gcomprisBoard->level<=2) if(second_item==NULL || gcomprisBoard->level<=2)
...@@ -347,6 +352,7 @@ static void display_second(guint second) ...@@ -347,6 +352,7 @@ static void display_second(guint second)
ang = second * M_PI / 30; ang = second * M_PI / 30;
canvasPoints = gnome_canvas_points_new (2);
canvasPoints->coords[0]=cx; canvasPoints->coords[0]=cx;
canvasPoints->coords[1]=cy; canvasPoints->coords[1]=cy;
canvasPoints->coords[2]=cx + needle_size * sin(ang); canvasPoints->coords[2]=cx + needle_size * sin(ang);
...@@ -365,6 +371,7 @@ static void display_second(guint second) ...@@ -365,6 +371,7 @@ static void display_second(guint second)
currentTime.second=second; currentTime.second=second;
display_digital_time(digital_time_item, &currentTime); display_digital_time(digital_time_item, &currentTime);
display_digital_time(digital_time_item_s, &currentTime);
} }
......
...@@ -910,6 +910,11 @@ end_board () ...@@ -910,6 +910,11 @@ end_board ()
tux_memory = NULL; tux_memory = NULL;
} }
} }
g_free(op_add);
g_free(op_minus);
g_free(op_mult);
g_free(op_div);
gcomprisBoard = NULL; gcomprisBoard = NULL;
} }
...@@ -1222,6 +1227,7 @@ static void create_item(GnomeCanvasGroup *parent) ...@@ -1222,6 +1227,7 @@ static void create_item(GnomeCanvasGroup *parent)
"x", (double) 50, "x", (double) 50,
"y", (double) 20, "y", (double) 20,
NULL); NULL);
gdk_pixbuf_unref(pixmap_tux);
tux_score_s = gnome_canvas_item_new (GNOME_CANVAS_GROUP(parent), tux_score_s = gnome_canvas_item_new (GNOME_CANVAS_GROUP(parent),
gnome_canvas_text_get_type (), gnome_canvas_text_get_type (),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment