Commit 61936c28 authored by Bruno Coudoin's avatar Bruno Coudoin

many change added the name property and change name entity to title

added the timer api and implemented it in algebra board
parent 23d72011
2002-03-28 Thomas Gebhardt <gebhardt@HRZ.Uni-Marburg.DE>
2002-04-28 Bruno Coudoin <bruno.coudoin@free.fr>
* boards/scales/baord3_0.xml.in: changed because there was 2 solutions
* src/board/*.c: fixed compilation warnings where prototyte f() must be f(void)
* src/gcompris/timer.[ch]: creation of the timer api for gcompris
* boards/*.xml.in: added the name property and change name entity to title
* src/boards/algebra.c: implemented the use of the new timer api
* src/boards/clockgame.c: changed the cursor to ease the selection
2002-04-28 Thomas Gebhardt <gebhardt@HRZ.Uni-Marburg.DE>
* boards/scales/board3_0.xml.in: changed because there was 2 solutions
2002-04-04 Imre Ehreth
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebra_by"
type="algebra"
mode="*"
difficulty="3"
icon="boardicons/algebra_by.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Pratice the multiplication operation</_name>
<_title>Pratice the multiplication operation</_title>
<_description>I Ask you some algebra questions</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebra_div"
type="algebra"
mode="/|"
difficulty="3"
icon="boardicons/algebra_div.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Pratice the division operation</_name>
<_title>Pratice the division operation</_title>
<_description>I Ask you some algebra questions</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebra_guesscount"
type="algebra_guesscount"
difficulty="3"
icon="boardicons/algebra_guesscount.png"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="algebra_guesscount">
<_name>Find the correct operations to get the result</_name>
<_title>Find the correct operations to get the result</_title>
<_description>With displayed numbers and operations, find the right combination to get the right result</_description>
<_manual>Credits:
Animal pictures are taken from the Animal Photography Page of Ralf Schmode (http://schmode.net/)
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebra_minus"
type="algebra"
mode="-"
difficulty="2"
icon="boardicons/algebra_minus.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Pratice the substraction operation</_name>
<_title>Pratice the substraction operation</_title>
<_description>I Ask you some algebra questions</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebra_plus"
type="algebra"
mode="+"
difficulty="1"
icon="boardicons/algebra_plus.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Pratice the addition operation</_name>
<_title>Pratice the addition operation</_title>
<_description>I Ask you some algebra questions</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="algebramenu"
type="menu"
icon="boardicons/algebramenu.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Go to Algebra boards</_name>
<_title>Go to Algebra boards</_title>
<_description>Left-Click with the mouse to select a board</_description>
</Board>
<Data filename="algebra_plus.xml"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="babymatch"
type="shapegame"
icon="boardicons/babymatch.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="babymatch">
<_name>Matching Items</_name>
<_title>Matching Items</_title>
<_description>Drag and Drop the items to make them match</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="babyshapes"
type="shapegame"
icon="boardicons/babyshapes.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="babyshapes">
<_name>Baby Shape Puzzle</_name>
<_title>Baby Shape Puzzle</_title>
<_description>Drag and Drop the shapes on their respective target</_description>
<_prerequisite>Good mouse control</_prerequisite>
</Board>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="click_on_letter"
type="click_on_letter"
icon="boardicons/click_on_letter.png"
mandatory_sound_file="click_on_letter.ogg"
difficulty="1"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="click_on_letter">
<_name>Click on a letter</_name>
<_title>Click on a letter</_title>
<_description>Hear a letter and click on the right letter</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="clickgame"
type="clickgame"
icon="boardicons/clickgame.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="fishes">
<_name>Click On Me</_name>
<_title>Click On Me</_title>
<_description>Left-Click with the mouse on all swimming fishes before they leave the fishtank</_description>
<_prerequisite>Can move the mouse</_prerequisite>
<_goal>In this game, the children will discover the click on the computer mouse.
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="clockgame"
type="clockgame"
icon="boardicons/clockgame.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Learning Clock</_name>
<_title>Learning Clock</_title>
<_description>Learn how to read the time</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="colors"
type="colors"
mode="*"
difficulty="1"
......@@ -8,7 +9,7 @@
mandatory_sound_file="red.ogg"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="colors">
<_name>Colors</_name>
<_title>Colors</_title>
<_description>Click on the right color</_description>
<_prerequisite>Can move the mouse.</_prerequisite>
<_goal>This board is dedicated to train kids to recognize colors.
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="computer"
type="menu"
icon="boardicons/computer.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Discover the Computer</_name>
<_title>Discover the Computer</_title>
<_description>Left-Click with the mouse to select a board</_description>
</Board>
<Data filename="erase.xml"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="doubleentry"
type="shapegame"
icon="doubleentry/boardicon.png"
icon="boardicons/doubleentry.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
mode="background=doubleentry/gcompris-bg.png"
boarddir="doubleentry">
<_name>Double entry table</_name>
<_title>Double entry table</_title>
<_description>Drag and Drop the items in the double entry table</_description>
<_prerequisite>Basic counting skills</_prerequisite>
<_goal>The children must move the items on the left to their proper
destination in the double entry table.</_goal>
<_manual>Drag and Drop proposed items to their destination</_manual>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="draw"
type="draw"
icon="boardicons/draw.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="colornforms">
<_name>A simple vector drawing tool</_name>
<_title>A simple vector drawing tool</_title>
<_description>Creative board where you can freely draw</_description>
<_prerequisite>Needs to handle the mouse with the click easily</_prerequisite>
<_goal>In this game, the children will be able to freely draw.
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="erase"
type="erase"
icon="boardicons/erase.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Move the mouse</_name>
<_title>Move the mouse</_title>
<_description>Move the mouse to erase the area and discover the background</_description>
<_manual>Credits:
Animal pictures are taken from the Animal Photography Page of Ralf Schmode (http://schmode.net/)
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="fun"
type="menu"
icon="boardicons/fun.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Go to Amusement boards</_name>
<_title>Go to Amusement boards</_title>
<_description>Left-Click with the mouse to select a board</_description>
</Board>
<Data filename="paratrooper.xml"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="gletters"
type="gletters"
icon="boardicons/gletters.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Simple Letters</_name>
<_title>Simple Letters</_title>
<_description>Type the falling letters before they reach the ground</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="imageid"
type="imageid"
icon="boardicons/imageid.png"
difficulty="2"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="imageid">
<_name>Reading pratice</_name>
<_title>Reading pratice</_title>
<_description>Practice reading by finding the word matching an image</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="imagename"
type="shapegame"
icon="boardicons/imagename.png"
difficulty="3"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="imagename">
<_description>Drag and Drop the items above their written name</_description>
<_name>Image Name</_name>
<_title>Image Name</_title>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="leftright"
type="leftright"
difficulty="1"
icon="boardicons/leftright.png"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="leftright">
<_name>Find your left and right hands</_name>
<_title>Find your left and right hands</_title>
<_description>Given hands pictures, find if it's a right or left one</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="maze"
type="maze"
icon="boardicons/maze.png"
difficulty="3"
difficulty="2"
author="Bastiaan Verhoef (b.f.verhoef@student.utwente.nl)"
boarddir="maze">
<_name>Maze</_name>
<_title>Maze</_title>
<_description>Find your way out of the maze</_description>
<_prerequisite>Can use the keyboard arrow to move an object.</_prerequisite>
<_goal>Help Tux get out of this maze.</_goal>
<_manual>Use the keyboard arrows to move Tux up to the door.</_manual>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="memory"
type="memory"
mode="image"
difficulty="1"
icon="boardicons/memory.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Memory Game with images</_name>
<_title>Memory Game with images</_title>
<_description>Discover the cards and find a matching pair</_description>
</Board>
<Data directory=""/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="menu"
type="menu"
icon=""
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>GCompris Main Menu</_name>
<_title>GCompris Main Menu</_title>
<_description>Left-Click with the mouse to select a board</_description>
<_prerequisite>GCompris is an educational games that provides different activities to
children from 3 to 8 years old.</_prerequisite>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="missing_letter"
type="missing_letter"
icon="boardicons/missing_letter.png"
difficulty="2"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="missing_letter">
<_name>Missing Letter</_name>
<_title>Missing Letter</_title>
<_description>Fill up the missing letter</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="paintings"
type="shapegame"
icon="boardicons/shapegame.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="paintings">
<_name>Make the puzzle</_name>
<_title>Make the puzzle</_title>
<_description>Drag and Drop the items to rebuild the original paintings</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="paratrooper"
type="paratrooper"
icon="boardicons/tuxpara.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Paratrooper</_name>
<_title>Paratrooper</_title>
<_description>Manage the paratrooper to let him safely land</_description>
<_prerequisite>This board is game oriented. It doesnt needs specific skills to play with.</_prerequisite>
<_goal>In this game, the children will try to make Tux the paratrooper lands safely on the
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="planegame"
type="planegame"
icon="boardicons/helicogame.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Numbers in Order</_name>
<_title>Numbers in Order</_title>
<_description>Move the plane to catch the clouds in the correct order</_description>
</Board>
<Data directory=""/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="railroad"
type="railroad"
icon="boardicons/railroad.png"
difficulty="1"
author="Pascal Georges (pascal.georges1@free.fr)"
boarddir="railroad">
<_name>Railroad</_name>
<_title>Railroad</_title>
<_description>A memory game based on trains</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="reading"
type="menu"
icon="boardicons/book.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)">
<_name>Go to the Reading boards</_name>
<_title>Go to the Reading boards</_title>
<_description>Left-Click with the mouse to select a board</_description>
</Board>
<Data filename="imagename.xml"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="readingh"
type="reading"
mode="horizontal"
icon="boardicons/readingh.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="fishes">
<_name>Horizontal reading practice</_name>
<_title>Horizontal reading practice</_title>
<_description>Read a list of word and tell if the given word is in it</_description>
</Board>
<Data directory=""/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="readingv"
type="reading"
mode="vertical"
icon="boardicons/reading.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="fishes">
<_name>Vertical reading practice</_name>
<_title>Vertical reading practice</_title>
<_description>Read a vertical list of word and tell if the given word is in it</_description>
</Board>
<Data directory=""/>
......
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="scalesboard"
type="shapegame"
icon="boardicons/scalesicon.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="scales">
<_name>Well balance the scales</_name>
<_title>Well balance the scales</_title>
<_description>Drag and Drop masses to equilibrate the scales</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="smallnumbers"
type="smallnumbers"
icon="boardicons/smallnumbers.png"
difficulty="1"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Numbers With Dices</_name>
<_title>Numbers With Dices</_title>
<_description>Type the keyboard number 1 to 9 before the dice reaches the ground</_description>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="target"
type="target"
mode=""
difficulty="2"
icon="target/boardicon.png"
icon="boardicons/target.png"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="target">
<_name>Practice the addition with a target game</_name>
<_title>Practice the addition with a target game</_title>
<_description>Touch the target and count your points</_description>
<_prerequisite>Can move the mouse, can read numbers and count
up to 15 for the first level</_prerequisite>
<_goal>Send darts on a target and count your score.</_goal>
<_manual>First check the wind strengh and direction,
then click on the target to launch a dart,
when all your darts are sent, a window appear requiring you to count
your score. Enter the score with the keyboard then press
the enter key ok or the OK icon.</_manual>
</Board>
</GCompris>
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="wordsgame"
type="wordsgame"
icon="boardicons/wordsgame.png"
difficulty="2"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_name>Falling Words</_name>
<_title>Falling Words</_title>
<_description>Fully type the falling words before they reach the ground</_description>
</Board>
</GCompris>
This diff is collapsed.
/* gcompris - algebra.c
*
* Time-stamp: <2002/01/13 23:11:49 bruno>
* Time-stamp: <2002/04/17 00:25:30 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -35,6 +35,13 @@
#define SOUNDLISTFILE PACKAGE
gboolean board_paused = TRUE;
static int leavenow;
static int gamewon;
static void game_won(void);
static int maxtime;
static GList *item_list = NULL;
static GcomprisBoard *gcomprisBoard = NULL;
......@@ -63,27 +70,27 @@ static GnomeCanvasGroup *boardRootItem = NULL;
static char currentOperation = PLUSSIGNFILE;
static void start_board (GcomprisBoard *agcomprisBoard);
static void pause_board (gboolean pause);
static void end_board (void);
static gboolean is_our_board (GcomprisBoard *gcomprisBoard);
static void set_level (guint level);
gint key_press(guint keyval);
static void process_ok(void);
static GnomeCanvasItem *algebra_create_item(GnomeCanvasGroup *parent);
static void algebra_destroy_item(GnomeCanvasItem *item);
static void algebra_destroy_all_items(void);
static void display_operand(GnomeCanvasGroup *parent,
double x_align,
double y,
char *operand_str,
gboolean masked);
static void get_random_number(guint *first_operand, guint *second_operand);
static void algebra_next_level(void);
static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data);
static void set_focus_item(ToBeFoundItem *toBeFoundItem, gboolean status);
static void init_operation();
static void start_board (GcomprisBoard *agcomprisBoard);
static void pause_board (gboolean pause);
static void end_board (void);
static gboolean is_our_board (GcomprisBoard *gcomprisBoard);
static void set_level (guint level);
gint key_press(guint keyval);
static void process_ok(void);
static GnomeCanvasItem *algebra_create_item(GnomeCanvasGroup *parent);
static void algebra_destroy_item(GnomeCanvasItem *item);
static void algebra_destroy_all_items(void);
static void display_operand(GnomeCanvasGroup *parent,
double x_align,
double y,
char *operand_str,
gboolean masked);
static void get_random_number(guint *first_operand, guint *second_operand);
static void algebra_next_level(void);
static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data);
static void set_focus_item(ToBeFoundItem *toBeFoundItem, gboolean status);
static void init_operation(void);
/* Description of this plugin */
BoardPlugin menu_bp =
......@@ -126,10 +133,18 @@ BoardPlugin
*/
static void pause_board (gboolean pause)
{
if(gcomprisBoard==NULL)
return;
if(gamewon == TRUE && pause == FALSE) /* the game is won */
{
algebra_next_level();
}
if(leavenow == TRUE && pause == FALSE)
board_finished(BOARD_FINISHED_RANDOM);
board_paused = pause;
}
/*
......@@ -177,6 +192,8 @@ static void start_board (GcomprisBoard *agcomprisBoard)
init_operation();
algebra_next_level();
gamewon = FALSE;
leavenow = FALSE;
pause_board(FALSE);
}
......@@ -366,6 +383,15 @@ is_our_board (GcomprisBoard *gcomprisBoard)
/*-------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------*/
static void timer_end()
{
gamewon = FALSE;
leavenow = TRUE;
algebra_destroy_all_items();
gcompris_display_bonus(gamewon, BONUS_SMILEY);
}
/* set initial values for the next level */
static void algebra_next_level()
{
......@@ -382,6 +408,9 @@ static void algebra_next_level()
"y", (double) 0,
NULL));
maxtime = 10;
gcompris_timer_display(150, 140, GCOMPRIS_TIMER_BALLOON, maxtime, timer_end);
/* Try the next level */
algebra_create_item(boardRootItem);
......@@ -400,6 +429,8 @@ static void algebra_destroy_all_items()
GnomeCanvasItem *item;
gboolean stop = FALSE;
gcompris_timer_end();
while(g_list_length(item_list)>0)
{
item = g_list_nth_data(item_list, 0);
......@@ -574,9 +605,9 @@ static GnomeCanvasItem *algebra_create_item(GnomeCanvasGroup *parent)
if(vertical_layout)
/* Vertical layout : Warning x_align is the right assigned value for display_operand */
x_align = gcomprisBoard->width - (gcomprisBoard->width - (longuest*NUMBERSWIDTH))/2;
x_align = gcomprisBoard->width - (gcomprisBoard->width - (longuest*NUMBERSWIDTH))/2 + 150;
else
x_align = (gcomprisBoard->width - (longuest*3*NUMBERSWIDTH))/2 + NUMBERSWIDTH*(strlen(first_operand_str));