- Set LIBS instead of LDFLAGS (LIBS are appended while LDFLAGS are prepended
[gliv.git] / src / gliv-image.c
blob859b9e557f1870aac71ccf81ac519f64c7e236b2
1 /* Generated by GOB (v2.0.17) (do not edit directly) */
3 /* End world hunger, donate to the World Food Programme, http://www.wfp.org */
5 #define GOB_VERSION_MAJOR 2
6 #define GOB_VERSION_MINOR 0
7 #define GOB_VERSION_PATCHLEVEL 17
9 #define selfp (self->_priv)
11 #include <string.h> /* memset() */
13 #include "gliv-image.h"
15 #ifdef G_LIKELY
16 #define ___GOB_LIKELY(expr) G_LIKELY(expr)
17 #define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
18 #else /* ! G_LIKELY */
19 #define ___GOB_LIKELY(expr) (expr)
20 #define ___GOB_UNLIKELY(expr) (expr)
21 #endif /* G_LIKELY */
23 #line 1 "../tools/gliv-image.gob"
25 #include "gliv.h"
26 #include "opengl.h"
27 #include "options.h"
29 extern options_struct *options;
31 static int nb_images = 0;
34 #line 35 "gliv-image.c"
36 #line 12 "../tools/gliv-image.gob"
38 #include "texture_map.h"
40 #line 41 "gliv-image.c"
41 /* self casting macros */
42 #define SELF(x) GLIV_IMAGE(x)
43 #define SELF_CONST(x) GLIV_IMAGE_CONST(x)
44 #define IS_SELF(x) GLIV_IS_IMAGE(x)
45 #define TYPE_SELF GLIV_TYPE_IMAGE
46 #define SELF_CLASS(x) GLIV_IMAGE_CLASS(x)
48 #define SELF_GET_CLASS(x) GLIV_IMAGE_GET_CLASS(x)
50 /* self typedefs */
51 typedef GlivImage Self;
52 typedef GlivImageClass SelfClass;
54 /* here are local prototypes */
55 #line 0 "../tools/gliv-image.gob"
56 static void gliv_image_init (GlivImage * o) G_GNUC_UNUSED;
57 #line 58 "gliv-image.c"
58 #line 0 "../tools/gliv-image.gob"
59 static void gliv_image_class_init (GlivImageClass * c) G_GNUC_UNUSED;
60 #line 61 "gliv-image.c"
61 #line 44 "../tools/gliv-image.gob"
62 static void ___2_gliv_image_finalize (GObject * self) G_GNUC_UNUSED;
63 #line 64 "gliv-image.c"
65 /* pointer to the class of our parent */
66 static GObjectClass *parent_class = NULL;
68 /* Short form macros */
69 #define self_new gliv_image_new
70 GType
71 gliv_image_get_type (void)
73 static GType type = 0;
75 if ___GOB_UNLIKELY(type == 0) {
76 static const GTypeInfo info = {
77 sizeof (GlivImageClass),
78 (GBaseInitFunc) NULL,
79 (GBaseFinalizeFunc) NULL,
80 (GClassInitFunc) gliv_image_class_init,
81 (GClassFinalizeFunc) NULL,
82 NULL /* class_data */,
83 sizeof (GlivImage),
84 0 /* n_preallocs */,
85 (GInstanceInitFunc) gliv_image_init,
86 NULL
89 type = g_type_register_static (G_TYPE_OBJECT, "GlivImage", &info, (GTypeFlags)0);
92 return type;
95 /* a macro for creating a new object of our type */
96 #define GET_NEW ((GlivImage *)g_object_new(gliv_image_get_type(), NULL))
98 /* a function for creating a new object of our type */
99 #include <stdarg.h>
100 static GlivImage * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
101 static GlivImage *
102 GET_NEW_VARG (const char *first, ...)
104 GlivImage *ret;
105 va_list ap;
106 va_start (ap, first);
107 ret = (GlivImage *)g_object_new_valist (gliv_image_get_type (), first, ap);
108 va_end (ap);
109 return ret;
112 static void
113 gliv_image_init (GlivImage * o G_GNUC_UNUSED)
115 #define __GOB_FUNCTION__ "Gliv:Image::init"
117 #undef __GOB_FUNCTION__
118 static void
119 gliv_image_class_init (GlivImageClass * c G_GNUC_UNUSED)
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 44 "../tools/gliv-image.gob"
127 g_object_class->finalize = ___2_gliv_image_finalize;
128 #line 129 "gliv-image.c"
130 #undef __GOB_FUNCTION__
134 #line 29 "../tools/gliv-image.gob"
135 GlivImage *
136 gliv_image_new (void)
138 #line 139 "gliv-image.c"
139 #define __GOB_FUNCTION__ "Gliv:Image::new"
141 #line 30 "../tools/gliv-image.gob"
143 /* This is used to detect bugs */
144 nb_images++;
145 if (nb_images > 4)
146 g_printerr("There are more than 4 images: %d images\n", nb_images);
148 else if (options->one_image && nb_images > 2)
149 /* We can have two images : the displayed one and the just loaded */
150 g_printerr("There are more than 2 images: %d images\n", nb_images);
153 return GET_NEW;
155 #line 156 "gliv-image.c"
156 #undef __GOB_FUNCTION__
158 #line 44 "../tools/gliv-image.gob"
159 static void
160 ___2_gliv_image_finalize (GObject * self G_GNUC_UNUSED)
161 #line 162 "gliv-image.c"
162 #define PARENT_HANDLER(___self) \
163 { if(G_OBJECT_CLASS(parent_class)->finalize) \
164 (* G_OBJECT_CLASS(parent_class)->finalize)(___self); }
166 #define __GOB_FUNCTION__ "Gliv:Image::finalize"
168 #line 45 "../tools/gliv-image.gob"
170 gint level;
171 texture_map *map;
172 GlivImage *im = GLIV_IMAGE(self);
174 for (level = 0; level < im->nb_maps; level++) {
175 map = im->maps + level;
177 glDeleteTextures(map->nb_tiles, map->tex_ids);
178 g_free(map->tex_ids);
180 glDeleteLists(map->list, map->nb_tiles);
181 g_free(map->tiles);
184 g_free(im->maps);
185 g_free(im->ident);
187 PARENT_HANDLER(self);
188 nb_images--;
190 #line 191 "gliv-image.c"
191 #undef __GOB_FUNCTION__
192 #undef PARENT_HANDLER