Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/gcompris/gameutil.h
blob: ecfc5c7957af89265d9f98dc906a75fc1ec1adae (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
/* gcompris - gameutil.h
 *
 * Time-stamp: <2000/07/16 00:32:26 bruno>
 *
 * Copyright (C) 2000 Bruno Coudoin
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*! \file gameutil.h
  \brief Function usefull to board developpers
*/

#ifndef GAMEUTIL_H
#define GAMEUTIL_H

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnomecanvas/gnome-canvas-pixbuf.h>

#include "gcompris.h"
#include "soundutil.h"

// returns a random integer in range [A,B]
#define RAND(A,B) (A + (int)((float)(B-A+1)*rand()/(RAND_MAX+1.0)))

#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif

gchar 		*g_utf8_strndup(gchar*,gint);
gchar           *reactivate_newline(char *str);

GdkPixbuf	*gc_pixmap_load(const gchar *filename, ...);
void		 gc_item_focus_set(GnomeCanvasItem *item, gboolean focus);
void		 gc_item_focus_free(GnomeCanvasItem *item, void *none);
gint		 gc_item_focus_event(GnomeCanvasItem *item, GdkEvent *event,
					   GnomeCanvasItem *dest_item);

gchar		*convertUTF8Toisolat1(gchar * text);
void		 gc_item_absolute_move(GnomeCanvasItem *item, int x, int y);
void		 gc_item_rotate(GnomeCanvasItem *item, double angle);
void		 gc_item_rotate_relative(GnomeCanvasItem *item, double angle);
void		 gc_item_rotate_with_center(GnomeCanvasItem *item, double angle, int x, int y);
void		 gc_item_rotate_relative_with_center(GnomeCanvasItem *item, double angle, int x, int y);

GnomeCanvasGroup *gc_difficulty_display(GnomeCanvasGroup *parent, double x, double y,
						    double ratio,
						    int difficulty);

/* find the complete filename looking for the file everywhere (printf formatting supported) */
gchar		 *gc_file_find_absolute(const gchar *filename, ...);
int               gc_util_create_rootdir (gchar *rootdir);

#endif