Back to index

gcompris  8.2.2
gameutil.h
Go to the documentation of this file.
00001 /* gcompris - gameutil.h
00002  *
00003  * Time-stamp: <2000/07/16 00:32:26 bruno>
00004  *
00005  * Copyright (C) 2000 Bruno Coudoin
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00026 #ifndef GAMEUTIL_H
00027 #define GAMEUTIL_H
00028 
00029 #include <gdk-pixbuf/gdk-pixbuf.h>
00030 #include <libgnomecanvas/gnome-canvas-pixbuf.h>
00031 
00032 #include "gcompris.h"
00033 #include "soundutil.h"
00034 
00035 // returns a random integer in range [A,B]
00036 #define RAND(A,B) (A + (int)((float)(B-A+1)*rand()/(RAND_MAX+1.0)))
00037 
00038 #ifndef MAX
00039 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
00040 #endif
00041 
00042 #ifndef MIN
00043 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
00044 #endif
00045 
00046 gchar         *g_utf8_strndup(gchar*,gint);
00047 gchar           *reactivate_newline(char *str);
00048 
00049 GdkPixbuf     *gc_pixmap_load(const gchar *filename, ...);
00050 void           gc_item_focus_set(GnomeCanvasItem *item, gboolean focus);
00051 void           gc_item_focus_free(GnomeCanvasItem *item, void *none);
00052 gint           gc_item_focus_event(GnomeCanvasItem *item, GdkEvent *event,
00053                                       GnomeCanvasItem *dest_item);
00054 
00055 gchar         *convertUTF8Toisolat1(gchar * text);
00056 void           gc_item_absolute_move(GnomeCanvasItem *item, int x, int y);
00057 void           gc_item_rotate(GnomeCanvasItem *item, double angle);
00058 void           gc_item_rotate_relative(GnomeCanvasItem *item, double angle);
00059 void           gc_item_rotate_with_center(GnomeCanvasItem *item, double angle, int x, int y);
00060 void           gc_item_rotate_relative_with_center(GnomeCanvasItem *item, double angle, int x, int y);
00061 
00062 GnomeCanvasGroup *gc_difficulty_display(GnomeCanvasGroup *parent, double x, double y,
00063                                               double ratio,
00064                                               int difficulty);
00065 
00066 /* find the complete filename looking for the file everywhere (printf formatting supported) */
00067 gchar          *gc_file_find_absolute(const gchar *filename, ...);
00068 int               gc_util_create_rootdir (gchar *rootdir);
00069 
00070 #endif