1 | #ifdef _WIN32 |
1 | #ifdef _WIN32 |
|
|
2 | # define WIN32_LEAN_AND_MEAN |
2 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # include <malloc.h> |
4 | # include <malloc.h> |
4 | # include <windows.h> |
5 | # include <windows.h> |
5 | # pragma warning(disable:4244) |
6 | # pragma warning(disable:4244) |
6 | #endif |
7 | #endif |
7 | |
8 | |
8 | #include "EXTERN.h" |
9 | #include "EXTERN.h" |
9 | #include "perl.h" |
10 | #include "perl.h" |
10 | #include "XSUB.h" |
11 | #include "XSUB.h" |
|
|
12 | |
|
|
13 | #ifdef _WIN32 |
|
|
14 | # undef pipe |
|
|
15 | #endif |
11 | |
16 | |
12 | #include <math.h> |
17 | #include <math.h> |
13 | #include <string.h> |
18 | #include <string.h> |
14 | #include <stdio.h> |
19 | #include <stdio.h> |
15 | #include <stdlib.h> |
20 | #include <stdlib.h> |
… | |
… | |
40 | typedef signed char int8_t; |
45 | typedef signed char int8_t; |
41 | typedef signed short int16_t; |
46 | typedef signed short int16_t; |
42 | typedef signed int int32_t; |
47 | typedef signed int int32_t; |
43 | #endif |
48 | #endif |
44 | |
49 | |
45 | #include "glext.h" |
|
|
46 | |
|
|
47 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, objetc replacement character */ |
50 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, objetc replacement character */ |
48 | |
51 | |
49 | #define FOW_DARKNESS 32 |
52 | #define FOW_DARKNESS 32 |
50 | |
53 | |
51 | #define MAP_EXTEND_X 32 |
54 | #define MAP_EXTEND_X 32 |
52 | #define MAP_EXTEND_Y 512 |
55 | #define MAP_EXTEND_Y 512 |
53 | |
56 | |
54 | #define MIN_FONT_HEIGHT 10 |
57 | #define MIN_FONT_HEIGHT 10 |
55 | |
58 | |
56 | #if 1 |
59 | #if 0 |
57 | # define PARACHUTE SDL_INIT_NOPARACHUTE |
60 | # define PARACHUTE SDL_INIT_NOPARACHUTE |
58 | #else |
61 | #else |
59 | # define PARACHUTE 0 |
62 | # define PARACHUTE 0 |
60 | #endif |
63 | #endif |
61 | |
64 | |
… | |
… | |
80 | |
83 | |
81 | #include "pango-font.c" |
84 | #include "pango-font.c" |
82 | #include "pango-fontmap.c" |
85 | #include "pango-fontmap.c" |
83 | #include "pango-render.c" |
86 | #include "pango-render.c" |
84 | |
87 | |
85 | typedef Mix_Chunk *CFClient__MixChunk; |
88 | typedef Mix_Chunk *CFPlus__MixChunk; |
86 | typedef Mix_Music *CFClient__MixMusic; |
89 | typedef Mix_Music *CFPlus__MixMusic; |
87 | |
90 | |
88 | typedef PangoFontDescription *CFClient__Font; |
91 | typedef PangoFontDescription *CFPlus__Font; |
89 | |
92 | |
90 | static int |
93 | static int |
91 | shape_attr_p (PangoLayoutRun *run) |
94 | shape_attr_p (PangoLayoutRun *run) |
92 | { |
95 | { |
93 | GSList *attrs = run->item->analysis.extra_attrs; |
96 | GSList *attrs = run->item->analysis.extra_attrs; |
… | |
… | |
107 | |
110 | |
108 | typedef struct cf_layout { |
111 | typedef struct cf_layout { |
109 | PangoLayout *pl; |
112 | PangoLayout *pl; |
110 | float r, g, b, a; // default color for rgba mode |
113 | float r, g, b, a; // default color for rgba mode |
111 | int base_height; |
114 | int base_height; |
112 | CFClient__Font font; |
115 | CFPlus__Font font; |
113 | } *CFClient__Layout; |
116 | } *CFPlus__Layout; |
114 | |
117 | |
115 | static CFClient__Font default_font; |
118 | static CFPlus__Font default_font; |
116 | static PangoContext *opengl_context; |
119 | static PangoContext *opengl_context; |
117 | static PangoFontMap *opengl_fontmap; |
120 | static PangoFontMap *opengl_fontmap; |
118 | |
121 | |
119 | static void |
122 | static void |
120 | substitute_func (FcPattern *pattern, gpointer data) |
123 | substitute_func (FcPattern *pattern, gpointer data) |
… | |
… | |
125 | #endif |
128 | #endif |
126 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
129 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
127 | } |
130 | } |
128 | |
131 | |
129 | static void |
132 | static void |
130 | layout_update_font (CFClient__Layout self) |
133 | layout_update_font (CFPlus__Layout self) |
131 | { |
134 | { |
132 | /* use a random scale factor to account for unknown descenders, 0.8 works |
135 | /* use a random scale factor to account for unknown descenders, 0.8 works |
133 | * reasonably well with bitstream vera |
136 | * reasonably well with bitstream vera |
134 | */ |
137 | */ |
135 | PangoFontDescription *font = self->font ? self->font : default_font; |
138 | PangoFontDescription *font = self->font ? self->font : default_font; |
… | |
… | |
139 | |
142 | |
140 | pango_layout_set_font_description (self->pl, font); |
143 | pango_layout_set_font_description (self->pl, font); |
141 | } |
144 | } |
142 | |
145 | |
143 | static void |
146 | static void |
144 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
147 | layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) |
145 | { |
148 | { |
|
|
149 | PangoRectangle rect; |
|
|
150 | |
|
|
151 | // get_pixel_* wrongly rounds down |
146 | pango_layout_get_pixel_size (self->pl, w, h); |
152 | pango_layout_get_extents (self->pl, 0, &rect); |
147 | |
153 | |
148 | if (!*w) *w = 1; |
154 | rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE; |
149 | if (!*h) *h = 1; |
155 | rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE; |
150 | |
156 | |
151 | *w = (*w + 3) & ~3; |
157 | if (!rect.width) rect.width = 1; |
|
|
158 | if (!rect.height) rect.height = 1; |
|
|
159 | |
|
|
160 | rect.width = (rect.width + 3) & ~3; |
|
|
161 | |
|
|
162 | *w = rect.width; |
|
|
163 | *h = rect.height; |
152 | } |
164 | } |
153 | |
165 | |
154 | typedef uint16_t mapface; |
166 | typedef uint16_t mapface; |
155 | |
167 | |
156 | typedef struct { |
168 | typedef struct { |
… | |
… | |
179 | int texs; |
191 | int texs; |
180 | maptex *tex; |
192 | maptex *tex; |
181 | |
193 | |
182 | int32_t rows; |
194 | int32_t rows; |
183 | maprow *row; |
195 | maprow *row; |
184 | } *CFClient__Map; |
196 | } *CFPlus__Map; |
185 | |
197 | |
186 | static char * |
198 | static char * |
187 | prepend (char *ptr, int sze, int inc) |
199 | prepend (char *ptr, int sze, int inc) |
188 | { |
200 | { |
189 | char *p; |
201 | char *p; |
… | |
… | |
207 | |
219 | |
208 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
220 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
209 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
221 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
210 | |
222 | |
211 | static maprow * |
223 | static maprow * |
212 | map_get_row (CFClient__Map self, int y) |
224 | map_get_row (CFPlus__Map self, int y) |
213 | { |
225 | { |
214 | if (0 > y) |
226 | if (0 > y) |
215 | { |
227 | { |
216 | int extend = - y + MAP_EXTEND_Y; |
228 | int extend = - y + MAP_EXTEND_Y; |
217 | Prepend (maprow, self->row, self->rows, extend); |
229 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
255 | |
267 | |
256 | return row->col + (x - row->c0); |
268 | return row->col + (x - row->c0); |
257 | } |
269 | } |
258 | |
270 | |
259 | static mapcell * |
271 | static mapcell * |
260 | map_get_cell (CFClient__Map self, int x, int y) |
272 | map_get_cell (CFPlus__Map self, int x, int y) |
261 | { |
273 | { |
262 | return row_get_cell (map_get_row (self, y), x); |
274 | return row_get_cell (map_get_row (self, y), x); |
263 | } |
275 | } |
264 | |
276 | |
265 | static void |
277 | static void |
266 | map_clear (CFClient__Map self) |
278 | map_clear (CFPlus__Map self) |
267 | { |
279 | { |
268 | int r; |
280 | int r; |
269 | |
281 | |
270 | for (r = 0; r < self->rows; r++) |
282 | for (r = 0; r < self->rows; r++) |
271 | Safefree (self->row[r].col); |
283 | Safefree (self->row[r].col); |
… | |
… | |
279 | self->row = 0; |
291 | self->row = 0; |
280 | self->rows = 0; |
292 | self->rows = 0; |
281 | } |
293 | } |
282 | |
294 | |
283 | static void |
295 | static void |
284 | map_blank (CFClient__Map self, int x0, int y0, int w, int h) |
296 | map_blank (CFPlus__Map self, int x0, int y0, int w, int h) |
285 | { |
297 | { |
286 | int x, y; |
298 | int x, y; |
287 | maprow *row; |
299 | maprow *row; |
288 | |
300 | |
289 | for (y = y0; y < y0 + h; y++) |
301 | for (y = y0; y < y0 + h; y++) |
… | |
… | |
346 | n |= n >> 16; |
358 | n |= n >> 16; |
347 | |
359 | |
348 | return n + 1; |
360 | return n + 1; |
349 | } |
361 | } |
350 | |
362 | |
351 | MODULE = CFClient PACKAGE = CFClient |
363 | MODULE = CFPlus PACKAGE = CFPlus |
352 | |
364 | |
353 | PROTOTYPES: ENABLE |
365 | PROTOTYPES: ENABLE |
354 | |
366 | |
355 | BOOT: |
367 | BOOT: |
356 | { |
368 | { |
357 | HV *stash = gv_stashpv ("CFClient", 1); |
369 | HV *stash = gv_stashpv ("CFPlus", 1); |
358 | static const struct { |
370 | static const struct { |
359 | const char *name; |
371 | const char *name; |
360 | IV iv; |
372 | IV iv; |
361 | } *civ, const_iv[] = { |
373 | } *civ, const_iv[] = { |
362 | # define const_iv(name) { # name, (IV)name } |
374 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
463 | |
475 | |
464 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
476 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
465 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
477 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
466 | } |
478 | } |
467 | |
479 | |
|
|
480 | int |
|
|
481 | in_destruct () |
|
|
482 | CODE: |
|
|
483 | RETVAL = PL_main_cv == Nullcv; |
|
|
484 | OUTPUT: |
|
|
485 | RETVAL |
|
|
486 | |
468 | NV floor (NV x) |
487 | NV floor (NV x) |
469 | |
488 | |
470 | NV ceil (NV x) |
489 | NV ceil (NV x) |
471 | |
490 | |
472 | void |
491 | void |
… | |
… | |
502 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
521 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
503 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
522 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
504 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
523 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
505 | |
524 | |
506 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
525 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
|
|
526 | #if SDL_VERSION_ATLEAST(1,2,10) |
|
|
527 | SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1); |
|
|
528 | SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); |
|
|
529 | #endif |
507 | |
530 | |
508 | SDL_EnableUNICODE (1); |
531 | SDL_EnableUNICODE (1); |
509 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
532 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
510 | |
533 | |
511 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
534 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
… | |
… | |
598 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
621 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
599 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
622 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
600 | break; |
623 | break; |
601 | } |
624 | } |
602 | |
625 | |
603 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
626 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
604 | } |
627 | } |
605 | } |
628 | } |
606 | |
629 | |
607 | int |
630 | int |
608 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
631 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
… | |
… | |
624 | #endif |
647 | #endif |
625 | |
648 | |
626 | void |
649 | void |
627 | add_font (char *file) |
650 | add_font (char *file) |
628 | CODE: |
651 | CODE: |
629 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
652 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
630 | |
653 | |
631 | void |
654 | void |
632 | load_image_inline (SV *image_) |
655 | load_image_inline (SV *image_) |
633 | ALIAS: |
656 | ALIAS: |
634 | load_image_file = 1 |
657 | load_image_file = 1 |
… | |
… | |
676 | |
699 | |
677 | surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); |
700 | surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); |
678 | |
701 | |
679 | assert (surface2->pitch == surface2->w * 4); |
702 | assert (surface2->pitch == surface2->w * 4); |
680 | |
703 | |
|
|
704 | SDL_LockSurface (surface2); |
681 | EXTEND (SP, 5); |
705 | EXTEND (SP, 6); |
682 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
706 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
683 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
707 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
684 | SDL_LockSurface (surface2); |
|
|
685 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
708 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
686 | SDL_UnlockSurface (surface2); |
|
|
687 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
709 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
688 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
710 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
689 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
711 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
|
|
712 | SDL_UnlockSurface (surface2); |
690 | |
713 | |
691 | SDL_FreeSurface (surface); |
714 | SDL_FreeSurface (surface); |
692 | SDL_FreeSurface (surface2); |
715 | SDL_FreeSurface (surface2); |
693 | } |
716 | } |
694 | |
717 | |
… | |
… | |
737 | void |
760 | void |
738 | _exit (int retval) |
761 | _exit (int retval) |
739 | CODE: |
762 | CODE: |
740 | _exit (retval); |
763 | _exit (retval); |
741 | |
764 | |
742 | MODULE = CFClient PACKAGE = CFClient::Font |
765 | MODULE = CFPlus PACKAGE = CFPlus::Font |
743 | |
766 | |
744 | CFClient::Font |
767 | CFPlus::Font |
745 | new_from_file (SV *class, char *path, int id = 0) |
768 | new_from_file (SV *class, char *path, int id = 0) |
746 | CODE: |
769 | CODE: |
747 | { |
770 | { |
748 | int count; |
771 | int count; |
749 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
772 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
… | |
… | |
752 | } |
775 | } |
753 | OUTPUT: |
776 | OUTPUT: |
754 | RETVAL |
777 | RETVAL |
755 | |
778 | |
756 | void |
779 | void |
757 | DESTROY (CFClient::Font self) |
780 | DESTROY (CFPlus::Font self) |
758 | CODE: |
781 | CODE: |
759 | pango_font_description_free (self); |
782 | pango_font_description_free (self); |
760 | |
783 | |
761 | void |
784 | void |
762 | make_default (CFClient::Font self) |
785 | make_default (CFPlus::Font self) |
763 | CODE: |
786 | CODE: |
764 | default_font = self; |
787 | default_font = self; |
765 | |
788 | |
766 | MODULE = CFClient PACKAGE = CFClient::Layout |
789 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
767 | |
790 | |
768 | void |
791 | void |
769 | clear_font_cache () |
792 | reset_glyph_cache () |
770 | CODE: |
793 | CODE: |
771 | pango_fc_font_map_cache_clear ((PangoFcFontMap *)opengl_fontmap); |
|
|
772 | tc_clear (); |
794 | tc_clear (); |
773 | |
795 | |
774 | CFClient::Layout |
796 | CFPlus::Layout |
775 | new (SV *class, int type = 0) |
797 | new (SV *class) |
776 | CODE: |
798 | CODE: |
777 | New (0, RETVAL, 1, struct cf_layout); |
799 | New (0, RETVAL, 1, struct cf_layout); |
778 | |
800 | |
779 | RETVAL->pl = pango_layout_new (opengl_context); |
801 | RETVAL->pl = pango_layout_new (opengl_context); |
780 | RETVAL->r = 1.; |
802 | RETVAL->r = 1.; |
… | |
… | |
788 | layout_update_font (RETVAL); |
810 | layout_update_font (RETVAL); |
789 | OUTPUT: |
811 | OUTPUT: |
790 | RETVAL |
812 | RETVAL |
791 | |
813 | |
792 | void |
814 | void |
793 | DESTROY (CFClient::Layout self) |
815 | DESTROY (CFPlus::Layout self) |
794 | CODE: |
816 | CODE: |
795 | g_object_unref (self->pl); |
817 | g_object_unref (self->pl); |
796 | Safefree (self); |
818 | Safefree (self); |
797 | |
819 | |
798 | void |
820 | void |
799 | set_text (CFClient::Layout self, SV *text_) |
821 | set_text (CFPlus::Layout self, SV *text_) |
800 | CODE: |
822 | CODE: |
801 | { |
823 | { |
802 | STRLEN textlen; |
824 | STRLEN textlen; |
803 | char *text = SvPVutf8 (text_, textlen); |
825 | char *text = SvPVutf8 (text_, textlen); |
804 | |
826 | |
805 | pango_layout_set_text (self->pl, text, textlen); |
827 | pango_layout_set_text (self->pl, text, textlen); |
806 | } |
828 | } |
807 | |
829 | |
808 | void |
830 | void |
809 | set_markup (CFClient::Layout self, SV *text_) |
831 | set_markup (CFPlus::Layout self, SV *text_) |
810 | CODE: |
832 | CODE: |
811 | { |
833 | { |
812 | STRLEN textlen; |
834 | STRLEN textlen; |
813 | char *text = SvPVutf8 (text_, textlen); |
835 | char *text = SvPVutf8 (text_, textlen); |
814 | |
836 | |
815 | pango_layout_set_markup (self->pl, text, textlen); |
837 | pango_layout_set_markup (self->pl, text, textlen); |
816 | } |
838 | } |
817 | |
839 | |
818 | void |
840 | void |
819 | set_shapes (CFClient::Layout self, ...) |
841 | set_shapes (CFPlus::Layout self, ...) |
820 | CODE: |
842 | CODE: |
821 | { |
843 | { |
822 | PangoAttrList *attrs = 0; |
844 | PangoAttrList *attrs = 0; |
823 | const char *text = pango_layout_get_text (self->pl); |
845 | const char *text = pango_layout_get_text (self->pl); |
824 | const char *pos = text; |
846 | const char *pos = text; |
… | |
… | |
859 | if (attrs) |
881 | if (attrs) |
860 | pango_layout_set_attributes (self->pl, attrs); |
882 | pango_layout_set_attributes (self->pl, attrs); |
861 | } |
883 | } |
862 | |
884 | |
863 | void |
885 | void |
864 | get_shapes (CFClient::Layout self) |
886 | get_shapes (CFPlus::Layout self) |
865 | PPCODE: |
887 | PPCODE: |
866 | { |
888 | { |
867 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
889 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
868 | |
890 | |
869 | do |
891 | do |
… | |
… | |
873 | if (run && shape_attr_p (run)) |
895 | if (run && shape_attr_p (run)) |
874 | { |
896 | { |
875 | PangoRectangle extents; |
897 | PangoRectangle extents; |
876 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
898 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
877 | |
899 | |
|
|
900 | EXTEND (SP, 2); |
878 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); |
901 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); |
879 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); |
902 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); |
880 | } |
903 | } |
881 | } |
904 | } |
882 | while (pango_layout_iter_next_run (iter)); |
905 | while (pango_layout_iter_next_run (iter)); |
883 | |
906 | |
884 | pango_layout_iter_free (iter); |
907 | pango_layout_iter_free (iter); |
885 | } |
908 | } |
886 | |
909 | |
887 | int |
910 | int |
888 | has_wrapped (CFClient::Layout self) |
911 | has_wrapped (CFPlus::Layout self) |
889 | CODE: |
912 | CODE: |
890 | { |
913 | { |
891 | int lines = 1; |
914 | int lines = 1; |
892 | const char *text = pango_layout_get_text (self->pl); |
915 | const char *text = pango_layout_get_text (self->pl); |
893 | |
916 | |
… | |
… | |
898 | } |
921 | } |
899 | OUTPUT: |
922 | OUTPUT: |
900 | RETVAL |
923 | RETVAL |
901 | |
924 | |
902 | SV * |
925 | SV * |
903 | get_text (CFClient::Layout self) |
926 | get_text (CFPlus::Layout self) |
904 | CODE: |
927 | CODE: |
905 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
928 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
906 | sv_utf8_decode (RETVAL); |
929 | sv_utf8_decode (RETVAL); |
907 | OUTPUT: |
930 | OUTPUT: |
908 | RETVAL |
931 | RETVAL |
909 | |
932 | |
910 | void |
933 | void |
911 | set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) |
934 | set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) |
912 | CODE: |
935 | CODE: |
913 | self->r = r; |
936 | self->r = r; |
914 | self->g = g; |
937 | self->g = g; |
915 | self->b = b; |
938 | self->b = b; |
916 | self->a = a; |
939 | self->a = a; |
917 | |
940 | |
918 | void |
941 | void |
919 | set_font (CFClient::Layout self, CFClient::Font font = 0) |
942 | set_font (CFPlus::Layout self, CFPlus::Font font = 0) |
920 | CODE: |
943 | CODE: |
921 | if (self->font != font) |
944 | if (self->font != font) |
922 | { |
945 | { |
923 | self->font = font; |
946 | self->font = font; |
924 | layout_update_font (self); |
947 | layout_update_font (self); |
925 | } |
948 | } |
926 | |
949 | |
927 | void |
950 | void |
928 | set_height (CFClient::Layout self, int base_height) |
951 | set_height (CFPlus::Layout self, int base_height) |
929 | CODE: |
952 | CODE: |
930 | if (self->base_height != base_height) |
953 | if (self->base_height != base_height) |
931 | { |
954 | { |
932 | self->base_height = base_height; |
955 | self->base_height = base_height; |
933 | layout_update_font (self); |
956 | layout_update_font (self); |
934 | } |
957 | } |
935 | |
958 | |
936 | void |
959 | void |
937 | set_width (CFClient::Layout self, int max_width = -1) |
960 | set_width (CFPlus::Layout self, int max_width = -1) |
938 | CODE: |
961 | CODE: |
939 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
962 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
940 | |
963 | |
941 | void |
964 | void |
942 | set_indent (CFClient::Layout self, int indent) |
965 | set_indent (CFPlus::Layout self, int indent) |
943 | CODE: |
966 | CODE: |
944 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
967 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
945 | |
968 | |
946 | void |
969 | void |
947 | set_spacing (CFClient::Layout self, int spacing) |
970 | set_spacing (CFPlus::Layout self, int spacing) |
948 | CODE: |
971 | CODE: |
949 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
972 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
950 | |
973 | |
951 | void |
974 | void |
952 | set_ellipsise (CFClient::Layout self, int ellipsise) |
975 | set_ellipsise (CFPlus::Layout self, int ellipsise) |
953 | CODE: |
976 | CODE: |
954 | pango_layout_set_ellipsize (self->pl, |
977 | pango_layout_set_ellipsize (self->pl, |
955 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
978 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
956 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
979 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
957 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
980 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
958 | : PANGO_ELLIPSIZE_NONE |
981 | : PANGO_ELLIPSIZE_NONE |
959 | ); |
982 | ); |
960 | |
983 | |
961 | void |
984 | void |
962 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
985 | set_single_paragraph_mode (CFPlus::Layout self, int spm) |
963 | CODE: |
986 | CODE: |
964 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
987 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
965 | |
988 | |
966 | void |
989 | void |
967 | size (CFClient::Layout self) |
990 | size (CFPlus::Layout self) |
968 | PPCODE: |
991 | PPCODE: |
969 | { |
992 | { |
970 | int w, h; |
993 | int w, h; |
971 | |
994 | |
972 | layout_get_pixel_size (self, &w, &h); |
995 | layout_get_pixel_size (self, &w, &h); |
… | |
… | |
975 | PUSHs (sv_2mortal (newSViv (w))); |
998 | PUSHs (sv_2mortal (newSViv (w))); |
976 | PUSHs (sv_2mortal (newSViv (h))); |
999 | PUSHs (sv_2mortal (newSViv (h))); |
977 | } |
1000 | } |
978 | |
1001 | |
979 | int |
1002 | int |
980 | descent (CFClient::Layout self) |
1003 | descent (CFPlus::Layout self) |
981 | CODE: |
1004 | CODE: |
982 | { |
1005 | { |
983 | PangoRectangle rect; |
1006 | PangoRectangle rect; |
984 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1007 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
985 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1008 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
… | |
… | |
987 | } |
1010 | } |
988 | OUTPUT: |
1011 | OUTPUT: |
989 | RETVAL |
1012 | RETVAL |
990 | |
1013 | |
991 | int |
1014 | int |
992 | xy_to_index (CFClient::Layout self, int x, int y) |
1015 | xy_to_index (CFPlus::Layout self, int x, int y) |
993 | CODE: |
1016 | CODE: |
994 | { |
1017 | { |
995 | int index, trailing; |
1018 | int index, trailing; |
996 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1019 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
997 | RETVAL = index; |
1020 | RETVAL = index; |
998 | } |
1021 | } |
999 | OUTPUT: |
1022 | OUTPUT: |
1000 | RETVAL |
1023 | RETVAL |
1001 | |
1024 | |
1002 | void |
1025 | void |
1003 | cursor_pos (CFClient::Layout self, int index) |
1026 | cursor_pos (CFPlus::Layout self, int index) |
1004 | PPCODE: |
1027 | PPCODE: |
1005 | { |
1028 | { |
1006 | PangoRectangle strong_pos; |
1029 | PangoRectangle strong_pos; |
1007 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1030 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1008 | |
1031 | |
… | |
… | |
1011 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1034 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1012 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1035 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1013 | } |
1036 | } |
1014 | |
1037 | |
1015 | void |
1038 | void |
1016 | render (CFClient::Layout self, float x, float y) |
1039 | render (CFPlus::Layout self, float x, float y, int flags = 0) |
1017 | PPCODE: |
1040 | PPCODE: |
1018 | pango_opengl_render_layout_subpixel ( |
1041 | pango_opengl_render_layout_subpixel ( |
1019 | self->pl, |
1042 | self->pl, |
1020 | x * PANGO_SCALE, y * PANGO_SCALE, |
1043 | x * PANGO_SCALE, y * PANGO_SCALE, |
1021 | self->r, self->g, self->b, self->a |
1044 | self->r, self->g, self->b, self->a, |
|
|
1045 | flags |
1022 | ); |
1046 | ); |
1023 | |
1047 | |
1024 | MODULE = CFClient PACKAGE = CFClient::Texture |
1048 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1025 | |
1049 | |
1026 | void |
1050 | void |
1027 | pad2pot (SV *data_, SV *w_, SV *h_) |
1051 | pad2pot (SV *data_, SV *w_, SV *h_) |
1028 | CODE: |
1052 | CODE: |
1029 | { |
1053 | { |
… | |
… | |
1107 | glDisable (GL_ALPHA_TEST); |
1131 | glDisable (GL_ALPHA_TEST); |
1108 | glDisable (GL_BLEND); |
1132 | glDisable (GL_BLEND); |
1109 | } |
1133 | } |
1110 | } |
1134 | } |
1111 | |
1135 | |
1112 | MODULE = CFClient PACKAGE = CFClient::Map |
1136 | MODULE = CFPlus PACKAGE = CFPlus::Map |
1113 | |
1137 | |
1114 | CFClient::Map |
1138 | CFPlus::Map |
1115 | new (SV *class, int map_width, int map_height) |
1139 | new (SV *class, int map_width, int map_height) |
1116 | CODE: |
1140 | CODE: |
1117 | New (0, RETVAL, 1, struct map); |
1141 | New (0, RETVAL, 1, struct map); |
1118 | RETVAL->x = 0; |
1142 | RETVAL->x = 0; |
1119 | RETVAL->y = 0; |
1143 | RETVAL->y = 0; |
… | |
… | |
1129 | RETVAL->row = 0; |
1153 | RETVAL->row = 0; |
1130 | OUTPUT: |
1154 | OUTPUT: |
1131 | RETVAL |
1155 | RETVAL |
1132 | |
1156 | |
1133 | void |
1157 | void |
1134 | DESTROY (CFClient::Map self) |
1158 | DESTROY (CFPlus::Map self) |
1135 | CODE: |
1159 | CODE: |
1136 | { |
1160 | { |
1137 | map_clear (self); |
1161 | map_clear (self); |
1138 | Safefree (self->face); |
1162 | Safefree (self->face); |
1139 | Safefree (self->tex); |
1163 | Safefree (self->tex); |
1140 | Safefree (self); |
1164 | Safefree (self); |
1141 | } |
1165 | } |
1142 | |
1166 | |
1143 | void |
1167 | void |
1144 | clear (CFClient::Map self) |
1168 | clear (CFPlus::Map self) |
1145 | CODE: |
1169 | CODE: |
1146 | map_clear (self); |
1170 | map_clear (self); |
1147 | |
1171 | |
1148 | void |
1172 | void |
1149 | set_face (CFClient::Map self, int face, int texid) |
1173 | set_face (CFPlus::Map self, int face, int texid) |
1150 | CODE: |
1174 | CODE: |
1151 | { |
1175 | { |
1152 | while (self->faces <= face) |
1176 | while (self->faces <= face) |
1153 | { |
1177 | { |
1154 | Append (mapface, self->face, self->faces, self->faces); |
1178 | Append (mapface, self->face, self->faces, self->faces); |
… | |
… | |
1157 | |
1181 | |
1158 | self->face [face] = texid; |
1182 | self->face [face] = texid; |
1159 | } |
1183 | } |
1160 | |
1184 | |
1161 | void |
1185 | void |
1162 | set_texture (CFClient::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1186 | 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) |
1163 | CODE: |
1187 | CODE: |
1164 | { |
1188 | { |
1165 | while (self->texs <= texid) |
1189 | while (self->texs <= texid) |
1166 | { |
1190 | { |
1167 | Append (maptex, self->tex, self->texs, self->texs); |
1191 | Append (maptex, self->tex, self->texs, self->texs); |
… | |
… | |
1191 | // from transparent color bleeding and ugly wrapping effects. |
1215 | // from transparent color bleeding and ugly wrapping effects. |
1192 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1216 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1193 | } |
1217 | } |
1194 | |
1218 | |
1195 | int |
1219 | int |
1196 | ox (CFClient::Map self) |
1220 | ox (CFPlus::Map self) |
1197 | ALIAS: |
1221 | ALIAS: |
1198 | oy = 1 |
1222 | oy = 1 |
1199 | x = 2 |
1223 | x = 2 |
1200 | y = 3 |
1224 | y = 3 |
1201 | w = 4 |
1225 | w = 4 |
… | |
… | |
1212 | } |
1236 | } |
1213 | OUTPUT: |
1237 | OUTPUT: |
1214 | RETVAL |
1238 | RETVAL |
1215 | |
1239 | |
1216 | void |
1240 | void |
1217 | scroll (CFClient::Map self, int dx, int dy) |
1241 | scroll (CFPlus::Map self, int dx, int dy) |
1218 | CODE: |
1242 | CODE: |
1219 | { |
1243 | { |
1220 | if (dx > 0) |
1244 | if (dx > 0) |
1221 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1245 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1222 | else if (dx < 0) |
1246 | else if (dx < 0) |
… | |
… | |
1238 | self->y += MAP_EXTEND_Y; |
1262 | self->y += MAP_EXTEND_Y; |
1239 | } |
1263 | } |
1240 | } |
1264 | } |
1241 | |
1265 | |
1242 | void |
1266 | void |
1243 | map1a_update (CFClient::Map self, SV *data_) |
1267 | map1a_update (CFPlus::Map self, SV *data_) |
1244 | CODE: |
1268 | CODE: |
1245 | { |
1269 | { |
1246 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1270 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1247 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1271 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1248 | mapcell *cell; |
1272 | mapcell *cell; |
… | |
… | |
1290 | cell->darkness = -1; |
1314 | cell->darkness = -1; |
1291 | } |
1315 | } |
1292 | } |
1316 | } |
1293 | |
1317 | |
1294 | SV * |
1318 | SV * |
1295 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
1319 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1296 | CODE: |
1320 | CODE: |
1297 | { |
1321 | { |
1298 | int x1, x; |
1322 | int x1, x; |
1299 | int y1, y; |
1323 | int y1, y; |
1300 | int z; |
1324 | int z; |
… | |
… | |
1350 | } |
1374 | } |
1351 | OUTPUT: |
1375 | OUTPUT: |
1352 | RETVAL |
1376 | RETVAL |
1353 | |
1377 | |
1354 | void |
1378 | void |
1355 | draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1379 | draw (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1356 | CODE: |
1380 | CODE: |
1357 | { |
1381 | { |
1358 | int vx, vy; |
1382 | int vx, vy; |
1359 | int x, y, z; |
1383 | int x, y, z; |
1360 | int last_name; |
1384 | int last_name; |
… | |
… | |
1425 | glDisable (GL_TEXTURE_2D); |
1449 | glDisable (GL_TEXTURE_2D); |
1426 | glDisable (GL_BLEND); |
1450 | glDisable (GL_BLEND); |
1427 | } |
1451 | } |
1428 | |
1452 | |
1429 | void |
1453 | void |
1430 | draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1454 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1431 | CODE: |
1455 | CODE: |
1432 | { |
1456 | { |
1433 | static float color[16][3] = { |
1457 | static float color[16][3] = { |
1434 | { 0.00F, 0.00F, 0.00F }, |
1458 | { 0.00F, 0.00F, 0.00F }, |
1435 | { 1.00F, 1.00F, 1.00F }, |
1459 | { 1.00F, 1.00F, 1.00F }, |
… | |
… | |
1485 | glDisable (GL_BLEND); |
1509 | glDisable (GL_BLEND); |
1486 | glDisable (GL_TEXTURE_2D); |
1510 | glDisable (GL_TEXTURE_2D); |
1487 | } |
1511 | } |
1488 | |
1512 | |
1489 | void |
1513 | void |
1490 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1514 | fow_texture (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1491 | PPCODE: |
1515 | PPCODE: |
1492 | { |
1516 | { |
1493 | int vx, vy; |
1517 | int vx, vy; |
1494 | int x, y; |
1518 | int x, y; |
1495 | int sw4 = (sw + 3) & ~3; |
1519 | int sw4 = (sw + 3) & ~3; |
… | |
… | |
1524 | PUSHs (sv_2mortal (newSViv (sh))); |
1548 | PUSHs (sv_2mortal (newSViv (sh))); |
1525 | PUSHs (darkness_sv); |
1549 | PUSHs (darkness_sv); |
1526 | } |
1550 | } |
1527 | |
1551 | |
1528 | SV * |
1552 | SV * |
1529 | get_rect (CFClient::Map self, int x0, int y0, int w, int h) |
1553 | get_rect (CFPlus::Map self, int x0, int y0, int w, int h) |
1530 | CODE: |
1554 | CODE: |
1531 | { |
1555 | { |
1532 | int x, y, x1, y1; |
1556 | int x, y, x1, y1; |
1533 | SV *data_sv = newSV (w * h * 7 + 5); |
1557 | SV *data_sv = newSV (w * h * 7 + 5); |
1534 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
1558 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
… | |
… | |
1596 | } |
1620 | } |
1597 | OUTPUT: |
1621 | OUTPUT: |
1598 | RETVAL |
1622 | RETVAL |
1599 | |
1623 | |
1600 | void |
1624 | void |
1601 | set_rect (CFClient::Map self, int x0, int y0, uint8_t *data) |
1625 | set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) |
1602 | PPCODE: |
1626 | PPCODE: |
1603 | { |
1627 | { |
1604 | int x, y, z; |
1628 | int x, y, z; |
1605 | int w, h; |
1629 | int w, h; |
1606 | int x1, y1; |
1630 | int x1, y1; |
… | |
… | |
1655 | } |
1679 | } |
1656 | } |
1680 | } |
1657 | } |
1681 | } |
1658 | } |
1682 | } |
1659 | |
1683 | |
1660 | MODULE = CFClient PACKAGE = CFClient::MixChunk |
1684 | MODULE = CFPlus PACKAGE = CFPlus::MixChunk |
1661 | |
1685 | |
1662 | CFClient::MixChunk |
1686 | CFPlus::MixChunk |
1663 | new_from_file (SV *class, char *path) |
1687 | new_from_file (SV *class, char *path) |
1664 | CODE: |
1688 | CODE: |
1665 | RETVAL = Mix_LoadWAV (path); |
1689 | RETVAL = Mix_LoadWAV (path); |
1666 | OUTPUT: |
1690 | OUTPUT: |
1667 | RETVAL |
1691 | RETVAL |
1668 | |
1692 | |
1669 | void |
1693 | void |
1670 | DESTROY (CFClient::MixChunk self) |
1694 | DESTROY (CFPlus::MixChunk self) |
1671 | CODE: |
1695 | CODE: |
1672 | Mix_FreeChunk (self); |
1696 | Mix_FreeChunk (self); |
1673 | |
1697 | |
1674 | int |
1698 | int |
1675 | volume (CFClient::MixChunk self, int volume = -1) |
1699 | volume (CFPlus::MixChunk self, int volume = -1) |
1676 | CODE: |
1700 | CODE: |
1677 | RETVAL = Mix_VolumeChunk (self, volume); |
1701 | RETVAL = Mix_VolumeChunk (self, volume); |
1678 | OUTPUT: |
1702 | OUTPUT: |
1679 | RETVAL |
1703 | RETVAL |
1680 | |
1704 | |
1681 | int |
1705 | int |
1682 | play (CFClient::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1706 | play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1683 | CODE: |
1707 | CODE: |
1684 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1708 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1685 | OUTPUT: |
1709 | OUTPUT: |
1686 | RETVAL |
1710 | RETVAL |
1687 | |
1711 | |
1688 | MODULE = CFClient PACKAGE = CFClient::MixMusic |
1712 | MODULE = CFPlus PACKAGE = CFPlus::MixMusic |
1689 | |
1713 | |
1690 | int |
1714 | int |
1691 | volume (int volume = -1) |
1715 | volume (int volume = -1) |
1692 | CODE: |
1716 | CODE: |
1693 | RETVAL = Mix_VolumeMusic (volume); |
1717 | RETVAL = Mix_VolumeMusic (volume); |
1694 | OUTPUT: |
1718 | OUTPUT: |
1695 | RETVAL |
1719 | RETVAL |
1696 | |
1720 | |
1697 | CFClient::MixMusic |
1721 | CFPlus::MixMusic |
1698 | new_from_file (SV *class, char *path) |
1722 | new_from_file (SV *class, char *path) |
1699 | CODE: |
1723 | CODE: |
1700 | RETVAL = Mix_LoadMUS (path); |
1724 | RETVAL = Mix_LoadMUS (path); |
1701 | OUTPUT: |
1725 | OUTPUT: |
1702 | RETVAL |
1726 | RETVAL |
1703 | |
1727 | |
1704 | void |
1728 | void |
1705 | DESTROY (CFClient::MixMusic self) |
1729 | DESTROY (CFPlus::MixMusic self) |
1706 | CODE: |
1730 | CODE: |
1707 | Mix_FreeMusic (self); |
1731 | Mix_FreeMusic (self); |
1708 | |
1732 | |
1709 | int |
1733 | int |
1710 | play (CFClient::MixMusic self, int loops = -1) |
1734 | play (CFPlus::MixMusic self, int loops = -1) |
1711 | CODE: |
1735 | CODE: |
1712 | RETVAL = Mix_PlayMusic (self, loops); |
1736 | RETVAL = Mix_PlayMusic (self, loops); |
1713 | OUTPUT: |
1737 | OUTPUT: |
1714 | RETVAL |
1738 | RETVAL |
1715 | |
1739 | |
1716 | MODULE = CFClient PACKAGE = CFClient::OpenGL |
1740 | MODULE = CFPlus PACKAGE = CFPlus::OpenGL |
1717 | |
1741 | |
1718 | BOOT: |
1742 | BOOT: |
1719 | { |
1743 | { |
1720 | HV *stash = gv_stashpv ("CFClient::OpenGL", 1); |
1744 | HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); |
1721 | static const struct { |
1745 | static const struct { |
1722 | const char *name; |
1746 | const char *name; |
1723 | IV iv; |
1747 | IV iv; |
1724 | } *civ, const_iv[] = { |
1748 | } *civ, const_iv[] = { |
1725 | # define const_iv(name) { # name, (IV)name } |
1749 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
1788 | const_iv (GL_SEPARABLE_2D), |
1812 | const_iv (GL_SEPARABLE_2D), |
1789 | const_iv (GL_CONVOLUTION_2D), |
1813 | const_iv (GL_CONVOLUTION_2D), |
1790 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1814 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1791 | const_iv (GL_CONSTANT_BORDER), |
1815 | const_iv (GL_CONSTANT_BORDER), |
1792 | const_iv (GL_LINES), |
1816 | const_iv (GL_LINES), |
|
|
1817 | const_iv (GL_LINE_STRIP), |
1793 | const_iv (GL_LINE_LOOP), |
1818 | const_iv (GL_LINE_LOOP), |
1794 | const_iv (GL_QUADS), |
1819 | const_iv (GL_QUADS), |
1795 | const_iv (GL_QUAD_STRIP), |
1820 | const_iv (GL_QUAD_STRIP), |
1796 | const_iv (GL_TRIANGLES), |
1821 | const_iv (GL_TRIANGLES), |
1797 | const_iv (GL_TRIANGLE_STRIP), |
1822 | const_iv (GL_TRIANGLE_STRIP), |
… | |
… | |
1907 | r *= a; |
1932 | r *= a; |
1908 | g *= a; |
1933 | g *= a; |
1909 | b *= a; |
1934 | b *= a; |
1910 | } |
1935 | } |
1911 | // microsoft visual "c" rounds instead of truncating... |
1936 | // microsoft visual "c" rounds instead of truncating... |
1912 | glColor4ub (MIN ((int)(r * 256.f), 255), |
1937 | glColor4f (r, g, b, a); |
1913 | MIN ((int)(g * 256.f), 255), |
|
|
1914 | MIN ((int)(b * 256.f), 255), |
|
|
1915 | MIN ((int)(a * 256.f), 255)); |
|
|
1916 | |
1938 | |
1917 | void glInterleavedArrays (int format, int stride, char *data) |
1939 | void glInterleavedArrays (int format, int stride, char *data) |
1918 | |
1940 | |
1919 | void glDrawElements (int mode, int count, int type, char *indices) |
1941 | void glDrawElements (int mode, int count, int type, char *indices) |
1920 | |
1942 | |
… | |
… | |
1997 | |
2019 | |
1998 | void glEndList () |
2020 | void glEndList () |
1999 | |
2021 | |
2000 | void glCallList (int list) |
2022 | void glCallList (int list) |
2001 | |
2023 | |
2002 | |
|
|