2 * upkg: tool for manipulating Unreal Tournament packages.
3 * Copyright © 2009-2011 Nick Bowler
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <glib-object.h>
23 #include <uobject/uobject.h>
24 #include <uobject/exportable.h>
28 #define TEXTURE_GET_PRIV(o) \
29 G_TYPE_INSTANCE_GET_PRIVATE(o, ENGINE_TEXTURE_TYPE, struct texture_priv)
47 unsigned char buf[2048];
51 void exportable_init(UObjectExportable *e)
55 G_DEFINE_DYNAMIC_TYPE(EngineTexture, engine_texture, U_OBJECT_TYPE);
57 static int deserialize(UObject *uo)
59 struct texture_priv *priv = TEXTURE_GET_PRIV(uo);
60 EngineTexture *t = ENGINE_TEXTURE(uo);
62 U_OBJECT_CLASS(engine_texture_parent_class)->deserialize(uo);
67 void texture_register(GTypeModule *m)
69 engine_texture_register_type(m);
73 set_property(GObject *o, guint id, const GValue *val, GParamSpec *spec)
75 EngineTexture *t = ENGINE_TEXTURE(o);
79 t->usize = g_value_get_uint(val);
82 t->vsize = g_value_get_uint(val);
85 t->uclamp = g_value_get_uint(val);
88 t->vclamp = g_value_get_uint(val);
91 t->ubits = g_value_get_uint(val);
94 t->vbits = g_value_get_uint(val);
97 G_OBJECT_WARN_INVALID_PROPERTY_ID(o, id, spec);
102 get_property(GObject *o, guint id, GValue *val, GParamSpec *spec)
104 EngineTexture *t = ENGINE_TEXTURE(o);
108 g_value_set_uint(val, t->usize);
111 g_value_set_uint(val, t->vsize);
114 g_value_set_uint(val, t->uclamp);
117 g_value_set_uint(val, t->vclamp);
120 g_value_set_uint(val, t->ubits);
123 g_value_set_uint(val, t->vbits);
126 G_OBJECT_WARN_INVALID_PROPERTY_ID(o, id, spec);
130 static void engine_texture_init(EngineTexture *t)
132 t->usize = t->vsize = 0;
135 static void engine_texture_class_init(EngineTextureClass *class)
137 UObjectClass *uo = U_OBJECT_CLASS(class);
138 GObjectClass *go = G_OBJECT_CLASS(class);
140 g_type_class_add_private(class, sizeof (struct texture_priv));
142 uo->deserialize = deserialize;
143 go->set_property = set_property;
144 go->get_property = get_property;
146 g_object_class_install_property(go, PROP_USIZE,
147 g_param_spec_uint("USize",
149 "Width of the texture.",
152 g_object_class_install_property(go, PROP_VSIZE,
153 g_param_spec_uint("VSize",
155 "Height of the texture.",
158 g_object_class_install_property(go, PROP_UCLAMP,
159 g_param_spec_uint("UClamp",
164 g_object_class_install_property(go, PROP_VCLAMP,
165 g_param_spec_uint("VClamp",
170 g_object_class_install_property(go, PROP_UBITS,
171 g_param_spec_uint("UBits",
176 g_object_class_install_property(go, PROP_VBITS,
177 g_param_spec_uint("VBits",
184 static void engine_texture_class_finalize(EngineTextureClass *class)