Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/boards/animtest.c
blob: d93c39666b888a0c0bfd448dc07cec9c9abfb44b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* gcompris - animtest.c
 *
 * Copyright (C) 2005 Joe Neeman
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#include "gcompris/gcompris.h"

#define CENTER_LEFT_X 185
#define CENTER_LEFT_Y 430

static GcomprisBoard *board;
static gboolean paused = TRUE;

static void start_board(GcomprisBoard*);
static void end_board();
static gboolean is_our_board(GcomprisBoard*);

/*=============================================*/
static GcomprisAnimation *animation;
static GnomeCanvasItem *anim_item;

static BoardPlugin menu_bp =
  {
    NULL,
    NULL,
    "Blah",
    "Blah",
    "Me",
    NULL,
    NULL,
    NULL,
    NULL,
    start_board,
    NULL,
    end_board,
    is_our_board,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL
  };

BoardPlugin *get_bplugin_info()
{
    return &menu_bp;
}

static void start_board(GcomprisBoard *b)
{
  if(b != NULL)
    {
      board = b;
      gc_set_background(gnome_canvas_root(board->canvas), "leftright/leftright-bg.jpg");
      board->level = 1;
      board->maxlevel=1;
      board->sublevel=1;
      board->number_of_sublevel=1;
      gc_score_start(SCORESTYLE_NOTE, 10, 50, board->number_of_sublevel);
      gc_bar_set(GC_BAR_LEVEL);
      gc_bar_set_level(board);
      gc_score_set(board->sublevel);

      animation = gc_anim_load( "animtest/test.txt" );
      anim_item = (GnomeCanvasItem*)
                  gc_anim_activate( gnome_canvas_root(board->canvas),
                                               animation );
      gnome_canvas_item_set(anim_item,
            "x", (double) CENTER_LEFT_X,
            "y", (double) CENTER_LEFT_Y,
            "anchor", GTK_ANCHOR_CENTER,
            "width", (double)128,
            "height", (double)128,
            "width_set", TRUE,
            "height_set", TRUE,
            NULL);
    }
}

static void end_board()
{
  if(board != NULL)
    {
      gc_anim_deactivate(anim_item);
      gc_anim_free(animation);
    }
}

static gboolean is_our_board(GcomprisBoard *b)
{
  if(b)
    {
      if(g_strcasecmp(b->type, "animtest") == 0)
        {
          b->plugin = &menu_bp;
          return TRUE;
        }
    }
  return FALSE;
}