Update french translation for "Options are saved when quitting".
[gliv.git] / src / gliv-image.c
blob754619a869a90eb558d0a5978e9557bae372927f
1 /* Generated by GOB (v2.0.6) on Thu Jan 8 22:51:44 2004
2 (do not edit directly) */
4 /* End world hunger, donate to the World Food Programme, http://www.wfp.org */
6 #define GOB_VERSION_MAJOR 2
7 #define GOB_VERSION_MINOR 0
8 #define GOB_VERSION_PATCHLEVEL 6
10 #define selfp (self->_priv)
12 #include "gliv-image.h"
14 #ifdef G_LIKELY
15 #define ___GOB_LIKELY(expr) G_LIKELY(expr)
16 #define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
17 #else /* ! G_LIKELY */
18 #define ___GOB_LIKELY(expr) (expr)
19 #define ___GOB_UNLIKELY(expr) (expr)
20 #endif /* G_LIKELY */
22 #line 1 "../tools/gliv-image.gob"
24 #include <stdio.h>
26 #include "gliv.h"
27 #include "gl_widget.h"
28 #include "opengl.h"
30 static int nb_images = 0;
33 #line 34 "gliv-image.c"
35 #line 12 "../tools/gliv-image.gob"
37 #include "texture_map.h"
39 #line 40 "gliv-image.c"
40 /* self casting macros */
41 #define SELF(x) GLIV_IMAGE(x)
42 #define SELF_CONST(x) GLIV_IMAGE_CONST(x)
43 #define IS_SELF(x) GLIV_IS_IMAGE(x)
44 #define TYPE_SELF GLIV_TYPE_IMAGE
45 #define SELF_CLASS(x) GLIV_IMAGE_CLASS(x)
47 #define SELF_GET_CLASS(x) GLIV_IMAGE_GET_CLASS(x)
49 /* self typedefs */
50 typedef GlivImage Self;
51 typedef GlivImageClass SelfClass;
53 /* here are local prototypes */
54 static void gliv_image_init (GlivImage * o) G_GNUC_UNUSED;
55 static void gliv_image_class_init (GlivImageClass * c) G_GNUC_UNUSED;
56 static void ___2_gliv_image_finalize (GObject * self) G_GNUC_UNUSED;
58 /* pointer to the class of our parent */
59 static GObjectClass *parent_class = NULL;
61 /* Short form macros */
62 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
63 #define self_new() gliv_image_new()
64 #endif /* __GNUC__ && !__STRICT_ANSI__ */
66 /* Short form pointers */
67 static GlivImage * (* const self_new) (void) = gliv_image_new;
69 GType
70 gliv_image_get_type (void)
72 static GType type = 0;
74 if ___GOB_UNLIKELY(type == 0) {
75 static const GTypeInfo info = {
76 sizeof (GlivImageClass),
77 (GBaseInitFunc) NULL,
78 (GBaseFinalizeFunc) NULL,
79 (GClassInitFunc) gliv_image_class_init,
80 (GClassFinalizeFunc) NULL,
81 NULL /* class_data */,
82 sizeof (GlivImage),
83 0 /* n_preallocs */,
84 (GInstanceInitFunc) gliv_image_init,
87 type = g_type_register_static (G_TYPE_OBJECT, "GlivImage", &info, (GTypeFlags)0);
90 return type;
93 /* a macro for creating a new object of our type */
94 #define GET_NEW ((GlivImage *)g_object_new(gliv_image_get_type(), NULL))
96 /* a function for creating a new object of our type */
97 #include <stdarg.h>
98 static GlivImage * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
99 static GlivImage *
100 GET_NEW_VARG (const char *first, ...)
102 GlivImage *ret;
103 va_list ap;
104 va_start (ap, first);
105 ret = (GlivImage *)g_object_new_valist (gliv_image_get_type (), first, ap);
106 va_end (ap);
107 return ret;
110 static void
111 gliv_image_init (GlivImage * o)
113 #define __GOB_FUNCTION__ "Gliv:Image::init"
114 return;
115 o = NULL;
117 #undef __GOB_FUNCTION__
118 static void
119 gliv_image_class_init (GlivImageClass * c)
121 #define __GOB_FUNCTION__ "Gliv:Image::class_init"
122 GObjectClass *g_object_class = (GObjectClass *)c;
124 parent_class = g_type_class_ref (G_TYPE_OBJECT);
126 #line 35 "../tools/gliv-image.gob"
127 g_object_class->finalize = ___2_gliv_image_finalize;
128 #line 129 "gliv-image.c"
129 return;
130 c = NULL;
132 #undef __GOB_FUNCTION__
136 #line 26 "../tools/gliv-image.gob"
137 GlivImage *
138 gliv_image_new (void)
139 #line 140 "gliv-image.c"
141 #define __GOB_FUNCTION__ "Gliv:Image::new"
143 #line 27 "../tools/gliv-image.gob"
145 nb_images++;
146 if (nb_images > 4)
147 printf("There are more than 4 images: %d images\n", nb_images);
149 return GET_NEW;
151 #line 152 "gliv-image.c"
152 #undef __GOB_FUNCTION__
154 #line 35 "../tools/gliv-image.gob"
155 static void
156 ___2_gliv_image_finalize (GObject * self)
157 #line 158 "gliv-image.c"
158 #define PARENT_HANDLER(___self) \
159 { if(G_OBJECT_CLASS(parent_class)->finalize) \
160 (* G_OBJECT_CLASS(parent_class)->finalize)(___self); }
162 #define __GOB_FUNCTION__ "Gliv:Image::finalize"
164 #line 36 "../tools/gliv-image.gob"
166 gint level;
167 texture_map *map;
168 GlivImage *im = GLIV_IMAGE(self);
170 for (level = 0; level < im->nb_maps; level++) {
171 map = im->maps + level;
173 glDeleteTextures(map->nb_tiles, map->tex_ids);
174 g_free(map->tex_ids);
176 glDeleteLists(map->list, map->nb_tiles);
177 g_free(map->tiles);
180 g_free(im->maps);
181 g_free(im->ident);
183 PARENT_HANDLER(self);
184 nb_images--;
186 #line 187 "gliv-image.c"
187 #undef __GOB_FUNCTION__
188 #undef PARENT_HANDLER
191 #if (!defined __GNUC__) || (defined __GNUC__ && defined __STRICT_ANSI__)
192 /*REALLY BAD HACK
193 This is to avoid unused warnings if you don't call
194 some method. I need to find a better way to do
195 this, not needed in GCC since we use some gcc
196 extentions to make saner, faster code */
197 static void
198 ___gliv_image_really_bad_hack_to_avoid_warnings(void)
200 ((void (*)(void))GET_NEW_VARG)();
201 ((void (*)(void))self_new)();
202 ___gliv_image_really_bad_hack_to_avoid_warnings();
204 #endif /* !__GNUC__ || (__GNUC__ && __STRICT_ANSI__) */