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.229 by root, Mon Aug 13 16:20:17 2007 UTC vs.
Revision 1.260 by root, Tue May 20 20:29:47 2008 UTC

46 46
47#include <glib/gmacros.h> 47#include <glib/gmacros.h>
48 48
49#include <pango/pango.h> 49#include <pango/pango.h>
50 50
51#ifndef PANGO_VERSION_CHECK
52# define PANGO_VERSION_CHECK(a,b,c) 0
53#endif
54
55#if !PANGO_VERSION_CHECK (1, 15, 2)
56# define pango_layout_get_line_readonly pango_layout_get_line
57# define pango_layout_get_lines_readonly pango_layout_get_lines
58# define pango_layout_iter_get_line_readonly pango_layout_iter_get_line
59# define pango_layout_iter_get_run_readonly pango_layout_iter_get_run
60#endif
61
51#ifndef _WIN32 62#ifndef _WIN32
52# include <sys/types.h> 63# include <sys/types.h>
53# include <sys/socket.h> 64# include <sys/socket.h>
54# include <netinet/in.h> 65# include <netinet/in.h>
55# include <netinet/tcp.h> 66# include <netinet/tcp.h>
63#define MAP_EXTEND_X 32 74#define MAP_EXTEND_X 32
64#define MAP_EXTEND_Y 512 75#define MAP_EXTEND_Y 512
65 76
66#define MIN_FONT_HEIGHT 10 77#define MIN_FONT_HEIGHT 10
67 78
79/* mask out modifiers we are not interested in */
80#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META)
81
68#if 0 82#if 0
69# define PARACHUTE SDL_INIT_NOPARACHUTE 83# define PARACHUTE SDL_INIT_NOPARACHUTE
70#else 84#else
71# define PARACHUTE 0 85# define PARACHUTE 0
72#endif 86#endif
120 134
121#include "pango-font.c" 135#include "pango-font.c"
122#include "pango-fontmap.c" 136#include "pango-fontmap.c"
123#include "pango-render.c" 137#include "pango-render.c"
124 138
125typedef IV CFPlus__Channel; 139typedef IV DC__Channel;
126typedef SDL_RWops *CFPlus__RW; 140typedef SDL_RWops *DC__RW;
127typedef Mix_Chunk *CFPlus__MixChunk; 141typedef Mix_Chunk *DC__MixChunk;
128typedef Mix_Music *CFPlus__MixMusic; 142typedef Mix_Music *DC__MixMusic;
129 143
130typedef PangoFontDescription *CFPlus__Font; 144typedef PangoFontDescription *DC__Font;
131 145
132static int 146static int
133shape_attr_p (PangoLayoutRun *run) 147shape_attr_p (PangoLayoutRun *run)
134{ 148{
135 GSList *attrs = run->item->analysis.extra_attrs; 149 GSList *attrs = run->item->analysis.extra_attrs;
149 163
150typedef struct cf_layout { 164typedef struct cf_layout {
151 PangoLayout *pl; 165 PangoLayout *pl;
152 float r, g, b, a; // default color for rgba mode 166 float r, g, b, a; // default color for rgba mode
153 int base_height; 167 int base_height;
154 CFPlus__Font font; 168 DC__Font font;
155 rc_t *rc; 169 rc_t *rc;
156} *CFPlus__Layout; 170} *DC__Layout;
157 171
158static CFPlus__Font default_font; 172static DC__Font default_font;
159static PangoContext *opengl_context; 173static PangoContext *opengl_context;
160static PangoFontMap *opengl_fontmap; 174static PangoFontMap *opengl_fontmap;
161 175
162static void 176static void
163substitute_func (FcPattern *pattern, gpointer data) 177substitute_func (FcPattern *pattern, gpointer data)
168#endif 182#endif
169 FcPatternAddBool (pattern, FC_AUTOHINT, 0); 183 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
170} 184}
171 185
172static void 186static void
173layout_update_font (CFPlus__Layout self) 187layout_update_font (DC__Layout self)
174{ 188{
175 /* use a random scale factor to account for unknown descenders, 0.8 works 189 /* use a random scale factor to account for unknown descenders, 0.8 works
176 * reasonably well with bitstream vera 190 * reasonably well with dejavu/bistream fonts
177 */ 191 */
178 PangoFontDescription *font = self->font ? self->font : default_font; 192 PangoFontDescription *font = self->font ? self->font : default_font;
179 193
180 pango_font_description_set_absolute_size (font, 194 pango_font_description_set_absolute_size (font,
181 MAX (MIN_FONT_HEIGHT, self->base_height) * (PANGO_SCALE * 8 / 10)); 195 MAX (MIN_FONT_HEIGHT, self->base_height) * (PANGO_SCALE * 8 / 10));
182 196
183 pango_layout_set_font_description (self->pl, font); 197 pango_layout_set_font_description (self->pl, font);
184} 198}
185 199
186static void 200static void
187layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) 201layout_get_pixel_size (DC__Layout self, int *w, int *h)
188{ 202{
189 PangoRectangle rect; 203 PangoRectangle rect;
190 204
191 // get_pixel_* wrongly rounds down 205 // get_pixel_* wrongly rounds down
192 pango_layout_get_extents (self->pl, 0, &rect); 206 pango_layout_get_extents (self->pl, 0, &rect);
231 int faces; tileid *face2tile; // [faceid] 245 int faces; tileid *face2tile; // [faceid]
232 int texs; maptex *tex; // [tileid] 246 int texs; maptex *tex; // [tileid]
233 247
234 int32_t rows; 248 int32_t rows;
235 maprow *row; 249 maprow *row;
236} *CFPlus__Map; 250} *DC__Map;
237 251
238static char * 252static char *
239prepend (char *ptr, int sze, int inc) 253prepend (char *ptr, int sze, int inc)
240{ 254{
241 char *p; 255 char *p;
279 self->texs *= 2; 293 self->texs *= 2;
280 } 294 }
281} 295}
282 296
283static maprow * 297static maprow *
284map_get_row (CFPlus__Map self, int y) 298map_get_row (DC__Map self, int y)
285{ 299{
286 if (0 > y) 300 if (0 > y)
287 { 301 {
288 int extend = - y + MAP_EXTEND_Y; 302 int extend = - y + MAP_EXTEND_Y;
289 Prepend (maprow, self->row, self->rows, extend); 303 Prepend (maprow, self->row, self->rows, extend);
327 341
328 return row->col + (x - row->c0); 342 return row->col + (x - row->c0);
329} 343}
330 344
331static mapcell * 345static mapcell *
332map_get_cell (CFPlus__Map self, int x, int y) 346map_get_cell (DC__Map self, int x, int y)
333{ 347{
334 return row_get_cell (map_get_row (self, y), x); 348 return row_get_cell (map_get_row (self, y), x);
335} 349}
336 350
337static void 351static void
338map_clear (CFPlus__Map self) 352map_clear (DC__Map self)
339{ 353{
340 int r; 354 int r;
341 355
342 for (r = 0; r < self->rows; r++) 356 for (r = 0; r < self->rows; r++)
343 Safefree (self->row[r].col); 357 Safefree (self->row[r].col);
351 self->row = 0; 365 self->row = 0;
352 self->rows = 0; 366 self->rows = 0;
353} 367}
354 368
355static void 369static void
356map_blank (CFPlus__Map self, int x0, int y0, int w, int h) 370map_blank (DC__Map self, int x0, int y0, int w, int h)
357{ 371{
358 int x, y; 372 int x, y;
359 maprow *row; 373 maprow *row;
360 mapcell *cell; 374 mapcell *cell;
361 375
440 n |= n >> 16; 454 n |= n >> 16;
441 455
442 return n + 1; 456 return n + 1;
443} 457}
444 458
459static unsigned int
460popcount (unsigned int n)
461{
462 n -= (n >> 1) & 0x55555555U;
463 n = ((n >> 2) & 0x33333333U) + (n & 0x33333333U);
464 n = ((n >> 4) + n) & 0x0f0f0f0fU;
465 n *= 0x01010101U;
466
467 return n >> 24;
468}
469
445/* SDL should provide this, really. */ 470/* SDL should provide this, really. */
446#define SDLK_MODIFIER_MIN 300 471#define SDLK_MODIFIER_MIN 300
447#define SDLK_MODIFIER_MAX 314 472#define SDLK_MODIFIER_MAX 314
448 473
449/******************************************************************************/ 474/******************************************************************************/
487 return 0; 512 return 0;
488 513
489 return 1; 514 return 1;
490} 515}
491 516
492MODULE = CFPlus PACKAGE = CFPlus 517MODULE = Deliantra::Client PACKAGE = DC
493 518
494PROTOTYPES: ENABLE 519PROTOTYPES: ENABLE
495 520
496BOOT: 521BOOT:
497{ 522{
498 HV *stash = gv_stashpv ("CFPlus", 1); 523 HV *stash = gv_stashpv ("DC", 1);
499 static const struct { 524 static const struct {
500 const char *name; 525 const char *name;
501 IV iv; 526 IV iv;
502 } *civ, const_iv[] = { 527 } *civ, const_iv[] = {
503# define const_iv(name) { # name, (IV)name } 528# define const_iv(name) { # name, (IV)name }
525 550
526 const_iv (SDL_APPINPUTFOCUS), 551 const_iv (SDL_APPINPUTFOCUS),
527 const_iv (SDL_APPMOUSEFOCUS), 552 const_iv (SDL_APPMOUSEFOCUS),
528 const_iv (SDL_APPACTIVE), 553 const_iv (SDL_APPACTIVE),
529 554
555 const_iv (SDLK_FIRST),
556 const_iv (SDLK_LAST),
530 const_iv (SDLK_KP0), 557 const_iv (SDLK_KP0),
531 const_iv (SDLK_KP1), 558 const_iv (SDLK_KP1),
532 const_iv (SDLK_KP2), 559 const_iv (SDLK_KP2),
533 const_iv (SDLK_KP3), 560 const_iv (SDLK_KP3),
534 const_iv (SDLK_KP4), 561 const_iv (SDLK_KP4),
606 const_iv (KMOD_LMETA), 633 const_iv (KMOD_LMETA),
607 const_iv (KMOD_RMETA), 634 const_iv (KMOD_RMETA),
608 const_iv (KMOD_NUM), 635 const_iv (KMOD_NUM),
609 const_iv (KMOD_CAPS), 636 const_iv (KMOD_CAPS),
610 const_iv (KMOD_MODE), 637 const_iv (KMOD_MODE),
638
639 const_iv (MIX_DEFAULT_FORMAT),
611# undef const_iv 640# undef const_iv
612 }; 641 };
613 642
614 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 643 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
615 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 644 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
633 662
634NV floor (NV x) 663NV floor (NV x)
635 664
636NV ceil (NV x) 665NV ceil (NV x)
637 666
667IV minpot (UV n)
668
669IV popcount (UV n)
670
638void 671void
639pango_init () 672pango_init ()
640 CODE: 673 CODE:
641{ 674{
642 opengl_fontmap = pango_opengl_font_map_new (); 675 opengl_fontmap = pango_opengl_font_map_new ();
643 pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0); 676 pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0);
644 opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap); 677 opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap);
678 /*pango_context_set_font_description (opengl_context, default_font);*/
679#if PANGO_VERSION_CHECK (1, 15, 2)
680 pango_context_set_language (opengl_context, pango_language_from_string ("en"));
681 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/
682#endif
645} 683}
646 684
647char * 685char *
648SDL_GetError () 686SDL_GetError ()
649 687
681 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); 719 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL);
682 720
683 if (m && m != (SDL_Rect **)-1) 721 if (m && m != (SDL_Rect **)-1)
684 while (*m) 722 while (*m)
685 { 723 {
686 if ((*m)->w >= 640 && (*m)->h >= 480) 724 if ((*m)->w >= 800 && (*m)->h >= 480)
687 { 725 {
688 AV *av = newAV (); 726 AV *av = newAV ();
689 av_push (av, newSViv ((*m)->w)); 727 av_push (av, newSViv ((*m)->w));
690 av_push (av, newSViv ((*m)->h)); 728 av_push (av, newSViv ((*m)->h));
691 av_push (av, newSViv (rgb)); 729 av_push (av, newSViv (rgb));
715 753
716 if (RETVAL) 754 if (RETVAL)
717 { 755 {
718 av_clear (texture_av); 756 av_clear (texture_av);
719 757
720 SDL_WM_SetCaption ("Crossfire TRT Client " VERSION, "Crossfire TRT"); 758 SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra");
721#define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); 759#define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name);
722#include "glfunc.h" 760#include "glfunc.h"
723#undef GL_FUNC 761#undef GL_FUNC
724 } 762 }
725} 763}
732char * 770char *
733SDL_GetKeyName (int sym) 771SDL_GetKeyName (int sym)
734 772
735int 773int
736SDL_GetAppState () 774SDL_GetAppState ()
775
776int
777SDL_GetModState ()
737 778
738void 779void
739poll_events () 780poll_events ()
740 PPCODE: 781 PPCODE:
741{ 782{
751 { 792 {
752 case SDL_KEYDOWN: 793 case SDL_KEYDOWN:
753 case SDL_KEYUP: 794 case SDL_KEYUP:
754 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 795 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
755 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 796 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
756 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); 797 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod & MOD_MASK), 0);
757 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState ()), 0); /* current mode */ 798 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState () & MOD_MASK), 0); /* current mode */
758 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 799 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
759 break; 800 break;
760 801
761 case SDL_ACTIVEEVENT: 802 case SDL_ACTIVEEVENT:
762 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 803 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
780 x = ev.motion.x; 821 x = ev.motion.x;
781 y = ev.motion.y; 822 y = ev.motion.y;
782 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION)); 823 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION));
783 } 824 }
784 825
785 hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); 826 hv_store (hv, "mod", 3, newSViv (SDL_GetModState () & MOD_MASK), 0);
786 hv_store (hv, "state", 5, newSViv (state), 0); 827 hv_store (hv, "state", 5, newSViv (state), 0);
787 hv_store (hv, "x", 1, newSViv (x), 0); 828 hv_store (hv, "x", 1, newSViv (x), 0);
788 hv_store (hv, "y", 1, newSViv (y), 0); 829 hv_store (hv, "y", 1, newSViv (y), 0);
789 hv_store (hv, "xrel", 4, newSViv (xrel), 0); 830 hv_store (hv, "xrel", 4, newSViv (xrel), 0);
790 hv_store (hv, "yrel", 4, newSViv (yrel), 0); 831 hv_store (hv, "yrel", 4, newSViv (yrel), 0);
791 } 832 }
792 break; 833 break;
793 834
794 case SDL_MOUSEBUTTONDOWN: 835 case SDL_MOUSEBUTTONDOWN:
795 case SDL_MOUSEBUTTONUP: 836 case SDL_MOUSEBUTTONUP:
796 hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); 837 hv_store (hv, "mod", 3, newSViv (SDL_GetModState () & MOD_MASK), 0);
797 838
798 hv_store (hv, "button", 6, newSViv (ev.button.button), 0); 839 hv_store (hv, "button", 6, newSViv (ev.button.button), 0);
799 hv_store (hv, "state", 5, newSViv (ev.button.state), 0); 840 hv_store (hv, "state", 5, newSViv (ev.button.state), 0);
800 hv_store (hv, "x", 1, newSViv (ev.button.x), 0); 841 hv_store (hv, "x", 1, newSViv (ev.button.x), 0);
801 hv_store (hv, "y", 1, newSViv (ev.button.y), 0); 842 hv_store (hv, "y", 1, newSViv (ev.button.y), 0);
806 hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); 847 hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0);
807 hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); 848 hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0);
808 break; 849 break;
809 } 850 }
810 851
811 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); 852 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1))));
812 } 853 }
813} 854}
814 855
815int 856int
816Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 1024) 857Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096)
817 POSTCALL: 858 POSTCALL:
818 Mix_HookMusicFinished (music_finished); 859 Mix_HookMusicFinished (music_finished);
819 Mix_ChannelFinished (channel_finished); 860 Mix_ChannelFinished (channel_finished);
861
862void
863Mix_QuerySpec ()
864 PPCODE:
865{
866 int freq, channels;
867 Uint16 format;
868
869 if (Mix_QuerySpec (&freq, &format, &channels))
870 {
871 EXTEND (SP, 3);
872 PUSHs (sv_2mortal (newSViv (freq)));
873 PUSHs (sv_2mortal (newSViv (format)));
874 PUSHs (sv_2mortal (newSViv (channels)));
875 }
876}
820 877
821void 878void
822Mix_CloseAudio () 879Mix_CloseAudio ()
823 880
824int 881int
859 } 916 }
860 } 917 }
861#endif 918#endif
862} 919}
863 920
864void 921int
865add_font (char *file) 922add_font (char *file)
866 CODE: 923 CODE:
867 FcConfigAppFontAddFile (0, (const FcChar8 *)file); 924 RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file);
925 OUTPUT:
926 RETVAL
868 927
869void 928void
870load_image_inline (SV *image_) 929load_image_inline (SV *image_)
871 ALIAS: 930 ALIAS:
872 load_image_file = 1 931 load_image_file = 1
958void 1017void
959error (char *message) 1018error (char *message)
960 CODE: 1019 CODE:
961 fprintf (stderr, "ERROR: %s\n", message); 1020 fprintf (stderr, "ERROR: %s\n", message);
962#ifdef _WIN32 1021#ifdef _WIN32
963 MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR); 1022 MessageBox (0, message, "Deliantra Client Error", MB_OK | MB_ICONERROR);
964#endif 1023#endif
965 1024
966void 1025void
967fatal (char *message) 1026fatal (char *message)
968 CODE: 1027 CODE:
969 fprintf (stderr, "FATAL: %s\n", message); 1028 fprintf (stderr, "FATAL: %s\n", message);
970#ifdef _WIN32 1029#ifdef _WIN32
971 MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); 1030 MessageBox (0, message, "Deliantra Client Fatal Error", MB_OK | MB_ICONERROR);
972#endif 1031#endif
973 _exit (1); 1032 _exit (1);
974 1033
975void 1034void
976_exit (int retval = 0) 1035_exit (int retval = 0)
988#if DEBUG 1047#if DEBUG
989 VALGRIND_DO_LEAK_CHECK; 1048 VALGRIND_DO_LEAK_CHECK;
990#endif 1049#endif
991} 1050}
992 1051
993MODULE = CFPlus PACKAGE = CFPlus::Font 1052MODULE = Deliantra::Client PACKAGE = DC::Font
994 1053
995PROTOTYPES: DISABLE 1054PROTOTYPES: DISABLE
996 1055
997CFPlus::Font 1056DC::Font
998new_from_file (SV *class, char *path, int id = 0) 1057new_from_file (SV *class, char *path, int id = 0)
999 CODE: 1058 CODE:
1000{ 1059{
1001 int count; 1060 int count;
1002 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); 1061 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count);
1005} 1064}
1006 OUTPUT: 1065 OUTPUT:
1007 RETVAL 1066 RETVAL
1008 1067
1009void 1068void
1010DESTROY (CFPlus::Font self) 1069DESTROY (DC::Font self)
1011 CODE: 1070 CODE:
1012 pango_font_description_free (self); 1071 pango_font_description_free (self);
1013 1072
1014void 1073void
1015make_default (CFPlus::Font self) 1074make_default (DC::Font self)
1016 PROTOTYPE: $ 1075 PROTOTYPE: $
1017 CODE: 1076 CODE:
1018 default_font = self; 1077 default_font = self;
1019 1078
1020MODULE = CFPlus PACKAGE = CFPlus::Layout 1079MODULE = Deliantra::Client PACKAGE = DC::Layout
1021 1080
1022PROTOTYPES: DISABLE 1081PROTOTYPES: DISABLE
1023 1082
1024void 1083void
1025reset_glyph_cache () 1084glyph_cache_backup ()
1026 PROTOTYPE: 1085 PROTOTYPE:
1027 CODE: 1086 CODE:
1087 tc_backup ();
1088
1089void
1090glyph_cache_restore ()
1091 PROTOTYPE:
1092 CODE:
1028 tc_clear (); 1093 tc_restore ();
1029 1094
1030CFPlus::Layout 1095DC::Layout
1031new (SV *class) 1096new (SV *class)
1032 CODE: 1097 CODE:
1033 New (0, RETVAL, 1, struct cf_layout); 1098 New (0, RETVAL, 1, struct cf_layout);
1034 1099
1035 RETVAL->pl = pango_layout_new (opengl_context); 1100 RETVAL->pl = pango_layout_new (opengl_context);
1045 layout_update_font (RETVAL); 1110 layout_update_font (RETVAL);
1046 OUTPUT: 1111 OUTPUT:
1047 RETVAL 1112 RETVAL
1048 1113
1049void 1114void
1050DESTROY (CFPlus::Layout self) 1115DESTROY (DC::Layout self)
1051 CODE: 1116 CODE:
1052 g_object_unref (self->pl); 1117 g_object_unref (self->pl);
1053 rc_free (self->rc); 1118 rc_free (self->rc);
1054 Safefree (self); 1119 Safefree (self);
1055 1120
1056void 1121void
1057set_text (CFPlus::Layout self, SV *text_) 1122set_text (DC::Layout self, SV *text_)
1058 CODE: 1123 CODE:
1059{ 1124{
1060 STRLEN textlen; 1125 STRLEN textlen;
1061 char *text = SvPVutf8 (text_, textlen); 1126 char *text = SvPVutf8 (text_, textlen);
1062 1127
1063 pango_layout_set_text (self->pl, text, textlen); 1128 pango_layout_set_text (self->pl, text, textlen);
1064} 1129}
1065 1130
1066void 1131void
1067set_markup (CFPlus::Layout self, SV *text_) 1132set_markup (DC::Layout self, SV *text_)
1068 CODE: 1133 CODE:
1069{ 1134{
1070 STRLEN textlen; 1135 STRLEN textlen;
1071 char *text = SvPVutf8 (text_, textlen); 1136 char *text = SvPVutf8 (text_, textlen);
1072 1137
1073 pango_layout_set_markup (self->pl, text, textlen); 1138 pango_layout_set_markup (self->pl, text, textlen);
1074} 1139}
1075 1140
1076void 1141void
1077set_shapes (CFPlus::Layout self, ...) 1142set_shapes (DC::Layout self, ...)
1078 CODE: 1143 CODE:
1079{ 1144{
1080 PangoAttrList *attrs = 0; 1145 PangoAttrList *attrs = 0;
1081 const char *text = pango_layout_get_text (self->pl); 1146 const char *text = pango_layout_get_text (self->pl);
1082 const char *pos = text; 1147 const char *pos = text;
1117 if (attrs) 1182 if (attrs)
1118 pango_layout_set_attributes (self->pl, attrs); 1183 pango_layout_set_attributes (self->pl, attrs);
1119} 1184}
1120 1185
1121void 1186void
1122get_shapes (CFPlus::Layout self) 1187get_shapes (DC::Layout self)
1123 PPCODE: 1188 PPCODE:
1124{ 1189{
1125 PangoLayoutIter *iter = pango_layout_get_iter (self->pl); 1190 PangoLayoutIter *iter = pango_layout_get_iter (self->pl);
1126 1191
1127 do 1192 do
1128 { 1193 {
1129 PangoLayoutRun *run = pango_layout_iter_get_run (iter); 1194 PangoLayoutRun *run = pango_layout_iter_get_run_readonly (iter);
1130 1195
1131 if (run && shape_attr_p (run)) 1196 if (run && shape_attr_p (run))
1132 { 1197 {
1133 PangoRectangle extents; 1198 PangoRectangle extents;
1134 pango_layout_iter_get_run_extents (iter, 0, &extents); 1199 pango_layout_iter_get_run_extents (iter, 0, &extents);
1142 1207
1143 pango_layout_iter_free (iter); 1208 pango_layout_iter_free (iter);
1144} 1209}
1145 1210
1146int 1211int
1147has_wrapped (CFPlus::Layout self) 1212has_wrapped (DC::Layout self)
1148 CODE: 1213 CODE:
1149{ 1214{
1150 int lines = 1; 1215 int lines = 1;
1151 const char *text = pango_layout_get_text (self->pl); 1216 const char *text = pango_layout_get_text (self->pl);
1152 1217
1157} 1222}
1158 OUTPUT: 1223 OUTPUT:
1159 RETVAL 1224 RETVAL
1160 1225
1161SV * 1226SV *
1162get_text (CFPlus::Layout self) 1227get_text (DC::Layout self)
1163 CODE: 1228 CODE:
1164 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); 1229 RETVAL = newSVpv (pango_layout_get_text (self->pl), 0);
1165 sv_utf8_decode (RETVAL); 1230 sv_utf8_decode (RETVAL);
1166 OUTPUT: 1231 OUTPUT:
1167 RETVAL 1232 RETVAL
1168 1233
1169void 1234void
1170set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) 1235set_foreground (DC::Layout self, float r, float g, float b, float a = 1.)
1171 CODE: 1236 CODE:
1172 self->r = r; 1237 self->r = r;
1173 self->g = g; 1238 self->g = g;
1174 self->b = b; 1239 self->b = b;
1175 self->a = a; 1240 self->a = a;
1176 1241
1177void 1242void
1178set_font (CFPlus::Layout self, CFPlus::Font font = 0) 1243set_font (DC::Layout self, DC::Font font = 0)
1179 CODE: 1244 CODE:
1180 if (self->font != font) 1245 if (self->font != font)
1181 { 1246 {
1182 self->font = font; 1247 self->font = font;
1183 layout_update_font (self); 1248 layout_update_font (self);
1184 } 1249 }
1185 1250
1186void 1251void
1187set_height (CFPlus::Layout self, int base_height) 1252set_height (DC::Layout self, int base_height)
1188 CODE: 1253 CODE:
1189 if (self->base_height != base_height) 1254 if (self->base_height != base_height)
1190 { 1255 {
1191 self->base_height = base_height; 1256 self->base_height = base_height;
1192 layout_update_font (self); 1257 layout_update_font (self);
1193 } 1258 }
1194 1259
1195void 1260void
1196set_width (CFPlus::Layout self, int max_width = -1) 1261set_width (DC::Layout self, int max_width = -1)
1197 CODE: 1262 CODE:
1198 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); 1263 pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE);
1199 1264
1200void 1265void
1201set_indent (CFPlus::Layout self, int indent) 1266set_indent (DC::Layout self, int indent)
1202 CODE: 1267 CODE:
1203 pango_layout_set_indent (self->pl, indent * PANGO_SCALE); 1268 pango_layout_set_indent (self->pl, indent * PANGO_SCALE);
1204 1269
1205void 1270void
1206set_spacing (CFPlus::Layout self, int spacing) 1271set_spacing (DC::Layout self, int spacing)
1207 CODE: 1272 CODE:
1208 pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); 1273 pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE);
1209 1274
1210void 1275void
1211set_ellipsise (CFPlus::Layout self, int ellipsise) 1276set_ellipsise (DC::Layout self, int ellipsise)
1212 CODE: 1277 CODE:
1213 pango_layout_set_ellipsize (self->pl, 1278 pango_layout_set_ellipsize (self->pl,
1214 ellipsise == 1 ? PANGO_ELLIPSIZE_START 1279 ellipsise == 1 ? PANGO_ELLIPSIZE_START
1215 : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE 1280 : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE
1216 : ellipsise == 3 ? PANGO_ELLIPSIZE_END 1281 : ellipsise == 3 ? PANGO_ELLIPSIZE_END
1217 : PANGO_ELLIPSIZE_NONE 1282 : PANGO_ELLIPSIZE_NONE
1218 ); 1283 );
1219 1284
1220void 1285void
1221set_single_paragraph_mode (CFPlus::Layout self, int spm) 1286set_single_paragraph_mode (DC::Layout self, int spm)
1222 CODE: 1287 CODE:
1223 pango_layout_set_single_paragraph_mode (self->pl, !!spm); 1288 pango_layout_set_single_paragraph_mode (self->pl, !!spm);
1224 1289
1225void 1290void
1226size (CFPlus::Layout self) 1291size (DC::Layout self)
1227 PPCODE: 1292 PPCODE:
1228{ 1293{
1229 int w, h; 1294 int w, h;
1230 1295
1231 layout_get_pixel_size (self, &w, &h); 1296 layout_get_pixel_size (self, &w, &h);
1234 PUSHs (sv_2mortal (newSViv (w))); 1299 PUSHs (sv_2mortal (newSViv (w)));
1235 PUSHs (sv_2mortal (newSViv (h))); 1300 PUSHs (sv_2mortal (newSViv (h)));
1236} 1301}
1237 1302
1238int 1303int
1239descent (CFPlus::Layout self) 1304descent (DC::Layout self)
1240 CODE: 1305 CODE:
1241{ 1306{
1242 PangoRectangle rect; 1307 PangoRectangle rect;
1243 PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); 1308 PangoLayoutLine *line = pango_layout_get_line_readonly (self->pl, 0);
1244 pango_layout_line_get_pixel_extents (line, 0, &rect); 1309 pango_layout_line_get_pixel_extents (line, 0, &rect);
1245 RETVAL = PANGO_DESCENT (rect); 1310 RETVAL = PANGO_DESCENT (rect);
1246} 1311}
1247 OUTPUT: 1312 OUTPUT:
1248 RETVAL 1313 RETVAL
1249 1314
1250int 1315int
1251xy_to_index (CFPlus::Layout self, int x, int y) 1316xy_to_index (DC::Layout self, int x, int y)
1252 CODE: 1317 CODE:
1253{ 1318{
1254 int index, trailing; 1319 int index, trailing;
1255 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); 1320 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing);
1256 RETVAL = index + trailing; 1321 RETVAL = index + trailing;
1257} 1322}
1258 OUTPUT: 1323 OUTPUT:
1259 RETVAL 1324 RETVAL
1260 1325
1261void 1326void
1262cursor_pos (CFPlus::Layout self, int index) 1327cursor_pos (DC::Layout self, int index)
1263 PPCODE: 1328 PPCODE:
1264{ 1329{
1265 PangoRectangle strong_pos; 1330 PangoRectangle pos;
1266 pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); 1331 pango_layout_get_cursor_pos (self->pl, index, &pos, 0);
1267 1332
1268 EXTEND (SP, 3); 1333 EXTEND (SP, 3);
1269 PUSHs (sv_2mortal (newSViv (strong_pos.x / PANGO_SCALE))); 1334 PUSHs (sv_2mortal (newSViv (pos.x / PANGO_SCALE)));
1270 PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); 1335 PUSHs (sv_2mortal (newSViv (pos.y / PANGO_SCALE)));
1271 PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); 1336 PUSHs (sv_2mortal (newSViv (pos.height / PANGO_SCALE)));
1272} 1337}
1273 1338
1274void 1339void
1275index_to_line_x (CFPlus::Layout self, int index, int trailing = 0) 1340index_to_line_x (DC::Layout self, int index, int trailing = 0)
1276 PPCODE: 1341 PPCODE:
1277{ 1342{
1278 int line, x; 1343 int line, x;
1279 1344
1280 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); 1345 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x);
1346#if !PANGO_VERSION_CHECK (1, 17, 3)
1281 /* pango bug: line is between 1..numlines, not 0..numlines-1 */ 1347 /* pango bug: line is between 1..numlines, not 0..numlines-1 */
1282 1348 --line;
1349#endif
1283 EXTEND (SP, 2); 1350 EXTEND (SP, 2);
1284 PUSHs (sv_2mortal (newSViv (line - 1))); 1351 PUSHs (sv_2mortal (newSViv (line)));
1285 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); 1352 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE)));
1286} 1353}
1287 1354
1288void 1355void
1289line_x_to_index (CFPlus::Layout self, int line, int x) 1356line_x_to_index (DC::Layout self, int line, int x)
1290 PPCODE: 1357 PPCODE:
1291{ 1358{
1292 PangoLayoutLine *lp; 1359 PangoLayoutLine *lp;
1293 int index, trailing; 1360 int index, trailing;
1294 1361
1295 if (line < 0) 1362 if (line < 0)
1296 XSRETURN_EMPTY; 1363 XSRETURN_EMPTY;
1297 1364
1298 if (!(lp = pango_layout_get_line (self->pl, line))) 1365 if (!(lp = pango_layout_get_line_readonly (self->pl, line)))
1299 XSRETURN_EMPTY; /* do better */ 1366 XSRETURN_EMPTY; /* do better */
1300 1367
1301 pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing); 1368 pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing);
1302 1369
1303 EXTEND (SP, 2); 1370 EXTEND (SP, 2);
1309 PUSHs (sv_2mortal (newSViv (trailing))); 1376 PUSHs (sv_2mortal (newSViv (trailing)));
1310 } 1377 }
1311} 1378}
1312 1379
1313void 1380void
1314render (CFPlus::Layout self, float x, float y, int flags = 0) 1381render (DC::Layout self, float x, float y, int flags = 0)
1315 CODE: 1382 CODE:
1316 rc_clear (self->rc); 1383 rc_clear (self->rc);
1317 pango_opengl_render_layout_subpixel ( 1384 pango_opengl_render_layout_subpixel (
1318 self->pl, 1385 self->pl,
1319 self->rc, 1386 self->rc,
1324 // we assume that context_change actually clears/frees stuff 1391 // we assume that context_change actually clears/frees stuff
1325 // and does not do any recomputation... 1392 // and does not do any recomputation...
1326 pango_layout_context_changed (self->pl); 1393 pango_layout_context_changed (self->pl);
1327 1394
1328void 1395void
1329draw (CFPlus::Layout self) 1396draw (DC::Layout self)
1330 CODE: 1397 CODE:
1331{ 1398{
1332 glEnable (GL_TEXTURE_2D); 1399 glEnable (GL_TEXTURE_2D);
1333 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 1400 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
1334 glEnable (GL_BLEND); 1401 glEnable (GL_BLEND);
1342 glDisable (GL_ALPHA_TEST); 1409 glDisable (GL_ALPHA_TEST);
1343 glDisable (GL_BLEND); 1410 glDisable (GL_BLEND);
1344 glDisable (GL_TEXTURE_2D); 1411 glDisable (GL_TEXTURE_2D);
1345} 1412}
1346 1413
1347MODULE = CFPlus PACKAGE = CFPlus::Texture 1414MODULE = Deliantra::Client PACKAGE = DC::Texture
1348 1415
1349PROTOTYPES: ENABLE 1416PROTOTYPES: ENABLE
1350
1351int minpot (int n)
1352 1417
1353void 1418void
1354pad (SV *data_, int ow, int oh, int nw, int nh) 1419pad (SV *data_, int ow, int oh, int nw, int nh)
1355 CODE: 1420 CODE:
1356{ 1421{
1433 RETVAL = width > 0; 1498 RETVAL = width > 0;
1434} 1499}
1435 OUTPUT: 1500 OUTPUT:
1436 RETVAL 1501 RETVAL
1437 1502
1438MODULE = CFPlus PACKAGE = CFPlus::Map 1503MODULE = Deliantra::Client PACKAGE = DC::Map
1439 1504
1440PROTOTYPES: DISABLE 1505PROTOTYPES: DISABLE
1441 1506
1442CFPlus::Map 1507DC::Map
1443new (SV *class) 1508new (SV *class)
1444 CODE: 1509 CODE:
1445 New (0, RETVAL, 1, struct map); 1510 New (0, RETVAL, 1, struct map);
1446 RETVAL->x = 0; 1511 RETVAL->x = 0;
1447 RETVAL->y = 0; 1512 RETVAL->y = 0;
1455 RETVAL->row = 0; 1520 RETVAL->row = 0;
1456 OUTPUT: 1521 OUTPUT:
1457 RETVAL 1522 RETVAL
1458 1523
1459void 1524void
1460DESTROY (CFPlus::Map self) 1525DESTROY (DC::Map self)
1461 CODE: 1526 CODE:
1462{ 1527{
1463 map_clear (self); 1528 map_clear (self);
1464 Safefree (self->face2tile); 1529 Safefree (self->face2tile);
1465 Safefree (self->tex); 1530 Safefree (self->tex);
1466 Safefree (self); 1531 Safefree (self);
1467} 1532}
1468 1533
1469void 1534void
1470resize (CFPlus::Map self, int map_width, int map_height) 1535resize (DC::Map self, int map_width, int map_height)
1471 CODE: 1536 CODE:
1472 self->w = map_width; 1537 self->w = map_width;
1473 self->h = map_height; 1538 self->h = map_height;
1474 1539
1475void 1540void
1476clear (CFPlus::Map self) 1541clear (DC::Map self)
1477 CODE: 1542 CODE:
1478 map_clear (self); 1543 map_clear (self);
1479 1544
1480void 1545void
1481set_tileid (CFPlus::Map self, int face, int tile) 1546set_tileid (DC::Map self, int face, int tile)
1482 CODE: 1547 CODE:
1483{ 1548{
1484 need_facenum (self, face); self->face2tile [face] = tile; 1549 need_facenum (self, face); self->face2tile [face] = tile;
1485 need_texid (self, tile); 1550 need_texid (self, tile);
1486} 1551}
1487 1552
1488void 1553void
1489set_smooth (CFPlus::Map self, int face, int smooth, int level) 1554set_smooth (DC::Map self, int face, int smooth, int level)
1490 CODE: 1555 CODE:
1491{ 1556{
1492 tileid texid; 1557 tileid texid;
1493 maptex *tex; 1558 maptex *tex;
1494 1559
1507 tex->smoothtile = self->face2tile [smooth]; 1572 tex->smoothtile = self->face2tile [smooth];
1508 tex->smoothlevel = level; 1573 tex->smoothlevel = level;
1509} 1574}
1510 1575
1511void 1576void
1512set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) 1577set_texture (DC::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a)
1513 CODE: 1578 CODE:
1514{ 1579{
1515 need_texid (self, texid); 1580 need_texid (self, texid);
1516 1581
1517 { 1582 {
1537 // from transparent color bleeding and ugly wrapping effects. 1602 // from transparent color bleeding and ugly wrapping effects.
1538 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1603 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1539} 1604}
1540 1605
1541int 1606int
1542ox (CFPlus::Map self) 1607ox (DC::Map self)
1543 ALIAS: 1608 ALIAS:
1544 oy = 1 1609 oy = 1
1545 x = 2 1610 x = 2
1546 y = 3 1611 y = 3
1547 w = 4 1612 w = 4
1558 } 1623 }
1559 OUTPUT: 1624 OUTPUT:
1560 RETVAL 1625 RETVAL
1561 1626
1562void 1627void
1563scroll (CFPlus::Map self, int dx, int dy) 1628scroll (DC::Map self, int dx, int dy)
1564 CODE: 1629 CODE:
1565{ 1630{
1566 if (dx > 0) 1631 if (dx > 0)
1567 map_blank (self, self->x, self->y, dx, self->h); 1632 map_blank (self, self->x, self->y, dx, self->h);
1568 else if (dx < 0) 1633 else if (dx < 0)
1584 self->y += MAP_EXTEND_Y; 1649 self->y += MAP_EXTEND_Y;
1585 } 1650 }
1586} 1651}
1587 1652
1588SV * 1653SV *
1589map1a_update (CFPlus::Map self, SV *data_, int extmap) 1654map1a_update (DC::Map self, SV *data_, int extmap)
1590 CODE: 1655 CODE:
1591{ 1656{
1592 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); 1657 uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_);
1593 uint8_t *data_end = (uint8_t *)SvEND (data_); 1658 uint8_t *data_end = (uint8_t *)SvEND (data_);
1594 mapcell *cell; 1659 mapcell *cell;
1683} 1748}
1684 OUTPUT: 1749 OUTPUT:
1685 RETVAL 1750 RETVAL
1686 1751
1687SV * 1752SV *
1688mapmap (CFPlus::Map self, int x0, int y0, int w, int h) 1753mapmap (DC::Map self, int x0, int y0, int w, int h)
1689 CODE: 1754 CODE:
1690{ 1755{
1691 int x1, x; 1756 int x1, x;
1692 int y1, y; 1757 int y1, y;
1693 int z; 1758 int z;
1738} 1803}
1739 OUTPUT: 1804 OUTPUT:
1740 RETVAL 1805 RETVAL
1741 1806
1742void 1807void
1743draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) 1808draw (DC::Map self, int mx, int my, int sw, int sh, int T)
1744 CODE: 1809 CODE:
1745{ 1810{
1746 int x, y, z; 1811 int x, y, z;
1747 1812
1748 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); 1813 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
2019 } 2084 }
2020 } 2085 }
2021} 2086}
2022 2087
2023void 2088void
2024draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) 2089draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data)
2025 CODE: 2090 CODE:
2026{ 2091{
2027 static float color[16][3] = { 2092 static float color[16][3] = {
2028 { 0.00F, 0.00F, 0.00F }, 2093 { 0.00F, 0.00F, 0.00F },
2029 { 1.00F, 1.00F, 1.00F }, 2094 { 1.00F, 1.00F, 1.00F },
2079 glDisable (GL_BLEND); 2144 glDisable (GL_BLEND);
2080 glDisable (GL_TEXTURE_2D); 2145 glDisable (GL_TEXTURE_2D);
2081} 2146}
2082 2147
2083void 2148void
2084fow_texture (CFPlus::Map self, int mx, int my, int sw, int sh) 2149fow_texture (DC::Map self, int mx, int my, int sw, int sh)
2085 PPCODE: 2150 PPCODE:
2086{ 2151{
2087 int x, y; 2152 int x, y;
2088 int sw1 = sw + 2; 2153 int sw1 = sw + 2;
2089 int sh1 = sh + 2; 2154 int sh1 = sh + 2;
2160 PUSHs (sv_2mortal (newSViv (sh3))); 2225 PUSHs (sv_2mortal (newSViv (sh3)));
2161 PUSHs (darkness3_sv); 2226 PUSHs (darkness3_sv);
2162} 2227}
2163 2228
2164SV * 2229SV *
2165get_rect (CFPlus::Map self, int x0, int y0, int w, int h) 2230get_rect (DC::Map self, int x0, int y0, int w, int h)
2166 CODE: 2231 CODE:
2167{ 2232{
2168 int x, y, x1, y1; 2233 int x, y, x1, y1;
2169 SV *data_sv = newSV (w * h * 7 + 5); 2234 SV *data_sv = newSV (w * h * 7 + 5);
2170 uint8_t *data = (uint8_t *)SvPVX (data_sv); 2235 uint8_t *data = (uint8_t *)SvPVX (data_sv);
2227 else 2292 else
2228 *data++ = 0; 2293 *data++ = 0;
2229 } 2294 }
2230 } 2295 }
2231 2296
2297 /* if size is w*h + 5 then no data has been found */
2298 if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5)
2299 {
2232 SvPOK_only (data_sv); 2300 SvPOK_only (data_sv);
2233 SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); 2301 SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv));
2302 }
2303
2234 RETVAL = data_sv; 2304 RETVAL = data_sv;
2235} 2305}
2236 OUTPUT: 2306 OUTPUT:
2237 RETVAL 2307 RETVAL
2238 2308
2239void 2309void
2240set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) 2310set_rect (DC::Map self, int x0, int y0, SV *data_sv)
2241 PPCODE: 2311 PPCODE:
2242{ 2312{
2243 int x, y, z; 2313 int x, y, z;
2244 int w, h; 2314 int w, h;
2245 int x1, y1; 2315 int x1, y1;
2316 STRLEN len;
2317 uint8_t *data, *end;
2318
2319 len = SvLEN (data_sv);
2320 SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more
2321 data = SvPVbyte_nolen (data_sv);
2322 end = data + len + 8;
2323
2324 if (len < 5)
2325 XSRETURN_EMPTY;
2246 2326
2247 if (*data++ != 0) 2327 if (*data++ != 0)
2248 XSRETURN_EMPTY; /* version mismatch */ 2328 XSRETURN_EMPTY; /* version mismatch */
2249 2329
2250 w = *data++ << 8; w |= *data++; 2330 w = *data++ << 8; w |= *data++;
2265 { 2345 {
2266 maprow *row = map_get_row (self, y); 2346 maprow *row = map_get_row (self, y);
2267 2347
2268 for (x = x0; x < x1; x++) 2348 for (x = x0; x < x1; x++)
2269 { 2349 {
2350 uint8_t flags;
2351
2352 if (data + 7 >= end)
2353 XSRETURN_EMPTY;
2354
2270 uint8_t flags = *data++; 2355 flags = *data++;
2271 2356
2272 if (flags) 2357 if (flags)
2273 { 2358 {
2274 mapcell *cell = row_get_cell (row, x); 2359 mapcell *cell = row_get_cell (row, x);
2275 tileid tile[3] = { 0, 0, 0 }; 2360 tileid tile[3] = { 0, 0, 0 };
2278 if (flags & 2) { tile[1] = *data++ << 8; tile[1] |= *data++; } 2363 if (flags & 2) { tile[1] = *data++ << 8; tile[1] |= *data++; }
2279 if (flags & 4) { tile[2] = *data++ << 8; tile[2] |= *data++; } 2364 if (flags & 4) { tile[2] = *data++ << 8; tile[2] |= *data++; }
2280 2365
2281 if (cell->darkness == 0) 2366 if (cell->darkness == 0)
2282 { 2367 {
2283 cell->darkness = 0; 2368 /*cell->darkness = 0;*/
2369 EXTEND (SP, 3);
2284 2370
2285 for (z = 0; z <= 2; z++) 2371 for (z = 0; z <= 2; z++)
2286 { 2372 {
2287 tileid t = tile [z]; 2373 tileid t = tile [z];
2288 2374
2289 if (t >= self->texs || (t && !self->tex [t].name)) 2375 if (t >= self->texs || (t && !self->tex [t].name))
2290 { 2376 {
2291 XPUSHs (sv_2mortal (newSViv (t))); 2377 PUSHs (sv_2mortal (newSViv (t)));
2292 need_texid (self, t); 2378 need_texid (self, t);
2293 } 2379 }
2294 2380
2295 cell->tile [z] = t; 2381 cell->tile [z] = t;
2296 } 2382 }
2298 } 2384 }
2299 } 2385 }
2300 } 2386 }
2301} 2387}
2302 2388
2303MODULE = CFPlus PACKAGE = CFPlus::RW 2389MODULE = Deliantra::Client PACKAGE = DC::RW
2304 2390
2305CFPlus::RW 2391DC::RW
2306new (SV *class, SV *data_sv) 2392new (SV *class, SV *data_sv)
2307 CODE: 2393 CODE:
2308{ 2394{
2309 STRLEN datalen; 2395 STRLEN datalen;
2310 char *data = SvPVbyte (data_sv, datalen); 2396 char *data = SvPVbyte (data_sv, datalen);
2312 RETVAL = SDL_RWFromConstMem (data, datalen); 2398 RETVAL = SDL_RWFromConstMem (data, datalen);
2313} 2399}
2314 OUTPUT: 2400 OUTPUT:
2315 RETVAL 2401 RETVAL
2316 2402
2317CFPlus::RW 2403DC::RW
2318new_from_file (SV *class, const char *path, const char *mode = "rb") 2404new_from_file (SV *class, const char *path, const char *mode = "rb")
2319 CODE: 2405 CODE:
2320 RETVAL = SDL_RWFromFile (path, mode); 2406 RETVAL = SDL_RWFromFile (path, mode);
2321 OUTPUT: 2407 OUTPUT:
2322 RETVAL 2408 RETVAL
2323 2409
2324# fails on win32: 2410# fails on win32:
2325# CFPlus.xs(2268) : error C2059: syntax error : '(' 2411# dc.xs(2268) : error C2059: syntax error : '('
2326#void 2412#void
2327#close (CFPlus::RW self) 2413#close (DC::RW self)
2328# CODE: 2414# CODE:
2329# (self->(close)) (self); 2415# (self->(close)) (self);
2330 2416
2331MODULE = CFPlus PACKAGE = CFPlus::Channel 2417MODULE = Deliantra::Client PACKAGE = DC::Channel
2332 2418
2333PROTOTYPES: DISABLE 2419PROTOTYPES: DISABLE
2334 2420
2335CFPlus::Channel 2421DC::Channel
2336find () 2422find ()
2337 CODE: 2423 CODE:
2338{ 2424{
2339 RETVAL = Mix_GroupAvailable (-1); 2425 RETVAL = Mix_GroupAvailable (-1);
2340 2426
2353} 2439}
2354 OUTPUT: 2440 OUTPUT:
2355 RETVAL 2441 RETVAL
2356 2442
2357void 2443void
2358halt (CFPlus::Channel self) 2444halt (DC::Channel self)
2359 CODE: 2445 CODE:
2360 Mix_HaltChannel (self); 2446 Mix_HaltChannel (self);
2361 2447
2362void 2448void
2363expire (CFPlus::Channel self, int ticks = -1) 2449expire (DC::Channel self, int ticks = -1)
2364 CODE: 2450 CODE:
2365 Mix_ExpireChannel (self, ticks); 2451 Mix_ExpireChannel (self, ticks);
2366 2452
2367void 2453void
2368fade_out (CFPlus::Channel self, int ticks = -1) 2454fade_out (DC::Channel self, int ticks = -1)
2369 CODE: 2455 CODE:
2370 Mix_FadeOutChannel (self, ticks); 2456 Mix_FadeOutChannel (self, ticks);
2371 2457
2372int 2458int
2373volume (CFPlus::Channel self, int volume) 2459volume (DC::Channel self, int volume)
2374 CODE: 2460 CODE:
2375 RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); 2461 RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128));
2376 OUTPUT: 2462 OUTPUT:
2377 RETVAL 2463 RETVAL
2378 2464
2379void 2465void
2380unregister_all_effects (CFPlus::Channel self) 2466unregister_all_effects (DC::Channel self)
2381 CODE: 2467 CODE:
2382 Mix_UnregisterAllEffects (self); 2468 Mix_UnregisterAllEffects (self);
2383 2469
2384void 2470void
2385set_panning (CFPlus::Channel self, int left, int right) 2471set_panning (DC::Channel self, int left, int right)
2386 CODE: 2472 CODE:
2387 left = CLAMP (left , 0, 255); 2473 left = CLAMP (left , 0, 255);
2388 right = CLAMP (right, 0, 255); 2474 right = CLAMP (right, 0, 255);
2389 Mix_SetPanning (self, left, right); 2475 Mix_SetPanning (self, left, right);
2390 2476
2391void 2477void
2392set_distance (CFPlus::Channel self, int distance) 2478set_distance (DC::Channel self, int distance)
2393 CODE: 2479 CODE:
2394 Mix_SetDistance (self, CLAMP (distance, 0, 255)); 2480 Mix_SetDistance (self, CLAMP (distance, 0, 255));
2395 2481
2396void 2482void
2397set_position (CFPlus::Channel self, int angle, int distance) 2483set_position (DC::Channel self, int angle, int distance)
2398 CODE: 2484 CODE:
2399 2485
2400void 2486void
2401set_position_r (CFPlus::Channel self, int dx, int dy, int maxdistance) 2487set_position_r (DC::Channel self, int dx, int dy, int maxdistance)
2402 CODE: 2488 CODE:
2403{ 2489{
2404 int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); 2490 int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance));
2405 int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); 2491 int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI);
2406 Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); 2492 Mix_SetPosition (self, angle, CLAMP (distance, 0, 255));
2407} 2493}
2408 2494
2409void 2495void
2410set_reverse_stereo (CFPlus::Channel self, int flip) 2496set_reverse_stereo (DC::Channel self, int flip)
2411 CODE: 2497 CODE:
2412 Mix_SetReverseStereo (self, flip); 2498 Mix_SetReverseStereo (self, flip);
2413 2499
2414MODULE = CFPlus PACKAGE = CFPlus::MixChunk 2500MODULE = Deliantra::Client PACKAGE = DC::MixChunk
2415 2501
2416PROTOTYPES: DISABLE 2502PROTOTYPES: DISABLE
2417 2503
2418CFPlus::MixChunk 2504DC::MixChunk
2419new (SV *class, CFPlus::RW rwops) 2505new (SV *class, DC::RW rwops)
2420 CODE: 2506 CODE:
2421 RETVAL = Mix_LoadWAV_RW (rwops, 1); 2507 RETVAL = Mix_LoadWAV_RW (rwops, 1);
2422 OUTPUT: 2508 OUTPUT:
2423 RETVAL 2509 RETVAL
2424 2510
2425void 2511void
2426DESTROY (CFPlus::MixChunk self) 2512DESTROY (DC::MixChunk self)
2427 CODE: 2513 CODE:
2428 Mix_FreeChunk (self); 2514 Mix_FreeChunk (self);
2429 2515
2430int 2516int
2431volume (CFPlus::MixChunk self, int volume = -1) 2517volume (DC::MixChunk self, int volume = -1)
2432 CODE: 2518 CODE:
2433 if (items > 1) 2519 if (items > 1)
2434 volume = CLAMP (volume, 0, 128); 2520 volume = CLAMP (volume, 0, 128);
2435 RETVAL = Mix_VolumeChunk (self, volume); 2521 RETVAL = Mix_VolumeChunk (self, volume);
2436 OUTPUT: 2522 OUTPUT:
2437 RETVAL 2523 RETVAL
2438 2524
2439CFPlus::Channel 2525DC::Channel
2440play (CFPlus::MixChunk self, CFPlus::Channel channel = -1, int loops = 0, int ticks = -1) 2526play (DC::MixChunk self, DC::Channel channel = -1, int loops = 0, int ticks = -1)
2441 CODE: 2527 CODE:
2442{ 2528{
2443 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); 2529 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks);
2444 2530
2445 if (RETVAL < 0) 2531 if (RETVAL < 0)
2452 } 2538 }
2453} 2539}
2454 OUTPUT: 2540 OUTPUT:
2455 RETVAL 2541 RETVAL
2456 2542
2457MODULE = CFPlus PACKAGE = CFPlus::MixMusic 2543MODULE = Deliantra::Client PACKAGE = DC::MixMusic
2458 2544
2459int 2545int
2460volume (int volume = -1) 2546volume (int volume = -1)
2461 PROTOTYPE: ;$ 2547 PROTOTYPE: ;$
2462 CODE: 2548 CODE:
2474void 2560void
2475halt () 2561halt ()
2476 CODE: 2562 CODE:
2477 Mix_HaltMusic (); 2563 Mix_HaltMusic ();
2478 2564
2479CFPlus::MixMusic 2565DC::MixMusic
2480new (SV *class, CFPlus::RW rwops) 2566new (SV *class, DC::RW rwops)
2481 CODE: 2567 CODE:
2482 RETVAL = Mix_LoadMUS_RW (rwops); 2568 RETVAL = Mix_LoadMUS_RW (rwops);
2483 OUTPUT: 2569 OUTPUT:
2484 RETVAL 2570 RETVAL
2485 2571
2486void 2572void
2487DESTROY (CFPlus::MixMusic self) 2573DESTROY (DC::MixMusic self)
2488 CODE: 2574 CODE:
2489 Mix_FreeMusic (self); 2575 Mix_FreeMusic (self);
2490 2576
2491int 2577int
2492play (CFPlus::MixMusic self, int loops = -1) 2578play (DC::MixMusic self, int loops = -1)
2493 CODE: 2579 CODE:
2494 RETVAL = Mix_PlayMusic (self, loops); 2580 RETVAL = Mix_PlayMusic (self, loops);
2495 OUTPUT: 2581 OUTPUT:
2496 RETVAL 2582 RETVAL
2497 2583
2498void 2584void
2499fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) 2585fade_in_pos (DC::MixMusic self, int loops, int ms, double position)
2500 CODE: 2586 CODE:
2501 Mix_FadeInMusicPos (self, loops, ms, position); 2587 Mix_FadeInMusicPos (self, loops, ms, position);
2502 2588
2503MODULE = CFPlus PACKAGE = CFPlus::OpenGL 2589MODULE = Deliantra::Client PACKAGE = DC::OpenGL
2504 2590
2505PROTOTYPES: ENABLE 2591PROTOTYPES: ENABLE
2506 2592
2507BOOT: 2593BOOT:
2508{ 2594{
2509 HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); 2595 HV *stash = gv_stashpv ("DC::OpenGL", 1);
2510 static const struct { 2596 static const struct {
2511 const char *name; 2597 const char *name;
2512 IV iv; 2598 IV iv;
2513 } *civ, const_iv[] = { 2599 } *civ, const_iv[] = {
2514# define const_iv(name) { # name, (IV)name } 2600# define const_iv(name) { # name, (IV)name }
2549 const_iv (GL_INTENSITY), 2635 const_iv (GL_INTENSITY),
2550 const_iv (GL_LUMINANCE), 2636 const_iv (GL_LUMINANCE),
2551 const_iv (GL_LUMINANCE_ALPHA), 2637 const_iv (GL_LUMINANCE_ALPHA),
2552 const_iv (GL_FLOAT), 2638 const_iv (GL_FLOAT),
2553 const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), 2639 const_iv (GL_UNSIGNED_INT_8_8_8_8_REV),
2640 const_iv (GL_COMPRESSED_ALPHA_ARB),
2641 const_iv (GL_COMPRESSED_LUMINANCE_ARB),
2642 const_iv (GL_COMPRESSED_LUMINANCE_ALPHA_ARB),
2643 const_iv (GL_COMPRESSED_INTENSITY_ARB),
2644 const_iv (GL_COMPRESSED_RGB_ARB),
2645 const_iv (GL_COMPRESSED_RGBA_ARB),
2554 const_iv (GL_COMPILE), 2646 const_iv (GL_COMPILE),
2555 const_iv (GL_PROXY_TEXTURE_1D), 2647 const_iv (GL_PROXY_TEXTURE_1D),
2556 const_iv (GL_PROXY_TEXTURE_2D), 2648 const_iv (GL_PROXY_TEXTURE_2D),
2557 const_iv (GL_TEXTURE_1D), 2649 const_iv (GL_TEXTURE_1D),
2558 const_iv (GL_TEXTURE_2D), 2650 const_iv (GL_TEXTURE_2D),
2597 const_iv (GL_PERSPECTIVE_CORRECTION_HINT), 2689 const_iv (GL_PERSPECTIVE_CORRECTION_HINT),
2598 const_iv (GL_POINT_SMOOTH_HINT), 2690 const_iv (GL_POINT_SMOOTH_HINT),
2599 const_iv (GL_LINE_SMOOTH_HINT), 2691 const_iv (GL_LINE_SMOOTH_HINT),
2600 const_iv (GL_POLYGON_SMOOTH_HINT), 2692 const_iv (GL_POLYGON_SMOOTH_HINT),
2601 const_iv (GL_GENERATE_MIPMAP_HINT), 2693 const_iv (GL_GENERATE_MIPMAP_HINT),
2694 const_iv (GL_TEXTURE_COMPRESSION_HINT),
2602 const_iv (GL_FASTEST), 2695 const_iv (GL_FASTEST),
2603 const_iv (GL_DONT_CARE), 2696 const_iv (GL_DONT_CARE),
2604 const_iv (GL_NICEST), 2697 const_iv (GL_NICEST),
2605 const_iv (GL_V2F), 2698 const_iv (GL_V2F),
2606 const_iv (GL_V3F), 2699 const_iv (GL_V3F),
2614 2707
2615 texture_av = newAV (); 2708 texture_av = newAV ();
2616 AvREAL_off (texture_av); 2709 AvREAL_off (texture_av);
2617} 2710}
2618 2711
2712void
2713disable_GL_EXT_blend_func_separate ()
2714 CODE:
2715 gl.BlendFuncSeparate = 0;
2716 gl.BlendFuncSeparateEXT = 0;
2717
2619char * 2718char *
2620gl_vendor () 2719gl_vendor ()
2621 CODE: 2720 CODE:
2622 RETVAL = (char *)glGetString (GL_VENDOR); 2721 RETVAL = (char *)glGetString (GL_VENDOR);
2623 OUTPUT: 2722 OUTPUT:
2744 2843
2745void glRect (float x1, float y1, float x2, float y2) 2844void glRect (float x1, float y1, float x2, float y2)
2746 CODE: 2845 CODE:
2747 glRectf (x1, y1, x2, y2); 2846 glRectf (x1, y1, x2, y2);
2748 2847
2848void glRect_lineloop (float x1, float y1, float x2, float y2)
2849 CODE:
2850 glBegin (GL_LINE_LOOP);
2851 glVertex2f (x1, y1);
2852 glVertex2f (x2, y1);
2853 glVertex2f (x2, y2);
2854 glVertex2f (x1, y2);
2855 glEnd ();
2856
2749PROTOTYPES: ENABLE 2857PROTOTYPES: ENABLE
2750 2858
2751void glBegin (int mode) 2859void glBegin (int mode)
2752 2860
2753void glEnd () 2861void glEnd ()
2785void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column) 2893void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column)
2786 CODE: 2894 CODE:
2787 if (gl.SeparableFilter2D) 2895 if (gl.SeparableFilter2D)
2788 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column); 2896 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column);
2789 2897
2790void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) 2898void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data = 0)
2791 2899
2792void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) 2900void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
2793 2901
2794void glDrawPixels (int width, int height, int format, int type, char *pixels) 2902void glDrawPixels (int width, int height, int format, int type, char *pixels)
2795 2903
2821 2929
2822void glEndList () 2930void glEndList ()
2823 2931
2824void glCallList (int list) 2932void glCallList (int list)
2825 2933
2826MODULE = CFPlus PACKAGE = CFPlus::UI::Base 2934MODULE = Deliantra::Client PACKAGE = DC::UI::Base
2827 2935
2828PROTOTYPES: DISABLE 2936PROTOTYPES: DISABLE
2829 2937
2830void 2938void
2831find_widget (SV *self, NV x, NV y) 2939find_widget (SV *self, NV x, NV y)
2835 XPUSHs (self); 2943 XPUSHs (self);
2836} 2944}
2837 2945
2838BOOT: 2946BOOT:
2839{ 2947{
2840 hover_gv = gv_fetchpv ("CFPlus::UI::HOVER", 1, SVt_NV); 2948 hover_gv = gv_fetchpv ("DC::UI::HOVER", 1, SVt_NV);
2841 2949
2842 draw_x_gv = gv_fetchpv ("CFPlus::UI::Base::draw_x", 1, SVt_NV); 2950 draw_x_gv = gv_fetchpv ("DC::UI::Base::draw_x", 1, SVt_NV);
2843 draw_y_gv = gv_fetchpv ("CFPlus::UI::Base::draw_y", 1, SVt_NV); 2951 draw_y_gv = gv_fetchpv ("DC::UI::Base::draw_y", 1, SVt_NV);
2844 draw_w_gv = gv_fetchpv ("CFPlus::UI::Base::draw_w", 1, SVt_NV); 2952 draw_w_gv = gv_fetchpv ("DC::UI::Base::draw_w", 1, SVt_NV);
2845 draw_h_gv = gv_fetchpv ("CFPlus::UI::Base::draw_h", 1, SVt_NV); 2953 draw_h_gv = gv_fetchpv ("DC::UI::Base::draw_h", 1, SVt_NV);
2846} 2954}
2847 2955
2848void 2956void
2849draw (SV *self) 2957draw (SV *self)
2850 CODE: 2958 CODE:
2857 SV *draw_w_sv = GvSV (draw_w_gv); 2965 SV *draw_w_sv = GvSV (draw_w_gv);
2858 SV *draw_h_sv = GvSV (draw_h_gv); 2966 SV *draw_h_sv = GvSV (draw_h_gv);
2859 double draw_x, draw_y; 2967 double draw_x, draw_y;
2860 2968
2861 if (!SvROK (self)) 2969 if (!SvROK (self))
2862 croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); 2970 croak ("DC::Base::draw: %s not a reference", SvPV_nolen (self));
2863 2971
2864 hv = (HV *)SvRV (self); 2972 hv = (HV *)SvRV (self);
2865 2973
2866 if (SvTYPE (hv) != SVt_PVHV) 2974 if (SvTYPE (hv) != SVt_PVHV)
2867 croak ("CFPlus::Base::draw: %s not a hashref", SvPV_nolen (self)); 2975 croak ("DC::Base::draw: %s not a hashref", SvPV_nolen (self));
2868 2976
2869 svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; 2977 svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.;
2870 svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.; 2978 svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.;
2871 2979
2872 if (!h || !w) 2980 if (!h || !w)
2905 glEnd (); 3013 glEnd ();
2906 glDisable (GL_BLEND); 3014 glDisable (GL_BLEND);
2907 } 3015 }
2908 } 3016 }
2909#if 0 3017#if 0
2910 if ($ENV{CFPLUS_DEBUG} & 1) { 3018 // draw borders, for debugging
2911 glPushMatrix; 3019 glPushMatrix ();
2912 glColor 1, 1, 0, 1; 3020 glColor4f (1., 1., 0., 1.);
2913 glTranslate 0.375, 0.375; 3021 glTranslatef (.5, .5, 0.);
2914 glBegin GL_LINE_LOOP; 3022 glBegin (GL_LINE_LOOP);
2915 glVertex 0 , 0; 3023 glVertex2f (0 , 0);
2916 glVertex $self->{w} - 1, 0; 3024 glVertex2f (w - 1, 0);
2917 glVertex $self->{w} - 1, $self->{h} - 1; 3025 glVertex2f (w - 1, h - 1);
2918 glVertex 0 , $self->{h} - 1; 3026 glVertex2f (0 , h - 1);
2919 glEnd; 3027 glEnd ();
2920 glPopMatrix; 3028 glPopMatrix ();
2921 #CFPlus::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw;
2922 }
2923#endif 3029#endif
2924 PUSHMARK (SP); 3030 PUSHMARK (SP);
2925 XPUSHs (self); 3031 XPUSHs (self);
2926 PUTBACK; 3032 PUTBACK;
2927 call_method ("_draw", G_VOID | G_DISCARD); 3033 call_method ("_draw", G_VOID | G_DISCARD);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines