--- deliantra/Deliantra-Client/Client.xs 2007/08/13 16:20:17 1.229 +++ deliantra/Deliantra-Client/Client.xs 2007/12/28 15:05:20 1.245 @@ -122,12 +122,12 @@ #include "pango-fontmap.c" #include "pango-render.c" -typedef IV CFPlus__Channel; -typedef SDL_RWops *CFPlus__RW; -typedef Mix_Chunk *CFPlus__MixChunk; -typedef Mix_Music *CFPlus__MixMusic; +typedef IV DC__Channel; +typedef SDL_RWops *DC__RW; +typedef Mix_Chunk *DC__MixChunk; +typedef Mix_Music *DC__MixMusic; -typedef PangoFontDescription *CFPlus__Font; +typedef PangoFontDescription *DC__Font; static int shape_attr_p (PangoLayoutRun *run) @@ -151,11 +151,11 @@ PangoLayout *pl; float r, g, b, a; // default color for rgba mode int base_height; - CFPlus__Font font; + DC__Font font; rc_t *rc; -} *CFPlus__Layout; +} *DC__Layout; -static CFPlus__Font default_font; +static DC__Font default_font; static PangoContext *opengl_context; static PangoFontMap *opengl_fontmap; @@ -170,7 +170,7 @@ } static void -layout_update_font (CFPlus__Layout self) +layout_update_font (DC__Layout self) { /* use a random scale factor to account for unknown descenders, 0.8 works * reasonably well with bitstream vera @@ -184,7 +184,7 @@ } static void -layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) +layout_get_pixel_size (DC__Layout self, int *w, int *h) { PangoRectangle rect; @@ -233,7 +233,7 @@ int32_t rows; maprow *row; -} *CFPlus__Map; +} *DC__Map; static char * prepend (char *ptr, int sze, int inc) @@ -281,7 +281,7 @@ } static maprow * -map_get_row (CFPlus__Map self, int y) +map_get_row (DC__Map self, int y) { if (0 > y) { @@ -329,13 +329,13 @@ } static mapcell * -map_get_cell (CFPlus__Map self, int x, int y) +map_get_cell (DC__Map self, int x, int y) { return row_get_cell (map_get_row (self, y), x); } static void -map_clear (CFPlus__Map self) +map_clear (DC__Map self) { int r; @@ -353,7 +353,7 @@ } static void -map_blank (CFPlus__Map self, int x0, int y0, int w, int h) +map_blank (DC__Map self, int x0, int y0, int w, int h) { int x, y; maprow *row; @@ -442,6 +442,17 @@ return n + 1; } +static unsigned int +popcount (unsigned int n) +{ + n -= (n >> 1) & 0x55555555U; + n = ((n >> 2) & 0x33333333U) + (n & 0x33333333U); + n = ((n >> 4) + n) & 0x0f0f0f0fU; + n *= 0x01010101U; + + return n >> 24; +} + /* SDL should provide this, really. */ #define SDLK_MODIFIER_MIN 300 #define SDLK_MODIFIER_MAX 314 @@ -489,13 +500,13 @@ return 1; } -MODULE = CFPlus PACKAGE = CFPlus +MODULE = Deliantra::Client PACKAGE = DC PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("CFPlus", 1); + HV *stash = gv_stashpv ("DC", 1); static const struct { const char *name; IV iv; @@ -527,6 +538,8 @@ const_iv (SDL_APPMOUSEFOCUS), const_iv (SDL_APPACTIVE), + const_iv (SDLK_FIRST), + const_iv (SDLK_LAST), const_iv (SDLK_KP0), const_iv (SDLK_KP1), const_iv (SDLK_KP2), @@ -608,6 +621,8 @@ const_iv (KMOD_NUM), const_iv (KMOD_CAPS), const_iv (KMOD_MODE), + + const_iv (MIX_DEFAULT_FORMAT), # undef const_iv }; @@ -635,6 +650,10 @@ NV ceil (NV x) +IV minpot (UV n) + +IV popcount (UV n) + void pango_init () CODE: @@ -683,7 +702,7 @@ if (m && m != (SDL_Rect **)-1) while (*m) { - if ((*m)->w >= 640 && (*m)->h >= 480) + if ((*m)->w >= 800 && (*m)->h >= 480) { AV *av = newAV (); av_push (av, newSViv ((*m)->w)); @@ -717,7 +736,7 @@ { av_clear (texture_av); - SDL_WM_SetCaption ("Crossfire TRT Client " VERSION, "Crossfire TRT"); + SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra"); #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); #include "glfunc.h" #undef GL_FUNC @@ -808,17 +827,33 @@ break; } - XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); + XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); } } int -Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 1024) +Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) POSTCALL: Mix_HookMusicFinished (music_finished); Mix_ChannelFinished (channel_finished); void +Mix_QuerySpec () + PPCODE: +{ + int freq, channels; + Uint16 format; + + if (Mix_QuerySpec (&freq, &format, &channels)) + { + EXTEND (SP, 3); + PUSHs (sv_2mortal (newSViv (freq))); + PUSHs (sv_2mortal (newSViv (format))); + PUSHs (sv_2mortal (newSViv (channels))); + } +} + +void Mix_CloseAudio () int @@ -960,7 +995,7 @@ CODE: fprintf (stderr, "ERROR: %s\n", message); #ifdef _WIN32 - MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR); + MessageBox (0, message, "Deliantra Client Error", MB_OK | MB_ICONERROR); #endif void @@ -968,7 +1003,7 @@ CODE: fprintf (stderr, "FATAL: %s\n", message); #ifdef _WIN32 - MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); + MessageBox (0, message, "Deliantra Client Fatal Error", MB_OK | MB_ICONERROR); #endif _exit (1); @@ -990,11 +1025,11 @@ #endif } -MODULE = CFPlus PACKAGE = CFPlus::Font +MODULE = Deliantra::Client PACKAGE = DC::Font PROTOTYPES: DISABLE -CFPlus::Font +DC::Font new_from_file (SV *class, char *path, int id = 0) CODE: { @@ -1007,27 +1042,33 @@ RETVAL void -DESTROY (CFPlus::Font self) +DESTROY (DC::Font self) CODE: pango_font_description_free (self); void -make_default (CFPlus::Font self) +make_default (DC::Font self) PROTOTYPE: $ CODE: default_font = self; -MODULE = CFPlus PACKAGE = CFPlus::Layout +MODULE = Deliantra::Client PACKAGE = DC::Layout PROTOTYPES: DISABLE void -reset_glyph_cache () +glyph_cache_backup () + PROTOTYPE: + CODE: + tc_backup (); + +void +glyph_cache_restore () PROTOTYPE: CODE: - tc_clear (); + tc_restore (); -CFPlus::Layout +DC::Layout new (SV *class) CODE: New (0, RETVAL, 1, struct cf_layout); @@ -1047,14 +1088,14 @@ RETVAL void -DESTROY (CFPlus::Layout self) +DESTROY (DC::Layout self) CODE: g_object_unref (self->pl); rc_free (self->rc); Safefree (self); void -set_text (CFPlus::Layout self, SV *text_) +set_text (DC::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1064,7 +1105,7 @@ } void -set_markup (CFPlus::Layout self, SV *text_) +set_markup (DC::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1074,7 +1115,7 @@ } void -set_shapes (CFPlus::Layout self, ...) +set_shapes (DC::Layout self, ...) CODE: { PangoAttrList *attrs = 0; @@ -1119,7 +1160,7 @@ } void -get_shapes (CFPlus::Layout self) +get_shapes (DC::Layout self) PPCODE: { PangoLayoutIter *iter = pango_layout_get_iter (self->pl); @@ -1144,7 +1185,7 @@ } int -has_wrapped (CFPlus::Layout self) +has_wrapped (DC::Layout self) CODE: { int lines = 1; @@ -1159,7 +1200,7 @@ RETVAL SV * -get_text (CFPlus::Layout self) +get_text (DC::Layout self) CODE: RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); sv_utf8_decode (RETVAL); @@ -1167,7 +1208,7 @@ RETVAL void -set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) +set_foreground (DC::Layout self, float r, float g, float b, float a = 1.) CODE: self->r = r; self->g = g; @@ -1175,7 +1216,7 @@ self->a = a; void -set_font (CFPlus::Layout self, CFPlus::Font font = 0) +set_font (DC::Layout self, DC::Font font = 0) CODE: if (self->font != font) { @@ -1184,7 +1225,7 @@ } void -set_height (CFPlus::Layout self, int base_height) +set_height (DC::Layout self, int base_height) CODE: if (self->base_height != base_height) { @@ -1193,22 +1234,22 @@ } void -set_width (CFPlus::Layout self, int max_width = -1) +set_width (DC::Layout self, int max_width = -1) CODE: pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); void -set_indent (CFPlus::Layout self, int indent) +set_indent (DC::Layout self, int indent) CODE: pango_layout_set_indent (self->pl, indent * PANGO_SCALE); void -set_spacing (CFPlus::Layout self, int spacing) +set_spacing (DC::Layout self, int spacing) CODE: pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); void -set_ellipsise (CFPlus::Layout self, int ellipsise) +set_ellipsise (DC::Layout self, int ellipsise) CODE: pango_layout_set_ellipsize (self->pl, ellipsise == 1 ? PANGO_ELLIPSIZE_START @@ -1218,12 +1259,12 @@ ); void -set_single_paragraph_mode (CFPlus::Layout self, int spm) +set_single_paragraph_mode (DC::Layout self, int spm) CODE: pango_layout_set_single_paragraph_mode (self->pl, !!spm); void -size (CFPlus::Layout self) +size (DC::Layout self) PPCODE: { int w, h; @@ -1236,7 +1277,7 @@ } int -descent (CFPlus::Layout self) +descent (DC::Layout self) CODE: { PangoRectangle rect; @@ -1248,7 +1289,7 @@ RETVAL int -xy_to_index (CFPlus::Layout self, int x, int y) +xy_to_index (DC::Layout self, int x, int y) CODE: { int index, trailing; @@ -1259,7 +1300,7 @@ RETVAL void -cursor_pos (CFPlus::Layout self, int index) +cursor_pos (DC::Layout self, int index) PPCODE: { PangoRectangle strong_pos; @@ -1272,21 +1313,25 @@ } void -index_to_line_x (CFPlus::Layout self, int index, int trailing = 0) +index_to_line_x (DC::Layout self, int index, int trailing = 0) PPCODE: { int line, x; pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); + +#if !PANGO_VERSION_CHECK (1, 17. 3) /* pango bug: line is between 1..numlines, not 0..numlines-1 */ + --line; +#endif EXTEND (SP, 2); - PUSHs (sv_2mortal (newSViv (line - 1))); + PUSHs (sv_2mortal (newSViv (line))); PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); } void -line_x_to_index (CFPlus::Layout self, int line, int x) +line_x_to_index (DC::Layout self, int line, int x) PPCODE: { PangoLayoutLine *lp; @@ -1311,7 +1356,7 @@ } void -render (CFPlus::Layout self, float x, float y, int flags = 0) +render (DC::Layout self, float x, float y, int flags = 0) CODE: rc_clear (self->rc); pango_opengl_render_layout_subpixel ( @@ -1326,7 +1371,7 @@ pango_layout_context_changed (self->pl); void -draw (CFPlus::Layout self) +draw (DC::Layout self) CODE: { glEnable (GL_TEXTURE_2D); @@ -1344,12 +1389,10 @@ glDisable (GL_TEXTURE_2D); } -MODULE = CFPlus PACKAGE = CFPlus::Texture +MODULE = Deliantra::Client PACKAGE = DC::Texture PROTOTYPES: ENABLE -int minpot (int n) - void pad (SV *data_, int ow, int oh, int nw, int nh) CODE: @@ -1435,11 +1478,11 @@ OUTPUT: RETVAL -MODULE = CFPlus PACKAGE = CFPlus::Map +MODULE = Deliantra::Client PACKAGE = DC::Map PROTOTYPES: DISABLE -CFPlus::Map +DC::Map new (SV *class) CODE: New (0, RETVAL, 1, struct map); @@ -1457,7 +1500,7 @@ RETVAL void -DESTROY (CFPlus::Map self) +DESTROY (DC::Map self) CODE: { map_clear (self); @@ -1467,18 +1510,18 @@ } void -resize (CFPlus::Map self, int map_width, int map_height) +resize (DC::Map self, int map_width, int map_height) CODE: self->w = map_width; self->h = map_height; void -clear (CFPlus::Map self) +clear (DC::Map self) CODE: map_clear (self); void -set_tileid (CFPlus::Map self, int face, int tile) +set_tileid (DC::Map self, int face, int tile) CODE: { need_facenum (self, face); self->face2tile [face] = tile; @@ -1486,7 +1529,7 @@ } void -set_smooth (CFPlus::Map self, int face, int smooth, int level) +set_smooth (DC::Map self, int face, int smooth, int level) CODE: { tileid texid; @@ -1509,7 +1552,7 @@ } void -set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) +set_texture (DC::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) CODE: { need_texid (self, texid); @@ -1539,7 +1582,7 @@ } int -ox (CFPlus::Map self) +ox (DC::Map self) ALIAS: oy = 1 x = 2 @@ -1560,7 +1603,7 @@ RETVAL void -scroll (CFPlus::Map self, int dx, int dy) +scroll (DC::Map self, int dx, int dy) CODE: { if (dx > 0) @@ -1586,7 +1629,7 @@ } SV * -map1a_update (CFPlus::Map self, SV *data_, int extmap) +map1a_update (DC::Map self, SV *data_, int extmap) CODE: { uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); @@ -1685,7 +1728,7 @@ RETVAL SV * -mapmap (CFPlus::Map self, int x0, int y0, int w, int h) +mapmap (DC::Map self, int x0, int y0, int w, int h) CODE: { int x1, x; @@ -1740,7 +1783,7 @@ RETVAL void -draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) +draw (DC::Map self, int mx, int my, int sw, int sh, int T) CODE: { int x, y, z; @@ -2021,7 +2064,7 @@ } void -draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) +draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data) CODE: { static float color[16][3] = { @@ -2081,7 +2124,7 @@ } void -fow_texture (CFPlus::Map self, int mx, int my, int sw, int sh) +fow_texture (DC::Map self, int mx, int my, int sw, int sh) PPCODE: { int x, y; @@ -2162,7 +2205,7 @@ } SV * -get_rect (CFPlus::Map self, int x0, int y0, int w, int h) +get_rect (DC::Map self, int x0, int y0, int w, int h) CODE: { int x, y, x1, y1; @@ -2237,7 +2280,7 @@ RETVAL void -set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) +set_rect (DC::Map self, int x0, int y0, uint8_t *data) PPCODE: { int x, y, z; @@ -2300,9 +2343,9 @@ } } -MODULE = CFPlus PACKAGE = CFPlus::RW +MODULE = Deliantra::Client PACKAGE = DC::RW -CFPlus::RW +DC::RW new (SV *class, SV *data_sv) CODE: { @@ -2314,7 +2357,7 @@ OUTPUT: RETVAL -CFPlus::RW +DC::RW new_from_file (SV *class, const char *path, const char *mode = "rb") CODE: RETVAL = SDL_RWFromFile (path, mode); @@ -2322,17 +2365,17 @@ RETVAL # fails on win32: -# CFPlus.xs(2268) : error C2059: syntax error : '(' +# dc.xs(2268) : error C2059: syntax error : '(' #void -#close (CFPlus::RW self) +#close (DC::RW self) # CODE: # (self->(close)) (self); -MODULE = CFPlus PACKAGE = CFPlus::Channel +MODULE = Deliantra::Client PACKAGE = DC::Channel PROTOTYPES: DISABLE -CFPlus::Channel +DC::Channel find () CODE: { @@ -2355,50 +2398,50 @@ RETVAL void -halt (CFPlus::Channel self) +halt (DC::Channel self) CODE: Mix_HaltChannel (self); void -expire (CFPlus::Channel self, int ticks = -1) +expire (DC::Channel self, int ticks = -1) CODE: Mix_ExpireChannel (self, ticks); void -fade_out (CFPlus::Channel self, int ticks = -1) +fade_out (DC::Channel self, int ticks = -1) CODE: Mix_FadeOutChannel (self, ticks); int -volume (CFPlus::Channel self, int volume) +volume (DC::Channel self, int volume) CODE: RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); OUTPUT: RETVAL void -unregister_all_effects (CFPlus::Channel self) +unregister_all_effects (DC::Channel self) CODE: Mix_UnregisterAllEffects (self); void -set_panning (CFPlus::Channel self, int left, int right) +set_panning (DC::Channel self, int left, int right) CODE: left = CLAMP (left , 0, 255); right = CLAMP (right, 0, 255); Mix_SetPanning (self, left, right); void -set_distance (CFPlus::Channel self, int distance) +set_distance (DC::Channel self, int distance) CODE: Mix_SetDistance (self, CLAMP (distance, 0, 255)); void -set_position (CFPlus::Channel self, int angle, int distance) +set_position (DC::Channel self, int angle, int distance) CODE: void -set_position_r (CFPlus::Channel self, int dx, int dy, int maxdistance) +set_position_r (DC::Channel self, int dx, int dy, int maxdistance) CODE: { int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); @@ -2407,28 +2450,28 @@ } void -set_reverse_stereo (CFPlus::Channel self, int flip) +set_reverse_stereo (DC::Channel self, int flip) CODE: Mix_SetReverseStereo (self, flip); -MODULE = CFPlus PACKAGE = CFPlus::MixChunk +MODULE = Deliantra::Client PACKAGE = DC::MixChunk PROTOTYPES: DISABLE -CFPlus::MixChunk -new (SV *class, CFPlus::RW rwops) +DC::MixChunk +new (SV *class, DC::RW rwops) CODE: RETVAL = Mix_LoadWAV_RW (rwops, 1); OUTPUT: RETVAL void -DESTROY (CFPlus::MixChunk self) +DESTROY (DC::MixChunk self) CODE: Mix_FreeChunk (self); int -volume (CFPlus::MixChunk self, int volume = -1) +volume (DC::MixChunk self, int volume = -1) CODE: if (items > 1) volume = CLAMP (volume, 0, 128); @@ -2436,8 +2479,8 @@ OUTPUT: RETVAL -CFPlus::Channel -play (CFPlus::MixChunk self, CFPlus::Channel channel = -1, int loops = 0, int ticks = -1) +DC::Channel +play (DC::MixChunk self, DC::Channel channel = -1, int loops = 0, int ticks = -1) CODE: { RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); @@ -2454,7 +2497,7 @@ OUTPUT: RETVAL -MODULE = CFPlus PACKAGE = CFPlus::MixMusic +MODULE = Deliantra::Client PACKAGE = DC::MixMusic int volume (int volume = -1) @@ -2476,37 +2519,37 @@ CODE: Mix_HaltMusic (); -CFPlus::MixMusic -new (SV *class, CFPlus::RW rwops) +DC::MixMusic +new (SV *class, DC::RW rwops) CODE: RETVAL = Mix_LoadMUS_RW (rwops); OUTPUT: RETVAL void -DESTROY (CFPlus::MixMusic self) +DESTROY (DC::MixMusic self) CODE: Mix_FreeMusic (self); int -play (CFPlus::MixMusic self, int loops = -1) +play (DC::MixMusic self, int loops = -1) CODE: RETVAL = Mix_PlayMusic (self, loops); OUTPUT: RETVAL void -fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) +fade_in_pos (DC::MixMusic self, int loops, int ms, double position) CODE: Mix_FadeInMusicPos (self, loops, ms, position); -MODULE = CFPlus PACKAGE = CFPlus::OpenGL +MODULE = Deliantra::Client PACKAGE = DC::OpenGL PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); + HV *stash = gv_stashpv ("DC::OpenGL", 1); static const struct { const char *name; IV iv; @@ -2551,6 +2594,12 @@ const_iv (GL_LUMINANCE_ALPHA), const_iv (GL_FLOAT), const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), + const_iv (GL_COMPRESSED_ALPHA_ARB), + const_iv (GL_COMPRESSED_LUMINANCE_ARB), + const_iv (GL_COMPRESSED_LUMINANCE_ALPHA_ARB), + const_iv (GL_COMPRESSED_INTENSITY_ARB), + const_iv (GL_COMPRESSED_RGB_ARB), + const_iv (GL_COMPRESSED_RGBA_ARB), const_iv (GL_COMPILE), const_iv (GL_PROXY_TEXTURE_1D), const_iv (GL_PROXY_TEXTURE_2D), @@ -2599,6 +2648,7 @@ const_iv (GL_LINE_SMOOTH_HINT), const_iv (GL_POLYGON_SMOOTH_HINT), const_iv (GL_GENERATE_MIPMAP_HINT), + const_iv (GL_TEXTURE_COMPRESSION_HINT), const_iv (GL_FASTEST), const_iv (GL_DONT_CARE), const_iv (GL_NICEST), @@ -2616,6 +2666,12 @@ AvREAL_off (texture_av); } +void +disable_GL_EXT_blend_func_separate () + CODE: + gl.BlendFuncSeparate = 0; + gl.BlendFuncSeparateEXT = 0; + char * gl_vendor () CODE: @@ -2746,6 +2802,15 @@ CODE: glRectf (x1, y1, x2, y2); +void glRect_lineloop (float x1, float y1, float x2, float y2) + CODE: + glBegin (GL_LINE_LOOP); + glVertex2f (x1, y1); + glVertex2f (x2, y1); + glVertex2f (x2, y2); + glVertex2f (x1, y2); + glEnd (); + PROTOTYPES: ENABLE void glBegin (int mode) @@ -2787,7 +2852,7 @@ if (gl.SeparableFilter2D) gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column); -void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) +void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data = 0) void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) @@ -2823,7 +2888,7 @@ void glCallList (int list) -MODULE = CFPlus PACKAGE = CFPlus::UI::Base +MODULE = Deliantra::Client PACKAGE = DC::UI::Base PROTOTYPES: DISABLE @@ -2837,12 +2902,12 @@ BOOT: { - hover_gv = gv_fetchpv ("CFPlus::UI::HOVER", 1, SVt_NV); + hover_gv = gv_fetchpv ("DC::UI::HOVER", 1, SVt_NV); - draw_x_gv = gv_fetchpv ("CFPlus::UI::Base::draw_x", 1, SVt_NV); - draw_y_gv = gv_fetchpv ("CFPlus::UI::Base::draw_y", 1, SVt_NV); - draw_w_gv = gv_fetchpv ("CFPlus::UI::Base::draw_w", 1, SVt_NV); - draw_h_gv = gv_fetchpv ("CFPlus::UI::Base::draw_h", 1, SVt_NV); + draw_x_gv = gv_fetchpv ("DC::UI::Base::draw_x", 1, SVt_NV); + draw_y_gv = gv_fetchpv ("DC::UI::Base::draw_y", 1, SVt_NV); + draw_w_gv = gv_fetchpv ("DC::UI::Base::draw_w", 1, SVt_NV); + draw_h_gv = gv_fetchpv ("DC::UI::Base::draw_h", 1, SVt_NV); } void @@ -2859,12 +2924,12 @@ double draw_x, draw_y; if (!SvROK (self)) - croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); + croak ("DC::Base::draw: %s not a reference", SvPV_nolen (self)); hv = (HV *)SvRV (self); if (SvTYPE (hv) != SVt_PVHV) - croak ("CFPlus::Base::draw: %s not a hashref", SvPV_nolen (self)); + croak ("DC::Base::draw: %s not a hashref", SvPV_nolen (self)); svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.; @@ -2907,19 +2972,17 @@ } } #if 0 - if ($ENV{CFPLUS_DEBUG} & 1) { - glPushMatrix; - glColor 1, 1, 0, 1; - glTranslate 0.375, 0.375; - glBegin GL_LINE_LOOP; - glVertex 0 , 0; - glVertex $self->{w} - 1, 0; - glVertex $self->{w} - 1, $self->{h} - 1; - glVertex 0 , $self->{h} - 1; - glEnd; - glPopMatrix; - #CFPlus::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; - } + // draw borders, for debugging + glPushMatrix (); + glColor4f (1., 1., 0., 1.); + glTranslatef (.5, .5, 0.); + glBegin (GL_LINE_LOOP); + glVertex2f (0 , 0); + glVertex2f (w - 1, 0); + glVertex2f (w - 1, h - 1); + glVertex2f (0 , h - 1); + glEnd (); + glPopMatrix (); #endif PUSHMARK (SP); XPUSHs (self);