ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.238 by root, Sat Nov 3 12:08:43 2007 UTC vs.
Revision 1.246 by root, Fri Dec 28 15:06:02 2007 UTC

120 120
121#include "pango-font.c" 121#include "pango-font.c"
122#include "pango-fontmap.c" 122#include "pango-fontmap.c"
123#include "pango-render.c" 123#include "pango-render.c"
124 124
125typedef IV CFPlus__Channel; 125typedef IV DC__Channel;
126typedef SDL_RWops *CFPlus__RW; 126typedef SDL_RWops *DC__RW;
127typedef Mix_Chunk *CFPlus__MixChunk; 127typedef Mix_Chunk *DC__MixChunk;
128typedef Mix_Music *CFPlus__MixMusic; 128typedef Mix_Music *DC__MixMusic;
129 129
130typedef PangoFontDescription *CFPlus__Font; 130typedef PangoFontDescription *DC__Font;
131 131
132static int 132static int
133shape_attr_p (PangoLayoutRun *run) 133shape_attr_p (PangoLayoutRun *run)
134{ 134{
135 GSList *attrs = run->item->analysis.extra_attrs; 135 GSList *attrs = run->item->analysis.extra_attrs;
149 149
150typedef struct cf_layout { 150typedef struct cf_layout {
151 PangoLayout *pl; 151 PangoLayout *pl;
152 float r, g, b, a; // default color for rgba mode 152 float r, g, b, a; // default color for rgba mode
153 int base_height; 153 int base_height;
154 CFPlus__Font font; 154 DC__Font font;
155 rc_t *rc; 155 rc_t *rc;
156} *CFPlus__Layout; 156} *DC__Layout;
157 157
158static CFPlus__Font default_font; 158static DC__Font default_font;
159static PangoContext *opengl_context; 159static PangoContext *opengl_context;
160static PangoFontMap *opengl_fontmap; 160static PangoFontMap *opengl_fontmap;
161 161
162static void 162static void
163substitute_func (FcPattern *pattern, gpointer data) 163substitute_func (FcPattern *pattern, gpointer data)
168#endif 168#endif
169 FcPatternAddBool (pattern, FC_AUTOHINT, 0); 169 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
170} 170}
171 171
172static void 172static void
173layout_update_font (CFPlus__Layout self) 173layout_update_font (DC__Layout self)
174{ 174{
175 /* use a random scale factor to account for unknown descenders, 0.8 works 175 /* use a random scale factor to account for unknown descenders, 0.8 works
176 * reasonably well with bitstream vera 176 * reasonably well with bitstream vera
177 */ 177 */
178 PangoFontDescription *font = self->font ? self->font : default_font; 178 PangoFontDescription *font = self->font ? self->font : default_font;
182 182
183 pango_layout_set_font_description (self->pl, font); 183 pango_layout_set_font_description (self->pl, font);
184} 184}
185 185
186static void 186static void
187layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) 187layout_get_pixel_size (DC__Layout self, int *w, int *h)
188{ 188{
189 PangoRectangle rect; 189 PangoRectangle rect;
190 190
191 // get_pixel_* wrongly rounds down 191 // get_pixel_* wrongly rounds down
192 pango_layout_get_extents (self->pl, 0, &rect); 192 pango_layout_get_extents (self->pl, 0, &rect);
231 int faces; tileid *face2tile; // [faceid] 231 int faces; tileid *face2tile; // [faceid]
232 int texs; maptex *tex; // [tileid] 232 int texs; maptex *tex; // [tileid]
233 233
234 int32_t rows; 234 int32_t rows;
235 maprow *row; 235 maprow *row;
236} *CFPlus__Map; 236} *DC__Map;
237 237
238static char * 238static char *
239prepend (char *ptr, int sze, int inc) 239prepend (char *ptr, int sze, int inc)
240{ 240{
241 char *p; 241 char *p;
279 self->texs *= 2; 279 self->texs *= 2;
280 } 280 }
281} 281}
282 282
283static maprow * 283static maprow *
284map_get_row (CFPlus__Map self, int y) 284map_get_row (DC__Map self, int y)
285{ 285{
286 if (0 > y) 286 if (0 > y)
287 { 287 {
288 int extend = - y + MAP_EXTEND_Y; 288 int extend = - y + MAP_EXTEND_Y;
289 Prepend (maprow, self->row, self->rows, extend); 289 Prepend (maprow, self->row, self->rows, extend);
327 327
328 return row->col + (x - row->c0); 328 return row->col + (x - row->c0);
329} 329}
330 330
331static mapcell * 331static mapcell *
332map_get_cell (CFPlus__Map self, int x, int y) 332map_get_cell (DC__Map self, int x, int y)
333{ 333{
334 return row_get_cell (map_get_row (self, y), x); 334 return row_get_cell (map_get_row (self, y), x);
335} 335}
336 336
337static void 337static void
338map_clear (CFPlus__Map self) 338map_clear (DC__Map self)
339{ 339{
340 int r; 340 int r;
341 341
342 for (r = 0; r < self->rows; r++) 342 for (r = 0; r < self->rows; r++)
343 Safefree (self->row[r].col); 343 Safefree (self->row[r].col);
351 self->row = 0; 351 self->row = 0;
352 self->rows = 0; 352 self->rows = 0;
353} 353}
354 354
355static void 355static void
356map_blank (CFPlus__Map self, int x0, int y0, int w, int h) 356map_blank (DC__Map self, int x0, int y0, int w, int h)
357{ 357{
358 int x, y; 358 int x, y;
359 maprow *row; 359 maprow *row;
360 mapcell *cell; 360 mapcell *cell;
361 361
498 return 0; 498 return 0;
499 499
500 return 1; 500 return 1;
501} 501}
502 502
503MODULE = CFPlus PACKAGE = CFPlus 503MODULE = Deliantra::Client PACKAGE = DC
504 504
505PROTOTYPES: ENABLE 505PROTOTYPES: ENABLE
506 506
507BOOT: 507BOOT:
508{ 508{
509 HV *stash = gv_stashpv ("CFPlus", 1); 509 HV *stash = gv_stashpv ("DC", 1);
510 static const struct { 510 static const struct {
511 const char *name; 511 const char *name;
512 IV iv; 512 IV iv;
513 } *civ, const_iv[] = { 513 } *civ, const_iv[] = {
514# define const_iv(name) { # name, (IV)name } 514# define const_iv(name) { # name, (IV)name }
700 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); 700 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL);
701 701
702 if (m && m != (SDL_Rect **)-1) 702 if (m && m != (SDL_Rect **)-1)
703 while (*m) 703 while (*m)
704 { 704 {
705 if ((*m)->w >= 800 && (*m)->h >= 600) 705 if ((*m)->w >= 800 && (*m)->h >= 480)
706 { 706 {
707 AV *av = newAV (); 707 AV *av = newAV ();
708 av_push (av, newSViv ((*m)->w)); 708 av_push (av, newSViv ((*m)->w));
709 av_push (av, newSViv ((*m)->h)); 709 av_push (av, newSViv ((*m)->h));
710 av_push (av, newSViv (rgb)); 710 av_push (av, newSViv (rgb));
825 hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); 825 hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0);
826 hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); 826 hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0);
827 break; 827 break;
828 } 828 }
829 829
830 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); 830 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1))));
831 } 831 }
832} 832}
833 833
834int 834int
835Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) 835Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096)
993void 993void
994error (char *message) 994error (char *message)
995 CODE: 995 CODE:
996 fprintf (stderr, "ERROR: %s\n", message); 996 fprintf (stderr, "ERROR: %s\n", message);
997#ifdef _WIN32 997#ifdef _WIN32
998 MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR); 998 MessageBox (0, message, "Deliantra Client Error", MB_OK | MB_ICONERROR);
999#endif 999#endif
1000 1000
1001void 1001void
1002fatal (char *message) 1002fatal (char *message)
1003 CODE: 1003 CODE:
1004 fprintf (stderr, "FATAL: %s\n", message); 1004 fprintf (stderr, "FATAL: %s\n", message);
1005#ifdef _WIN32 1005#ifdef _WIN32
1006 MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); 1006 MessageBox (0, message, "Deliantra Client Fatal Error", MB_OK | MB_ICONERROR);
1007#endif 1007#endif
1008 _exit (1); 1008 _exit (1);
1009 1009
1010void 1010void
1011_exit (int retval = 0) 1011_exit (int retval = 0)
1023#if DEBUG 1023#if DEBUG
1024 VALGRIND_DO_LEAK_CHECK; 1024 VALGRIND_DO_LEAK_CHECK;
1025#endif 1025#endif
1026} 1026}
1027 1027
1028MODULE = CFPlus PACKAGE = CFPlus::Font 1028MODULE = Deliantra::Client PACKAGE = DC::Font
1029 1029
1030PROTOTYPES: DISABLE 1030PROTOTYPES: DISABLE
1031 1031
1032CFPlus::Font 1032DC::Font
1033new_from_file (SV *class, char *path, int id = 0) 1033new_from_file (SV *class, char *path, int id = 0)
1034 CODE: 1034 CODE:
1035{ 1035{
1036 int count; 1036 int count;
1037 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); 1037 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count);
1040} 1040}
1041 OUTPUT: 1041 OUTPUT:
1042 RETVAL 1042 RETVAL
1043 1043
1044void 1044void
1045DESTROY (CFPlus::Font self) 1045DESTROY (DC::Font self)
1046 CODE: 1046 CODE:
1047 pango_font_description_free (self); 1047 pango_font_description_free (self);
1048 1048
1049void 1049void
1050make_default (CFPlus::Font self) 1050make_default (DC::Font self)
1051 PROTOTYPE: $ 1051 PROTOTYPE: $
1052 CODE: 1052 CODE:
1053 default_font = self; 1053 default_font = self;
1054 1054
1055MODULE = CFPlus PACKAGE = CFPlus::Layout 1055MODULE = Deliantra::Client PACKAGE = DC::Layout
1056 1056
1057PROTOTYPES: DISABLE 1057PROTOTYPES: DISABLE
1058 1058
1059void 1059void
1060reset_glyph_cache () 1060glyph_cache_backup ()
1061 PROTOTYPE: 1061 PROTOTYPE:
1062 CODE: 1062 CODE:
1063 tc_backup ();
1064
1065void
1066glyph_cache_restore ()
1067 PROTOTYPE:
1068 CODE:
1063 tc_clear (); 1069 tc_restore ();
1064 1070
1065CFPlus::Layout 1071DC::Layout
1066new (SV *class) 1072new (SV *class)
1067 CODE: 1073 CODE:
1068 New (0, RETVAL, 1, struct cf_layout); 1074 New (0, RETVAL, 1, struct cf_layout);
1069 1075
1070 RETVAL->pl = pango_layout_new (opengl_context); 1076 RETVAL->pl = pango_layout_new (opengl_context);
1080 layout_update_font (RETVAL); 1086 layout_update_font (RETVAL);
1081 OUTPUT: 1087 OUTPUT:
1082 RETVAL 1088 RETVAL
1083 1089
1084void 1090void
1085DESTROY (CFPlus::Layout self) 1091DESTROY (DC::Layout self)
1086 CODE: 1092 CODE:
1087 g_object_unref (self->pl); 1093 g_object_unref (self->pl);
1088 rc_free (self->rc); 1094 rc_free (self->rc);
1089 Safefree (self); 1095 Safefree (self);
1090 1096
1091void 1097void
1092set_text (CFPlus::Layout self, SV *text_) 1098set_text (DC::Layout self, SV *text_)
1093 CODE: 1099 CODE:
1094{ 1100{
1095 STRLEN textlen; 1101 STRLEN textlen;
1096 char *text = SvPVutf8 (text_, textlen); 1102 char *text = SvPVutf8 (text_, textlen);
1097 1103
1098 pango_layout_set_text (self->pl, text, textlen); 1104 pango_layout_set_text (self->pl, text, textlen);
1099} 1105}
1100 1106
1101void 1107void
1102set_markup (CFPlus::Layout self, SV *text_) 1108set_markup (DC::Layout self, SV *text_)
1103 CODE: 1109 CODE:
1104{ 1110{
1105 STRLEN textlen; 1111 STRLEN textlen;
1106 char *text = SvPVutf8 (text_, textlen); 1112 char *text = SvPVutf8 (text_, textlen);
1107 1113
1108 pango_layout_set_markup (self->pl, text, textlen); 1114 pango_layout_set_markup (self->pl, text, textlen);
1109} 1115}
1110 1116
1111void 1117void
1112set_shapes (CFPlus::Layout self, ...) 1118set_shapes (DC::Layout self, ...)
1113 CODE: 1119 CODE:
1114{ 1120{
1115 PangoAttrList *attrs = 0; 1121 PangoAttrList *attrs = 0;
1116 const char *text = pango_layout_get_text (self->pl); 1122 const char *text = pango_layout_get_text (self->pl);
1117 const char *pos = text; 1123 const char *pos = text;
1152 if (attrs) 1158 if (attrs)
1153 pango_layout_set_attributes (self->pl, attrs); 1159 pango_layout_set_attributes (self->pl, attrs);
1154} 1160}
1155 1161
1156void 1162void
1157get_shapes (CFPlus::Layout self) 1163get_shapes (DC::Layout self)
1158 PPCODE: 1164 PPCODE:
1159{ 1165{
1160 PangoLayoutIter *iter = pango_layout_get_iter (self->pl); 1166 PangoLayoutIter *iter = pango_layout_get_iter (self->pl);
1161 1167
1162 do 1168 do
1177 1183
1178 pango_layout_iter_free (iter); 1184 pango_layout_iter_free (iter);
1179} 1185}
1180 1186
1181int 1187int
1182has_wrapped (CFPlus::Layout self) 1188has_wrapped (DC::Layout self)
1183 CODE: 1189 CODE:
1184{ 1190{
1185 int lines = 1; 1191 int lines = 1;
1186 const char *text = pango_layout_get_text (self->pl); 1192 const char *text = pango_layout_get_text (self->pl);
1187 1193
1192} 1198}
1193 OUTPUT: 1199 OUTPUT:
1194 RETVAL 1200 RETVAL
1195 1201
1196SV * 1202SV *
1197get_text (CFPlus::Layout self) 1203get_text (DC::Layout self)
1198 CODE: 1204 CODE:
1199 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); 1205 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0);
1200 sv_utf8_decode (RETVAL); 1206 sv_utf8_decode (RETVAL);
1201 OUTPUT: 1207 OUTPUT:
1202 RETVAL 1208 RETVAL
1203 1209
1204void 1210void
1205set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) 1211set_foreground (DC::Layout self, float r, float g, float b, float a = 1.)
1206 CODE: 1212 CODE:
1207 self->r = r; 1213 self->r = r;
1208 self->g = g; 1214 self->g = g;
1209 self->b = b; 1215 self->b = b;
1210 self->a = a; 1216 self->a = a;
1211 1217
1212void 1218void
1213set_font (CFPlus::Layout self, CFPlus::Font font = 0) 1219set_font (DC::Layout self, DC::Font font = 0)
1214 CODE: 1220 CODE:
1215 if (self->font != font) 1221 if (self->font != font)
1216 { 1222 {
1217 self->font = font; 1223 self->font = font;
1218 layout_update_font (self); 1224 layout_update_font (self);
1219 } 1225 }
1220 1226
1221void 1227void
1222set_height (CFPlus::Layout self, int base_height) 1228set_height (DC::Layout self, int base_height)
1223 CODE: 1229 CODE:
1224 if (self->base_height != base_height) 1230 if (self->base_height != base_height)
1225 { 1231 {
1226 self->base_height = base_height; 1232 self->base_height = base_height;
1227 layout_update_font (self); 1233 layout_update_font (self);
1228 } 1234 }
1229 1235
1230void 1236void
1231set_width (CFPlus::Layout self, int max_width = -1) 1237set_width (DC::Layout self, int max_width = -1)
1232 CODE: 1238 CODE:
1233 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); 1239 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE);
1234 1240
1235void 1241void
1236set_indent (CFPlus::Layout self, int indent) 1242set_indent (DC::Layout self, int indent)
1237 CODE: 1243 CODE:
1238 pango_layout_set_indent (self->pl, indent * PANGO_SCALE); 1244 pango_layout_set_indent (self->pl, indent * PANGO_SCALE);
1239 1245
1240void 1246void
1241set_spacing (CFPlus::Layout self, int spacing) 1247set_spacing (DC::Layout self, int spacing)
1242 CODE: 1248 CODE:
1243 pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); 1249 pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE);
1244 1250
1245void 1251void
1246set_ellipsise (CFPlus::Layout self, int ellipsise) 1252set_ellipsise (DC::Layout self, int ellipsise)
1247 CODE: 1253 CODE:
1248 pango_layout_set_ellipsize (self->pl, 1254 pango_layout_set_ellipsize (self->pl,
1249 ellipsise == 1 ? PANGO_ELLIPSIZE_START 1255 ellipsise == 1 ? PANGO_ELLIPSIZE_START
1250 : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE 1256 : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE
1251 : ellipsise == 3 ? PANGO_ELLIPSIZE_END 1257 : ellipsise == 3 ? PANGO_ELLIPSIZE_END
1252 : PANGO_ELLIPSIZE_NONE 1258 : PANGO_ELLIPSIZE_NONE
1253 ); 1259 );
1254 1260
1255void 1261void
1256set_single_paragraph_mode (CFPlus::Layout self, int spm) 1262set_single_paragraph_mode (DC::Layout self, int spm)
1257 CODE: 1263 CODE:
1258 pango_layout_set_single_paragraph_mode (self->pl, !!spm); 1264 pango_layout_set_single_paragraph_mode (self->pl, !!spm);
1259 1265
1260void 1266void
1261size (CFPlus::Layout self) 1267size (DC::Layout self)
1262 PPCODE: 1268 PPCODE:
1263{ 1269{
1264 int w, h; 1270 int w, h;
1265 1271
1266 layout_get_pixel_size (self, &w, &h); 1272 layout_get_pixel_size (self, &w, &h);
1269 PUSHs (sv_2mortal (newSViv (w))); 1275 PUSHs (sv_2mortal (newSViv (w)));
1270 PUSHs (sv_2mortal (newSViv (h))); 1276 PUSHs (sv_2mortal (newSViv (h)));
1271} 1277}
1272 1278
1273int 1279int
1274descent (CFPlus::Layout self) 1280descent (DC::Layout self)
1275 CODE: 1281 CODE:
1276{ 1282{
1277 PangoRectangle rect; 1283 PangoRectangle rect;
1278 PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); 1284 PangoLayoutLine *line = pango_layout_get_line (self->pl, 0);
1279 pango_layout_line_get_pixel_extents (line, 0, &rect); 1285 pango_layout_line_get_pixel_extents (line, 0, &rect);
1281} 1287}
1282 OUTPUT: 1288 OUTPUT:
1283 RETVAL 1289 RETVAL
1284 1290
1285int 1291int
1286xy_to_index (CFPlus::Layout self, int x, int y) 1292xy_to_index (DC::Layout self, int x, int y)
1287 CODE: 1293 CODE:
1288{ 1294{
1289 int index, trailing; 1295 int index, trailing;
1290 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); 1296 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing);
1291 RETVAL = index + trailing; 1297 RETVAL = index + trailing;
1292} 1298}
1293 OUTPUT: 1299 OUTPUT:
1294 RETVAL 1300 RETVAL
1295 1301
1296void 1302void
1297cursor_pos (CFPlus::Layout self, int index) 1303cursor_pos (DC::Layout self, int index)
1298 PPCODE: 1304 PPCODE:
1299{ 1305{
1300 PangoRectangle strong_pos; 1306 PangoRectangle strong_pos;
1301 pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); 1307 pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0);
1302 1308
1305 PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); 1311 PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE)));
1306 PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); 1312 PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE)));
1307} 1313}
1308 1314
1309void 1315void
1310index_to_line_x (CFPlus::Layout self, int index, int trailing = 0) 1316index_to_line_x (DC::Layout self, int index, int trailing = 0)
1311 PPCODE: 1317 PPCODE:
1312{ 1318{
1313 int line, x; 1319 int line, x;
1314 1320
1315 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); 1321 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x);
1322#if !PANGO_VERSION_CHECK (1, 17. 3)
1316 /* pango bug: line is between 1..numlines, not 0..numlines-1 */ 1323 /* pango bug: line is between 1..numlines, not 0..numlines-1 */
1317 1324 --line;
1325#endif
1318 EXTEND (SP, 2); 1326 EXTEND (SP, 2);
1319 PUSHs (sv_2mortal (newSViv (line - 1))); 1327 PUSHs (sv_2mortal (newSViv (line)));
1320 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); 1328 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE)));
1321} 1329}
1322 1330
1323void 1331void
1324line_x_to_index (CFPlus::Layout self, int line, int x) 1332line_x_to_index (DC::Layout self, int line, int x)
1325 PPCODE: 1333 PPCODE:
1326{ 1334{
1327 PangoLayoutLine *lp; 1335 PangoLayoutLine *lp;
1328 int index, trailing; 1336 int index, trailing;
1329 1337
1344 PUSHs (sv_2mortal (newSViv (trailing))); 1352 PUSHs (sv_2mortal (newSViv (trailing)));
1345 } 1353 }
1346} 1354}
1347 1355
1348void 1356void
1349render (CFPlus::Layout self, float x, float y, int flags = 0) 1357render (DC::Layout self, float x, float y, int flags = 0)
1350 CODE: 1358 CODE:
1351 rc_clear (self->rc); 1359 rc_clear (self->rc);
1352 pango_opengl_render_layout_subpixel ( 1360 pango_opengl_render_layout_subpixel (
1353 self->pl, 1361 self->pl,
1354 self->rc, 1362 self->rc,
1359 // we assume that context_change actually clears/frees stuff 1367 // we assume that context_change actually clears/frees stuff
1360 // and does not do any recomputation... 1368 // and does not do any recomputation...
1361 pango_layout_context_changed (self->pl); 1369 pango_layout_context_changed (self->pl);
1362 1370
1363void 1371void
1364draw (CFPlus::Layout self) 1372draw (DC::Layout self)
1365 CODE: 1373 CODE:
1366{ 1374{
1367 glEnable (GL_TEXTURE_2D); 1375 glEnable (GL_TEXTURE_2D);
1368 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 1376 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1369 glEnable (GL_BLEND); 1377 glEnable (GL_BLEND);
1377 glDisable (GL_ALPHA_TEST); 1385 glDisable (GL_ALPHA_TEST);
1378 glDisable (GL_BLEND); 1386 glDisable (GL_BLEND);
1379 glDisable (GL_TEXTURE_2D); 1387 glDisable (GL_TEXTURE_2D);
1380} 1388}
1381 1389
1382MODULE = CFPlus PACKAGE = CFPlus::Texture 1390MODULE = Deliantra::Client PACKAGE = DC::Texture
1383 1391
1384PROTOTYPES: ENABLE 1392PROTOTYPES: ENABLE
1385 1393
1386void 1394void
1387pad (SV *data_, int ow, int oh, int nw, int nh) 1395pad (SV *data_, int ow, int oh, int nw, int nh)
1466 RETVAL = width > 0; 1474 RETVAL = width > 0;
1467} 1475}
1468 OUTPUT: 1476 OUTPUT:
1469 RETVAL 1477 RETVAL
1470 1478
1471MODULE = CFPlus PACKAGE = CFPlus::Map 1479MODULE = Deliantra::Client PACKAGE = DC::Map
1472 1480
1473PROTOTYPES: DISABLE 1481PROTOTYPES: DISABLE
1474 1482
1475CFPlus::Map 1483DC::Map
1476new (SV *class) 1484new (SV *class)
1477 CODE: 1485 CODE:
1478 New (0, RETVAL, 1, struct map); 1486 New (0, RETVAL, 1, struct map);
1479 RETVAL->x = 0; 1487 RETVAL->x = 0;
1480 RETVAL->y = 0; 1488 RETVAL->y = 0;
1488 RETVAL->row = 0; 1496 RETVAL->row = 0;
1489 OUTPUT: 1497 OUTPUT:
1490 RETVAL 1498 RETVAL
1491 1499
1492void 1500void
1493DESTROY (CFPlus::Map self) 1501DESTROY (DC::Map self)
1494 CODE: 1502 CODE:
1495{ 1503{
1496 map_clear (self); 1504 map_clear (self);
1497 Safefree (self->face2tile); 1505 Safefree (self->face2tile);
1498 Safefree (self->tex); 1506 Safefree (self->tex);
1499 Safefree (self); 1507 Safefree (self);
1500} 1508}
1501 1509
1502void 1510void
1503resize (CFPlus::Map self, int map_width, int map_height) 1511resize (DC::Map self, int map_width, int map_height)
1504 CODE: 1512 CODE:
1505 self->w = map_width; 1513 self->w = map_width;
1506 self->h = map_height; 1514 self->h = map_height;
1507 1515
1508void 1516void
1509clear (CFPlus::Map self) 1517clear (DC::Map self)
1510 CODE: 1518 CODE:
1511 map_clear (self); 1519 map_clear (self);
1512 1520
1513void 1521void
1514set_tileid (CFPlus::Map self, int face, int tile) 1522set_tileid (DC::Map self, int face, int tile)
1515 CODE: 1523 CODE:
1516{ 1524{
1517 need_facenum (self, face); self->face2tile [face] = tile; 1525 need_facenum (self, face); self->face2tile [face] = tile;
1518 need_texid (self, tile); 1526 need_texid (self, tile);
1519} 1527}
1520 1528
1521void 1529void
1522set_smooth (CFPlus::Map self, int face, int smooth, int level) 1530set_smooth (DC::Map self, int face, int smooth, int level)
1523 CODE: 1531 CODE:
1524{ 1532{
1525 tileid texid; 1533 tileid texid;
1526 maptex *tex; 1534 maptex *tex;
1527 1535
1540 tex->smoothtile = self->face2tile [smooth]; 1548 tex->smoothtile = self->face2tile [smooth];
1541 tex->smoothlevel = level; 1549 tex->smoothlevel = level;
1542} 1550}
1543 1551
1544void 1552void
1545set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) 1553set_texture (DC::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a)
1546 CODE: 1554 CODE:
1547{ 1555{
1548 need_texid (self, texid); 1556 need_texid (self, texid);
1549 1557
1550 { 1558 {
1570 // from transparent color bleeding and ugly wrapping effects. 1578 // from transparent color bleeding and ugly wrapping effects.
1571 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1579 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1572} 1580}
1573 1581
1574int 1582int
1575ox (CFPlus::Map self) 1583ox (DC::Map self)
1576 ALIAS: 1584 ALIAS:
1577 oy = 1 1585 oy = 1
1578 x = 2 1586 x = 2
1579 y = 3 1587 y = 3
1580 w = 4 1588 w = 4
1591 } 1599 }
1592 OUTPUT: 1600 OUTPUT:
1593 RETVAL 1601 RETVAL
1594 1602
1595void 1603void
1596scroll (CFPlus::Map self, int dx, int dy) 1604scroll (DC::Map self, int dx, int dy)
1597 CODE: 1605 CODE:
1598{ 1606{
1599 if (dx > 0) 1607 if (dx > 0)
1600 map_blank (self, self->x, self->y, dx, self->h); 1608 map_blank (self, self->x, self->y, dx, self->h);
1601 else if (dx < 0) 1609 else if (dx < 0)
1617 self->y += MAP_EXTEND_Y; 1625 self->y += MAP_EXTEND_Y;
1618 } 1626 }
1619} 1627}
1620 1628
1621SV * 1629SV *
1622map1a_update (CFPlus::Map self, SV *data_, int extmap) 1630map1a_update (DC::Map self, SV *data_, int extmap)
1623 CODE: 1631 CODE:
1624{ 1632{
1625 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); 1633 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_);
1626 uint8_t *data_end = (uint8_t *)SvEND (data_); 1634 uint8_t *data_end = (uint8_t *)SvEND (data_);
1627 mapcell *cell; 1635 mapcell *cell;
1716} 1724}
1717 OUTPUT: 1725 OUTPUT:
1718 RETVAL 1726 RETVAL
1719 1727
1720SV * 1728SV *
1721mapmap (CFPlus::Map self, int x0, int y0, int w, int h) 1729mapmap (DC::Map self, int x0, int y0, int w, int h)
1722 CODE: 1730 CODE:
1723{ 1731{
1724 int x1, x; 1732 int x1, x;
1725 int y1, y; 1733 int y1, y;
1726 int z; 1734 int z;
1771} 1779}
1772 OUTPUT: 1780 OUTPUT:
1773 RETVAL 1781 RETVAL
1774 1782
1775void 1783void
1776draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) 1784draw (DC::Map self, int mx, int my, int sw, int sh, int T)
1777 CODE: 1785 CODE:
1778{ 1786{
1779 int x, y, z; 1787 int x, y, z;
1780 1788
1781 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); 1789 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
2052 } 2060 }
2053 } 2061 }
2054} 2062}
2055 2063
2056void 2064void
2057draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) 2065draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data)
2058 CODE: 2066 CODE:
2059{ 2067{
2060 static float color[16][3] = { 2068 static float color[16][3] = {
2061 { 0.00F, 0.00F, 0.00F }, 2069 { 0.00F, 0.00F, 0.00F },
2062 { 1.00F, 1.00F, 1.00F }, 2070 { 1.00F, 1.00F, 1.00F },
2112 glDisable (GL_BLEND); 2120 glDisable (GL_BLEND);
2113 glDisable (GL_TEXTURE_2D); 2121 glDisable (GL_TEXTURE_2D);
2114} 2122}
2115 2123
2116void 2124void
2117fow_texture (CFPlus::Map self, int mx, int my, int sw, int sh) 2125fow_texture (DC::Map self, int mx, int my, int sw, int sh)
2118 PPCODE: 2126 PPCODE:
2119{ 2127{
2120 int x, y; 2128 int x, y;
2121 int sw1 = sw + 2; 2129 int sw1 = sw + 2;
2122 int sh1 = sh + 2; 2130 int sh1 = sh + 2;
2193 PUSHs (sv_2mortal (newSViv (sh3))); 2201 PUSHs (sv_2mortal (newSViv (sh3)));
2194 PUSHs (darkness3_sv); 2202 PUSHs (darkness3_sv);
2195} 2203}
2196 2204
2197SV * 2205SV *
2198get_rect (CFPlus::Map self, int x0, int y0, int w, int h) 2206get_rect (DC::Map self, int x0, int y0, int w, int h)
2199 CODE: 2207 CODE:
2200{ 2208{
2201 int x, y, x1, y1; 2209 int x, y, x1, y1;
2202 SV *data_sv = newSV (w * h * 7 + 5); 2210 SV *data_sv = newSV (w * h * 7 + 5);
2203 uint8_t *data = (uint8_t *)SvPVX (data_sv); 2211 uint8_t *data = (uint8_t *)SvPVX (data_sv);
2268} 2276}
2269 OUTPUT: 2277 OUTPUT:
2270 RETVAL 2278 RETVAL
2271 2279
2272void 2280void
2273set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) 2281set_rect (DC::Map self, int x0, int y0, uint8_t *data)
2274 PPCODE: 2282 PPCODE:
2275{ 2283{
2276 int x, y, z; 2284 int x, y, z;
2277 int w, h; 2285 int w, h;
2278 int x1, y1; 2286 int x1, y1;
2331 } 2339 }
2332 } 2340 }
2333 } 2341 }
2334} 2342}
2335 2343
2336MODULE = CFPlus PACKAGE = CFPlus::RW 2344MODULE = Deliantra::Client PACKAGE = DC::RW
2337 2345
2338CFPlus::RW 2346DC::RW
2339new (SV *class, SV *data_sv) 2347new (SV *class, SV *data_sv)
2340 CODE: 2348 CODE:
2341{ 2349{
2342 STRLEN datalen; 2350 STRLEN datalen;
2343 char *data = SvPVbyte (data_sv, datalen); 2351 char *data = SvPVbyte (data_sv, datalen);
2345 RETVAL = SDL_RWFromConstMem (data, datalen); 2353 RETVAL = SDL_RWFromConstMem (data, datalen);
2346} 2354}
2347 OUTPUT: 2355 OUTPUT:
2348 RETVAL 2356 RETVAL
2349 2357
2350CFPlus::RW 2358DC::RW
2351new_from_file (SV *class, const char *path, const char *mode = "rb") 2359new_from_file (SV *class, const char *path, const char *mode = "rb")
2352 CODE: 2360 CODE:
2353 RETVAL = SDL_RWFromFile (path, mode); 2361 RETVAL = SDL_RWFromFile (path, mode);
2354 OUTPUT: 2362 OUTPUT:
2355 RETVAL 2363 RETVAL
2356 2364
2357# fails on win32: 2365# fails on win32:
2358# CFPlus.xs(2268) : error C2059: syntax error : '(' 2366# dc.xs(2268) : error C2059: syntax error : '('
2359#void 2367#void
2360#close (CFPlus::RW self) 2368#close (DC::RW self)
2361# CODE: 2369# CODE:
2362# (self->(close)) (self); 2370# (self->(close)) (self);
2363 2371
2364MODULE = CFPlus PACKAGE = CFPlus::Channel 2372MODULE = Deliantra::Client PACKAGE = DC::Channel
2365 2373
2366PROTOTYPES: DISABLE 2374PROTOTYPES: DISABLE
2367 2375
2368CFPlus::Channel 2376DC::Channel
2369find () 2377find ()
2370 CODE: 2378 CODE:
2371{ 2379{
2372 RETVAL = Mix_GroupAvailable (-1); 2380 RETVAL = Mix_GroupAvailable (-1);
2373 2381
2386} 2394}
2387 OUTPUT: 2395 OUTPUT:
2388 RETVAL 2396 RETVAL
2389 2397
2390void 2398void
2391halt (CFPlus::Channel self) 2399halt (DC::Channel self)
2392 CODE: 2400 CODE:
2393 Mix_HaltChannel (self); 2401 Mix_HaltChannel (self);
2394 2402
2395void 2403void
2396expire (CFPlus::Channel self, int ticks = -1) 2404expire (DC::Channel self, int ticks = -1)
2397 CODE: 2405 CODE:
2398 Mix_ExpireChannel (self, ticks); 2406 Mix_ExpireChannel (self, ticks);
2399 2407
2400void 2408void
2401fade_out (CFPlus::Channel self, int ticks = -1) 2409fade_out (DC::Channel self, int ticks = -1)
2402 CODE: 2410 CODE:
2403 Mix_FadeOutChannel (self, ticks); 2411 Mix_FadeOutChannel (self, ticks);
2404 2412
2405int 2413int
2406volume (CFPlus::Channel self, int volume) 2414volume (DC::Channel self, int volume)
2407 CODE: 2415 CODE:
2408 RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); 2416 RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128));
2409 OUTPUT: 2417 OUTPUT:
2410 RETVAL 2418 RETVAL
2411 2419
2412void 2420void
2413unregister_all_effects (CFPlus::Channel self) 2421unregister_all_effects (DC::Channel self)
2414 CODE: 2422 CODE:
2415 Mix_UnregisterAllEffects (self); 2423 Mix_UnregisterAllEffects (self);
2416 2424
2417void 2425void
2418set_panning (CFPlus::Channel self, int left, int right) 2426set_panning (DC::Channel self, int left, int right)
2419 CODE: 2427 CODE:
2420 left = CLAMP (left , 0, 255); 2428 left = CLAMP (left , 0, 255);
2421 right = CLAMP (right, 0, 255); 2429 right = CLAMP (right, 0, 255);
2422 Mix_SetPanning (self, left, right); 2430 Mix_SetPanning (self, left, right);
2423 2431
2424void 2432void
2425set_distance (CFPlus::Channel self, int distance) 2433set_distance (DC::Channel self, int distance)
2426 CODE: 2434 CODE:
2427 Mix_SetDistance (self, CLAMP (distance, 0, 255)); 2435 Mix_SetDistance (self, CLAMP (distance, 0, 255));
2428 2436
2429void 2437void
2430set_position (CFPlus::Channel self, int angle, int distance) 2438set_position (DC::Channel self, int angle, int distance)
2431 CODE: 2439 CODE:
2432 2440
2433void 2441void
2434set_position_r (CFPlus::Channel self, int dx, int dy, int maxdistance) 2442set_position_r (DC::Channel self, int dx, int dy, int maxdistance)
2435 CODE: 2443 CODE:
2436{ 2444{
2437 int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); 2445 int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance));
2438 int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); 2446 int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI);
2439 Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); 2447 Mix_SetPosition (self, angle, CLAMP (distance, 0, 255));
2440} 2448}
2441 2449
2442void 2450void
2443set_reverse_stereo (CFPlus::Channel self, int flip) 2451set_reverse_stereo (DC::Channel self, int flip)
2444 CODE: 2452 CODE:
2445 Mix_SetReverseStereo (self, flip); 2453 Mix_SetReverseStereo (self, flip);
2446 2454
2447MODULE = CFPlus PACKAGE = CFPlus::MixChunk 2455MODULE = Deliantra::Client PACKAGE = DC::MixChunk
2448 2456
2449PROTOTYPES: DISABLE 2457PROTOTYPES: DISABLE
2450 2458
2451CFPlus::MixChunk 2459DC::MixChunk
2452new (SV *class, CFPlus::RW rwops) 2460new (SV *class, DC::RW rwops)
2453 CODE: 2461 CODE:
2454 RETVAL = Mix_LoadWAV_RW (rwops, 1); 2462 RETVAL = Mix_LoadWAV_RW (rwops, 1);
2455 OUTPUT: 2463 OUTPUT:
2456 RETVAL 2464 RETVAL
2457 2465
2458void 2466void
2459DESTROY (CFPlus::MixChunk self) 2467DESTROY (DC::MixChunk self)
2460 CODE: 2468 CODE:
2461 Mix_FreeChunk (self); 2469 Mix_FreeChunk (self);
2462 2470
2463int 2471int
2464volume (CFPlus::MixChunk self, int volume = -1) 2472volume (DC::MixChunk self, int volume = -1)
2465 CODE: 2473 CODE:
2466 if (items > 1) 2474 if (items > 1)
2467 volume = CLAMP (volume, 0, 128); 2475 volume = CLAMP (volume, 0, 128);
2468 RETVAL = Mix_VolumeChunk (self, volume); 2476 RETVAL = Mix_VolumeChunk (self, volume);
2469 OUTPUT: 2477 OUTPUT:
2470 RETVAL 2478 RETVAL
2471 2479
2472CFPlus::Channel 2480DC::Channel
2473play (CFPlus::MixChunk self, CFPlus::Channel channel = -1, int loops = 0, int ticks = -1) 2481play (DC::MixChunk self, DC::Channel channel = -1, int loops = 0, int ticks = -1)
2474 CODE: 2482 CODE:
2475{ 2483{
2476 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); 2484 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks);
2477 2485
2478 if (RETVAL < 0) 2486 if (RETVAL < 0)
2485 } 2493 }
2486} 2494}
2487 OUTPUT: 2495 OUTPUT:
2488 RETVAL 2496 RETVAL
2489 2497
2490MODULE = CFPlus PACKAGE = CFPlus::MixMusic 2498MODULE = Deliantra::Client PACKAGE = DC::MixMusic
2491 2499
2492int 2500int
2493volume (int volume = -1) 2501volume (int volume = -1)
2494 PROTOTYPE: ;$ 2502 PROTOTYPE: ;$
2495 CODE: 2503 CODE:
2507void 2515void
2508halt () 2516halt ()
2509 CODE: 2517 CODE:
2510 Mix_HaltMusic (); 2518 Mix_HaltMusic ();
2511 2519
2512CFPlus::MixMusic 2520DC::MixMusic
2513new (SV *class, CFPlus::RW rwops) 2521new (SV *class, DC::RW rwops)
2514 CODE: 2522 CODE:
2515 RETVAL = Mix_LoadMUS_RW (rwops); 2523 RETVAL = Mix_LoadMUS_RW (rwops);
2516 OUTPUT: 2524 OUTPUT:
2517 RETVAL 2525 RETVAL
2518 2526
2519void 2527void
2520DESTROY (CFPlus::MixMusic self) 2528DESTROY (DC::MixMusic self)
2521 CODE: 2529 CODE:
2522 Mix_FreeMusic (self); 2530 Mix_FreeMusic (self);
2523 2531
2524int 2532int
2525play (CFPlus::MixMusic self, int loops = -1) 2533play (DC::MixMusic self, int loops = -1)
2526 CODE: 2534 CODE:
2527 RETVAL = Mix_PlayMusic (self, loops); 2535 RETVAL = Mix_PlayMusic (self, loops);
2528 OUTPUT: 2536 OUTPUT:
2529 RETVAL 2537 RETVAL
2530 2538
2531void 2539void
2532fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) 2540fade_in_pos (DC::MixMusic self, int loops, int ms, double position)
2533 CODE: 2541 CODE:
2534 Mix_FadeInMusicPos (self, loops, ms, position); 2542 Mix_FadeInMusicPos (self, loops, ms, position);
2535 2543
2536MODULE = CFPlus PACKAGE = CFPlus::OpenGL 2544MODULE = Deliantra::Client PACKAGE = DC::OpenGL
2537 2545
2538PROTOTYPES: ENABLE 2546PROTOTYPES: ENABLE
2539 2547
2540BOOT: 2548BOOT:
2541{ 2549{
2542 HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); 2550 HV *stash = gv_stashpv ("DC::OpenGL", 1);
2543 static const struct { 2551 static const struct {
2544 const char *name; 2552 const char *name;
2545 IV iv; 2553 IV iv;
2546 } *civ, const_iv[] = { 2554 } *civ, const_iv[] = {
2547# define const_iv(name) { # name, (IV)name } 2555# define const_iv(name) { # name, (IV)name }
2840void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column) 2848void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column)
2841 CODE: 2849 CODE:
2842 if (gl.SeparableFilter2D) 2850 if (gl.SeparableFilter2D)
2843 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column); 2851 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column);
2844 2852
2845void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) 2853void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data = 0)
2846 2854
2847void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) 2855void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
2848 2856
2849void glDrawPixels (int width, int height, int format, int type, char *pixels) 2857void glDrawPixels (int width, int height, int format, int type, char *pixels)
2850 2858
2876 2884
2877void glEndList () 2885void glEndList ()
2878 2886
2879void glCallList (int list) 2887void glCallList (int list)
2880 2888
2881MODULE = CFPlus PACKAGE = CFPlus::UI::Base 2889MODULE = Deliantra::Client PACKAGE = DC::UI::Base
2882 2890
2883PROTOTYPES: DISABLE 2891PROTOTYPES: DISABLE
2884 2892
2885void 2893void
2886find_widget (SV *self, NV x, NV y) 2894find_widget (SV *self, NV x, NV y)
2890 XPUSHs (self); 2898 XPUSHs (self);
2891} 2899}
2892 2900
2893BOOT: 2901BOOT:
2894{ 2902{
2895 hover_gv = gv_fetchpv ("CFPlus::UI::HOVER", 1, SVt_NV); 2903 hover_gv = gv_fetchpv ("DC::UI::HOVER", 1, SVt_NV);
2896 2904
2897 draw_x_gv = gv_fetchpv ("CFPlus::UI::Base::draw_x", 1, SVt_NV); 2905 draw_x_gv = gv_fetchpv ("DC::UI::Base::draw_x", 1, SVt_NV);
2898 draw_y_gv = gv_fetchpv ("CFPlus::UI::Base::draw_y", 1, SVt_NV); 2906 draw_y_gv = gv_fetchpv ("DC::UI::Base::draw_y", 1, SVt_NV);
2899 draw_w_gv = gv_fetchpv ("CFPlus::UI::Base::draw_w", 1, SVt_NV); 2907 draw_w_gv = gv_fetchpv ("DC::UI::Base::draw_w", 1, SVt_NV);
2900 draw_h_gv = gv_fetchpv ("CFPlus::UI::Base::draw_h", 1, SVt_NV); 2908 draw_h_gv = gv_fetchpv ("DC::UI::Base::draw_h", 1, SVt_NV);
2901} 2909}
2902 2910
2903void 2911void
2904draw (SV *self) 2912draw (SV *self)
2905 CODE: 2913 CODE:
2912 SV *draw_w_sv = GvSV (draw_w_gv); 2920 SV *draw_w_sv = GvSV (draw_w_gv);
2913 SV *draw_h_sv = GvSV (draw_h_gv); 2921 SV *draw_h_sv = GvSV (draw_h_gv);
2914 double draw_x, draw_y; 2922 double draw_x, draw_y;
2915 2923
2916 if (!SvROK (self)) 2924 if (!SvROK (self))
2917 croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); 2925 croak ("DC::Base::draw: %s not a reference", SvPV_nolen (self));
2918 2926
2919 hv = (HV *)SvRV (self); 2927 hv = (HV *)SvRV (self);
2920 2928
2921 if (SvTYPE (hv) != SVt_PVHV) 2929 if (SvTYPE (hv) != SVt_PVHV)
2922 croak ("CFPlus::Base::draw: %s not a hashref", SvPV_nolen (self)); 2930 croak ("DC::Base::draw: %s not a hashref", SvPV_nolen (self));
2923 2931
2924 svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; 2932 svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.;
2925 svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.; 2933 svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.;
2926 2934
2927 if (!h || !w) 2935 if (!h || !w)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines