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 |
… | |
… | |
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 | *w = rect.width; |
|
|
161 | *h = rect.height; |
152 | } |
162 | } |
153 | |
163 | |
154 | typedef uint16_t mapface; |
164 | typedef uint16_t mapface; |
155 | |
165 | |
156 | typedef struct { |
166 | typedef struct { |
… | |
… | |
159 | float s, t; |
169 | float s, t; |
160 | uint8_t r, g, b, a; |
170 | uint8_t r, g, b, a; |
161 | } maptex; |
171 | } maptex; |
162 | |
172 | |
163 | typedef struct { |
173 | typedef struct { |
164 | int16_t darkness; |
174 | uint16_t darkness; |
165 | mapface face[3]; |
175 | mapface face[3]; |
|
|
176 | uint8_t stat_hp; |
166 | } mapcell; |
177 | } mapcell; |
167 | |
178 | |
168 | typedef struct { |
179 | typedef struct { |
169 | int32_t c0, c1; |
180 | int32_t c0, c1; |
170 | mapcell *col; |
181 | mapcell *col; |
… | |
… | |
179 | int texs; |
190 | int texs; |
180 | maptex *tex; |
191 | maptex *tex; |
181 | |
192 | |
182 | int32_t rows; |
193 | int32_t rows; |
183 | maprow *row; |
194 | maprow *row; |
184 | } *CFClient__Map; |
195 | } *CFPlus__Map; |
185 | |
196 | |
186 | static char * |
197 | static char * |
187 | prepend (char *ptr, int sze, int inc) |
198 | prepend (char *ptr, int sze, int inc) |
188 | { |
199 | { |
189 | char *p; |
200 | char *p; |
… | |
… | |
207 | |
218 | |
208 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
219 | #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)) |
220 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
210 | |
221 | |
211 | static maprow * |
222 | static maprow * |
212 | map_get_row (CFClient__Map self, int y) |
223 | map_get_row (CFPlus__Map self, int y) |
213 | { |
224 | { |
214 | if (0 > y) |
225 | if (0 > y) |
215 | { |
226 | { |
216 | int extend = - y + MAP_EXTEND_Y; |
227 | int extend = - y + MAP_EXTEND_Y; |
217 | Prepend (maprow, self->row, self->rows, extend); |
228 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
255 | |
266 | |
256 | return row->col + (x - row->c0); |
267 | return row->col + (x - row->c0); |
257 | } |
268 | } |
258 | |
269 | |
259 | static mapcell * |
270 | static mapcell * |
260 | map_get_cell (CFClient__Map self, int x, int y) |
271 | map_get_cell (CFPlus__Map self, int x, int y) |
261 | { |
272 | { |
262 | return row_get_cell (map_get_row (self, y), x); |
273 | return row_get_cell (map_get_row (self, y), x); |
263 | } |
274 | } |
264 | |
275 | |
265 | static void |
276 | static void |
266 | map_clear (CFClient__Map self) |
277 | map_clear (CFPlus__Map self) |
267 | { |
278 | { |
268 | int r; |
279 | int r; |
269 | |
280 | |
270 | for (r = 0; r < self->rows; r++) |
281 | for (r = 0; r < self->rows; r++) |
271 | Safefree (self->row[r].col); |
282 | Safefree (self->row[r].col); |
… | |
… | |
279 | self->row = 0; |
290 | self->row = 0; |
280 | self->rows = 0; |
291 | self->rows = 0; |
281 | } |
292 | } |
282 | |
293 | |
283 | static void |
294 | static void |
284 | map_blank (CFClient__Map self, int x0, int y0, int w, int h) |
295 | map_blank (CFPlus__Map self, int x0, int y0, int w, int h) |
285 | { |
296 | { |
286 | int x, y; |
297 | int x, y; |
287 | maprow *row; |
298 | maprow *row; |
288 | |
299 | |
289 | for (y = y0; y < y0 + h; y++) |
300 | for (y = y0; y < y0 + h; y++) |
… | |
… | |
298 | if (x >= row->c0) |
309 | if (x >= row->c0) |
299 | { |
310 | { |
300 | if (x >= row->c1) |
311 | if (x >= row->c1) |
301 | break; |
312 | break; |
302 | |
313 | |
303 | row->col[x - row->c0].darkness = -1; |
314 | row->col[x - row->c0].darkness = 0; |
304 | } |
315 | } |
305 | } |
316 | } |
306 | } |
317 | } |
307 | |
318 | |
308 | static void |
319 | static void |
… | |
… | |
346 | n |= n >> 16; |
357 | n |= n >> 16; |
347 | |
358 | |
348 | return n + 1; |
359 | return n + 1; |
349 | } |
360 | } |
350 | |
361 | |
351 | MODULE = CFClient PACKAGE = CFClient |
362 | MODULE = CFPlus PACKAGE = CFPlus |
352 | |
363 | |
353 | PROTOTYPES: ENABLE |
364 | PROTOTYPES: ENABLE |
354 | |
365 | |
355 | BOOT: |
366 | BOOT: |
356 | { |
367 | { |
357 | HV *stash = gv_stashpv ("CFClient", 1); |
368 | HV *stash = gv_stashpv ("CFPlus", 1); |
358 | static const struct { |
369 | static const struct { |
359 | const char *name; |
370 | const char *name; |
360 | IV iv; |
371 | IV iv; |
361 | } *civ, const_iv[] = { |
372 | } *civ, const_iv[] = { |
362 | # define const_iv(name) { # name, (IV)name } |
373 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
509 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
520 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
510 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
521 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
511 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
522 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
512 | |
523 | |
513 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
524 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
|
|
525 | #if SDL_VERSION_ATLEAST(1,2,10) |
|
|
526 | SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1); |
|
|
527 | SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); |
|
|
528 | #endif |
514 | |
529 | |
515 | SDL_EnableUNICODE (1); |
530 | SDL_EnableUNICODE (1); |
516 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
531 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
517 | |
532 | |
518 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
533 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
… | |
… | |
605 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
620 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
606 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
621 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
607 | break; |
622 | break; |
608 | } |
623 | } |
609 | |
624 | |
610 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
625 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
611 | } |
626 | } |
612 | } |
627 | } |
613 | |
628 | |
614 | int |
629 | int |
615 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
630 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
… | |
… | |
744 | void |
759 | void |
745 | _exit (int retval) |
760 | _exit (int retval) |
746 | CODE: |
761 | CODE: |
747 | _exit (retval); |
762 | _exit (retval); |
748 | |
763 | |
749 | MODULE = CFClient PACKAGE = CFClient::Font |
764 | MODULE = CFPlus PACKAGE = CFPlus::Font |
750 | |
765 | |
751 | CFClient::Font |
766 | CFPlus::Font |
752 | new_from_file (SV *class, char *path, int id = 0) |
767 | new_from_file (SV *class, char *path, int id = 0) |
753 | CODE: |
768 | CODE: |
754 | { |
769 | { |
755 | int count; |
770 | int count; |
756 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
771 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
… | |
… | |
759 | } |
774 | } |
760 | OUTPUT: |
775 | OUTPUT: |
761 | RETVAL |
776 | RETVAL |
762 | |
777 | |
763 | void |
778 | void |
764 | DESTROY (CFClient::Font self) |
779 | DESTROY (CFPlus::Font self) |
765 | CODE: |
780 | CODE: |
766 | pango_font_description_free (self); |
781 | pango_font_description_free (self); |
767 | |
782 | |
768 | void |
783 | void |
769 | make_default (CFClient::Font self) |
784 | make_default (CFPlus::Font self) |
770 | CODE: |
785 | CODE: |
771 | default_font = self; |
786 | default_font = self; |
772 | |
787 | |
773 | MODULE = CFClient PACKAGE = CFClient::Layout |
788 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
774 | |
789 | |
775 | void |
790 | void |
776 | reset_glyph_cache () |
791 | reset_glyph_cache () |
777 | CODE: |
792 | CODE: |
778 | tc_clear (); |
793 | tc_clear (); |
779 | |
794 | |
780 | CFClient::Layout |
795 | CFPlus::Layout |
781 | new (SV *class) |
796 | new (SV *class) |
782 | CODE: |
797 | CODE: |
783 | New (0, RETVAL, 1, struct cf_layout); |
798 | New (0, RETVAL, 1, struct cf_layout); |
784 | |
799 | |
785 | RETVAL->pl = pango_layout_new (opengl_context); |
800 | RETVAL->pl = pango_layout_new (opengl_context); |
… | |
… | |
794 | layout_update_font (RETVAL); |
809 | layout_update_font (RETVAL); |
795 | OUTPUT: |
810 | OUTPUT: |
796 | RETVAL |
811 | RETVAL |
797 | |
812 | |
798 | void |
813 | void |
799 | DESTROY (CFClient::Layout self) |
814 | DESTROY (CFPlus::Layout self) |
800 | CODE: |
815 | CODE: |
801 | g_object_unref (self->pl); |
816 | g_object_unref (self->pl); |
802 | Safefree (self); |
817 | Safefree (self); |
803 | |
818 | |
804 | void |
819 | void |
805 | set_text (CFClient::Layout self, SV *text_) |
820 | set_text (CFPlus::Layout self, SV *text_) |
806 | CODE: |
821 | CODE: |
807 | { |
822 | { |
808 | STRLEN textlen; |
823 | STRLEN textlen; |
809 | char *text = SvPVutf8 (text_, textlen); |
824 | char *text = SvPVutf8 (text_, textlen); |
810 | |
825 | |
811 | pango_layout_set_text (self->pl, text, textlen); |
826 | pango_layout_set_text (self->pl, text, textlen); |
812 | } |
827 | } |
813 | |
828 | |
814 | void |
829 | void |
815 | set_markup (CFClient::Layout self, SV *text_) |
830 | set_markup (CFPlus::Layout self, SV *text_) |
816 | CODE: |
831 | CODE: |
817 | { |
832 | { |
818 | STRLEN textlen; |
833 | STRLEN textlen; |
819 | char *text = SvPVutf8 (text_, textlen); |
834 | char *text = SvPVutf8 (text_, textlen); |
820 | |
835 | |
821 | pango_layout_set_markup (self->pl, text, textlen); |
836 | pango_layout_set_markup (self->pl, text, textlen); |
822 | } |
837 | } |
823 | |
838 | |
824 | void |
839 | void |
825 | set_shapes (CFClient::Layout self, ...) |
840 | set_shapes (CFPlus::Layout self, ...) |
826 | CODE: |
841 | CODE: |
827 | { |
842 | { |
828 | PangoAttrList *attrs = 0; |
843 | PangoAttrList *attrs = 0; |
829 | const char *text = pango_layout_get_text (self->pl); |
844 | const char *text = pango_layout_get_text (self->pl); |
830 | const char *pos = text; |
845 | const char *pos = text; |
… | |
… | |
865 | if (attrs) |
880 | if (attrs) |
866 | pango_layout_set_attributes (self->pl, attrs); |
881 | pango_layout_set_attributes (self->pl, attrs); |
867 | } |
882 | } |
868 | |
883 | |
869 | void |
884 | void |
870 | get_shapes (CFClient::Layout self) |
885 | get_shapes (CFPlus::Layout self) |
871 | PPCODE: |
886 | PPCODE: |
872 | { |
887 | { |
873 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
888 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
874 | |
889 | |
875 | do |
890 | do |
… | |
… | |
890 | |
905 | |
891 | pango_layout_iter_free (iter); |
906 | pango_layout_iter_free (iter); |
892 | } |
907 | } |
893 | |
908 | |
894 | int |
909 | int |
895 | has_wrapped (CFClient::Layout self) |
910 | has_wrapped (CFPlus::Layout self) |
896 | CODE: |
911 | CODE: |
897 | { |
912 | { |
898 | int lines = 1; |
913 | int lines = 1; |
899 | const char *text = pango_layout_get_text (self->pl); |
914 | const char *text = pango_layout_get_text (self->pl); |
900 | |
915 | |
… | |
… | |
905 | } |
920 | } |
906 | OUTPUT: |
921 | OUTPUT: |
907 | RETVAL |
922 | RETVAL |
908 | |
923 | |
909 | SV * |
924 | SV * |
910 | get_text (CFClient::Layout self) |
925 | get_text (CFPlus::Layout self) |
911 | CODE: |
926 | CODE: |
912 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
927 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
913 | sv_utf8_decode (RETVAL); |
928 | sv_utf8_decode (RETVAL); |
914 | OUTPUT: |
929 | OUTPUT: |
915 | RETVAL |
930 | RETVAL |
916 | |
931 | |
917 | void |
932 | void |
918 | set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) |
933 | set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) |
919 | CODE: |
934 | CODE: |
920 | self->r = r; |
935 | self->r = r; |
921 | self->g = g; |
936 | self->g = g; |
922 | self->b = b; |
937 | self->b = b; |
923 | self->a = a; |
938 | self->a = a; |
924 | |
939 | |
925 | void |
940 | void |
926 | set_font (CFClient::Layout self, CFClient::Font font = 0) |
941 | set_font (CFPlus::Layout self, CFPlus::Font font = 0) |
927 | CODE: |
942 | CODE: |
928 | if (self->font != font) |
943 | if (self->font != font) |
929 | { |
944 | { |
930 | self->font = font; |
945 | self->font = font; |
931 | layout_update_font (self); |
946 | layout_update_font (self); |
932 | } |
947 | } |
933 | |
948 | |
934 | void |
949 | void |
935 | set_height (CFClient::Layout self, int base_height) |
950 | set_height (CFPlus::Layout self, int base_height) |
936 | CODE: |
951 | CODE: |
937 | if (self->base_height != base_height) |
952 | if (self->base_height != base_height) |
938 | { |
953 | { |
939 | self->base_height = base_height; |
954 | self->base_height = base_height; |
940 | layout_update_font (self); |
955 | layout_update_font (self); |
941 | } |
956 | } |
942 | |
957 | |
943 | void |
958 | void |
944 | set_width (CFClient::Layout self, int max_width = -1) |
959 | set_width (CFPlus::Layout self, int max_width = -1) |
945 | CODE: |
960 | CODE: |
946 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
961 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
947 | |
962 | |
948 | void |
963 | void |
949 | set_indent (CFClient::Layout self, int indent) |
964 | set_indent (CFPlus::Layout self, int indent) |
950 | CODE: |
965 | CODE: |
951 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
966 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
952 | |
967 | |
953 | void |
968 | void |
954 | set_spacing (CFClient::Layout self, int spacing) |
969 | set_spacing (CFPlus::Layout self, int spacing) |
955 | CODE: |
970 | CODE: |
956 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
971 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
957 | |
972 | |
958 | void |
973 | void |
959 | set_ellipsise (CFClient::Layout self, int ellipsise) |
974 | set_ellipsise (CFPlus::Layout self, int ellipsise) |
960 | CODE: |
975 | CODE: |
961 | pango_layout_set_ellipsize (self->pl, |
976 | pango_layout_set_ellipsize (self->pl, |
962 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
977 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
963 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
978 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
964 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
979 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
965 | : PANGO_ELLIPSIZE_NONE |
980 | : PANGO_ELLIPSIZE_NONE |
966 | ); |
981 | ); |
967 | |
982 | |
968 | void |
983 | void |
969 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
984 | set_single_paragraph_mode (CFPlus::Layout self, int spm) |
970 | CODE: |
985 | CODE: |
971 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
986 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
972 | |
987 | |
973 | void |
988 | void |
974 | size (CFClient::Layout self) |
989 | size (CFPlus::Layout self) |
975 | PPCODE: |
990 | PPCODE: |
976 | { |
991 | { |
977 | int w, h; |
992 | int w, h; |
978 | |
993 | |
979 | layout_get_pixel_size (self, &w, &h); |
994 | layout_get_pixel_size (self, &w, &h); |
… | |
… | |
982 | PUSHs (sv_2mortal (newSViv (w))); |
997 | PUSHs (sv_2mortal (newSViv (w))); |
983 | PUSHs (sv_2mortal (newSViv (h))); |
998 | PUSHs (sv_2mortal (newSViv (h))); |
984 | } |
999 | } |
985 | |
1000 | |
986 | int |
1001 | int |
987 | descent (CFClient::Layout self) |
1002 | descent (CFPlus::Layout self) |
988 | CODE: |
1003 | CODE: |
989 | { |
1004 | { |
990 | PangoRectangle rect; |
1005 | PangoRectangle rect; |
991 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1006 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
992 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1007 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
… | |
… | |
994 | } |
1009 | } |
995 | OUTPUT: |
1010 | OUTPUT: |
996 | RETVAL |
1011 | RETVAL |
997 | |
1012 | |
998 | int |
1013 | int |
999 | xy_to_index (CFClient::Layout self, int x, int y) |
1014 | xy_to_index (CFPlus::Layout self, int x, int y) |
1000 | CODE: |
1015 | CODE: |
1001 | { |
1016 | { |
1002 | int index, trailing; |
1017 | int index, trailing; |
1003 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1018 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1004 | RETVAL = index; |
1019 | RETVAL = index; |
1005 | } |
1020 | } |
1006 | OUTPUT: |
1021 | OUTPUT: |
1007 | RETVAL |
1022 | RETVAL |
1008 | |
1023 | |
1009 | void |
1024 | void |
1010 | cursor_pos (CFClient::Layout self, int index) |
1025 | cursor_pos (CFPlus::Layout self, int index) |
1011 | PPCODE: |
1026 | PPCODE: |
1012 | { |
1027 | { |
1013 | PangoRectangle strong_pos; |
1028 | PangoRectangle strong_pos; |
1014 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1029 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1015 | |
1030 | |
… | |
… | |
1018 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1033 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1019 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1034 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1020 | } |
1035 | } |
1021 | |
1036 | |
1022 | void |
1037 | void |
1023 | render (CFClient::Layout self, float x, float y) |
1038 | render (CFPlus::Layout self, float x, float y, int flags = 0) |
1024 | PPCODE: |
1039 | PPCODE: |
1025 | pango_opengl_render_layout_subpixel ( |
1040 | pango_opengl_render_layout_subpixel ( |
1026 | self->pl, |
1041 | self->pl, |
1027 | x * PANGO_SCALE, y * PANGO_SCALE, |
1042 | x * PANGO_SCALE, y * PANGO_SCALE, |
1028 | self->r, self->g, self->b, self->a |
1043 | self->r, self->g, self->b, self->a, |
|
|
1044 | flags |
1029 | ); |
1045 | ); |
1030 | |
1046 | |
1031 | MODULE = CFClient PACKAGE = CFClient::Texture |
1047 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1032 | |
1048 | |
1033 | void |
1049 | void |
1034 | pad2pot (SV *data_, SV *w_, SV *h_) |
1050 | pad2pot (SV *data_, SV *w_, SV *h_) |
1035 | CODE: |
1051 | CODE: |
1036 | { |
1052 | { |
… | |
… | |
1114 | glDisable (GL_ALPHA_TEST); |
1130 | glDisable (GL_ALPHA_TEST); |
1115 | glDisable (GL_BLEND); |
1131 | glDisable (GL_BLEND); |
1116 | } |
1132 | } |
1117 | } |
1133 | } |
1118 | |
1134 | |
1119 | MODULE = CFClient PACKAGE = CFClient::Map |
1135 | MODULE = CFPlus PACKAGE = CFPlus::Map |
1120 | |
1136 | |
1121 | CFClient::Map |
1137 | CFPlus::Map |
1122 | new (SV *class, int map_width, int map_height) |
1138 | new (SV *class, int map_width, int map_height) |
1123 | CODE: |
1139 | CODE: |
1124 | New (0, RETVAL, 1, struct map); |
1140 | New (0, RETVAL, 1, struct map); |
1125 | RETVAL->x = 0; |
1141 | RETVAL->x = 0; |
1126 | RETVAL->y = 0; |
1142 | RETVAL->y = 0; |
… | |
… | |
1136 | RETVAL->row = 0; |
1152 | RETVAL->row = 0; |
1137 | OUTPUT: |
1153 | OUTPUT: |
1138 | RETVAL |
1154 | RETVAL |
1139 | |
1155 | |
1140 | void |
1156 | void |
1141 | DESTROY (CFClient::Map self) |
1157 | DESTROY (CFPlus::Map self) |
1142 | CODE: |
1158 | CODE: |
1143 | { |
1159 | { |
1144 | map_clear (self); |
1160 | map_clear (self); |
1145 | Safefree (self->face); |
1161 | Safefree (self->face); |
1146 | Safefree (self->tex); |
1162 | Safefree (self->tex); |
1147 | Safefree (self); |
1163 | Safefree (self); |
1148 | } |
1164 | } |
1149 | |
1165 | |
1150 | void |
1166 | void |
1151 | clear (CFClient::Map self) |
1167 | clear (CFPlus::Map self) |
1152 | CODE: |
1168 | CODE: |
1153 | map_clear (self); |
1169 | map_clear (self); |
1154 | |
1170 | |
1155 | void |
1171 | void |
1156 | set_face (CFClient::Map self, int face, int texid) |
1172 | set_face (CFPlus::Map self, int face, int texid) |
1157 | CODE: |
1173 | CODE: |
1158 | { |
1174 | { |
1159 | while (self->faces <= face) |
1175 | while (self->faces <= face) |
1160 | { |
1176 | { |
1161 | Append (mapface, self->face, self->faces, self->faces); |
1177 | Append (mapface, self->face, self->faces, self->faces); |
… | |
… | |
1164 | |
1180 | |
1165 | self->face [face] = texid; |
1181 | self->face [face] = texid; |
1166 | } |
1182 | } |
1167 | |
1183 | |
1168 | void |
1184 | void |
1169 | 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) |
1185 | 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) |
1170 | CODE: |
1186 | CODE: |
1171 | { |
1187 | { |
1172 | while (self->texs <= texid) |
1188 | while (self->texs <= texid) |
1173 | { |
1189 | { |
1174 | Append (maptex, self->tex, self->texs, self->texs); |
1190 | Append (maptex, self->tex, self->texs, self->texs); |
… | |
… | |
1198 | // from transparent color bleeding and ugly wrapping effects. |
1214 | // from transparent color bleeding and ugly wrapping effects. |
1199 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1215 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1200 | } |
1216 | } |
1201 | |
1217 | |
1202 | int |
1218 | int |
1203 | ox (CFClient::Map self) |
1219 | ox (CFPlus::Map self) |
1204 | ALIAS: |
1220 | ALIAS: |
1205 | oy = 1 |
1221 | oy = 1 |
1206 | x = 2 |
1222 | x = 2 |
1207 | y = 3 |
1223 | y = 3 |
1208 | w = 4 |
1224 | w = 4 |
… | |
… | |
1219 | } |
1235 | } |
1220 | OUTPUT: |
1236 | OUTPUT: |
1221 | RETVAL |
1237 | RETVAL |
1222 | |
1238 | |
1223 | void |
1239 | void |
1224 | scroll (CFClient::Map self, int dx, int dy) |
1240 | scroll (CFPlus::Map self, int dx, int dy) |
1225 | CODE: |
1241 | CODE: |
1226 | { |
1242 | { |
1227 | if (dx > 0) |
1243 | if (dx > 0) |
1228 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1244 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1229 | else if (dx < 0) |
1245 | else if (dx < 0) |
… | |
… | |
1245 | self->y += MAP_EXTEND_Y; |
1261 | self->y += MAP_EXTEND_Y; |
1246 | } |
1262 | } |
1247 | } |
1263 | } |
1248 | |
1264 | |
1249 | void |
1265 | void |
1250 | map1a_update (CFClient::Map self, SV *data_) |
1266 | map1a_update (CFPlus::Map self, SV *data_, int extmap) |
1251 | CODE: |
1267 | CODE: |
1252 | { |
1268 | { |
1253 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1269 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1254 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1270 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1255 | mapcell *cell; |
1271 | mapcell *cell; |
… | |
… | |
1264 | |
1280 | |
1265 | cell = map_get_cell (self, x, y); |
1281 | cell = map_get_cell (self, x, y); |
1266 | |
1282 | |
1267 | if (flags & 15) |
1283 | if (flags & 15) |
1268 | { |
1284 | { |
1269 | if (cell->darkness < 0) |
1285 | if (!cell->darkness) |
1270 | { |
1286 | { |
1271 | cell->darkness = 0; |
1287 | cell->darkness = 256; |
1272 | cell->face [0] = 0; |
1288 | cell->face [0] = 0; |
1273 | cell->face [1] = 0; |
1289 | cell->face [1] = 0; |
1274 | cell->face [2] = 0; |
1290 | cell->face [2] = 0; |
|
|
1291 | cell->stat_hp = 0; |
1275 | } |
1292 | } |
1276 | |
1293 | |
1277 | cell->darkness = flags & 8 ? *data++ : 255; |
|
|
1278 | |
|
|
1279 | //TODO: don't trust server data to be in-range(!) |
1294 | //TODO: don't trust server data to be in-range(!) |
|
|
1295 | |
|
|
1296 | if (flags & 8) |
|
|
1297 | { |
|
|
1298 | if (extmap) |
|
|
1299 | { |
|
|
1300 | uint8_t ext, cmd; |
|
|
1301 | |
|
|
1302 | do |
|
|
1303 | { |
|
|
1304 | ext = *data++; |
|
|
1305 | cmd = ext & 0x3f; |
|
|
1306 | |
|
|
1307 | if (ext < 4) |
|
|
1308 | cell->darkness = 255 - ext * 64 + 1; |
|
|
1309 | else if (ext == 5) // health |
|
|
1310 | cell->stat_hp = *data++; |
|
|
1311 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
1312 | data += *data + 1; |
|
|
1313 | } |
|
|
1314 | while (cmd & 0x80); |
|
|
1315 | } |
|
|
1316 | else |
|
|
1317 | cell->darkness = *data++ + 1; |
|
|
1318 | } |
1280 | |
1319 | |
1281 | if (flags & 4) |
1320 | if (flags & 4) |
1282 | { |
1321 | { |
1283 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1322 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1284 | } |
1323 | } |
… | |
… | |
1292 | { |
1331 | { |
1293 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1332 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1294 | } |
1333 | } |
1295 | } |
1334 | } |
1296 | else |
1335 | else |
1297 | cell->darkness = -1; |
1336 | cell->darkness = 0; |
1298 | } |
1337 | } |
1299 | } |
1338 | } |
1300 | |
1339 | |
1301 | SV * |
1340 | SV * |
1302 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
1341 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1303 | CODE: |
1342 | CODE: |
1304 | { |
1343 | { |
1305 | int x1, x; |
1344 | int x1, x; |
1306 | int y1, y; |
1345 | int y1, y; |
1307 | int z; |
1346 | int z; |
… | |
… | |
1357 | } |
1396 | } |
1358 | OUTPUT: |
1397 | OUTPUT: |
1359 | RETVAL |
1398 | RETVAL |
1360 | |
1399 | |
1361 | void |
1400 | void |
1362 | draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1401 | draw (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1363 | CODE: |
1402 | CODE: |
1364 | { |
1403 | { |
1365 | int vx, vy; |
1404 | int vx, vy; |
1366 | int x, y, z; |
1405 | int x, y, z; |
1367 | int last_name; |
1406 | int last_name; |
… | |
… | |
1429 | |
1468 | |
1430 | glEnd (); |
1469 | glEnd (); |
1431 | |
1470 | |
1432 | glDisable (GL_TEXTURE_2D); |
1471 | glDisable (GL_TEXTURE_2D); |
1433 | glDisable (GL_BLEND); |
1472 | glDisable (GL_BLEND); |
1434 | } |
|
|
1435 | |
1473 | |
|
|
1474 | for (y = 0; y < sh; y++) |
|
|
1475 | if (0 <= y + vy && y + vy < self->rows) |
|
|
1476 | { |
|
|
1477 | maprow *row = self->row + (y + vy); |
|
|
1478 | |
|
|
1479 | for (x = 0; x < sw; x++) |
|
|
1480 | if (row->c0 <= x + vx && x + vx < row->c1) |
|
|
1481 | { |
|
|
1482 | mapcell *cell = row->col + (x + vx - row->c0); |
|
|
1483 | |
|
|
1484 | int px = x * 32; |
|
|
1485 | int py = y * 32; |
|
|
1486 | |
|
|
1487 | if (cell->stat_hp) |
|
|
1488 | { |
|
|
1489 | glColor3ub (0, 0, 0); |
|
|
1490 | glRectf (px + 1, py + 1, px + 31, py + 4); |
|
|
1491 | |
|
|
1492 | glColor3ub (0, 255, 0); |
|
|
1493 | glBegin (GL_LINES); |
|
|
1494 | glVertex2f (px + 2, py + 2.5f); |
|
|
1495 | glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); |
|
|
1496 | glEnd (); |
|
|
1497 | } |
|
|
1498 | } |
|
|
1499 | } |
|
|
1500 | } |
|
|
1501 | |
1436 | void |
1502 | void |
1437 | draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1503 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1438 | CODE: |
1504 | CODE: |
1439 | { |
1505 | { |
1440 | static float color[16][3] = { |
1506 | static float color[16][3] = { |
1441 | { 0.00F, 0.00F, 0.00F }, |
1507 | { 0.00F, 0.00F, 0.00F }, |
1442 | { 1.00F, 1.00F, 1.00F }, |
1508 | { 1.00F, 1.00F, 1.00F }, |
… | |
… | |
1492 | glDisable (GL_BLEND); |
1558 | glDisable (GL_BLEND); |
1493 | glDisable (GL_TEXTURE_2D); |
1559 | glDisable (GL_TEXTURE_2D); |
1494 | } |
1560 | } |
1495 | |
1561 | |
1496 | void |
1562 | void |
1497 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1563 | fow_texture (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1498 | PPCODE: |
1564 | PPCODE: |
1499 | { |
1565 | { |
1500 | int vx, vy; |
1566 | int vx, vy; |
1501 | int x, y; |
1567 | int x, y; |
1502 | int sw4 = (sw + 3) & ~3; |
1568 | int sw4 = (sw + 3) & ~3; |
… | |
… | |
1518 | for (x = 0; x < sw; x++) |
1584 | for (x = 0; x < sw; x++) |
1519 | if (row->c0 <= x + vx && x + vx < row->c1) |
1585 | if (row->c0 <= x + vx && x + vx < row->c1) |
1520 | { |
1586 | { |
1521 | mapcell *cell = row->col + (x + vx - row->c0); |
1587 | mapcell *cell = row->col + (x + vx - row->c0); |
1522 | |
1588 | |
1523 | darkness[y * sw4 + x] = cell->darkness < 0 |
1589 | darkness[y * sw4 + x] = cell->darkness |
|
|
1590 | ? 255 - (cell->darkness - 1) |
1524 | ? 255 - FOW_DARKNESS |
1591 | : 255 - FOW_DARKNESS; |
1525 | : 255 - cell->darkness; |
|
|
1526 | } |
1592 | } |
1527 | } |
1593 | } |
1528 | |
1594 | |
1529 | EXTEND (SP, 3); |
1595 | EXTEND (SP, 3); |
1530 | PUSHs (sv_2mortal (newSViv (sw4))); |
1596 | PUSHs (sv_2mortal (newSViv (sw4))); |
1531 | PUSHs (sv_2mortal (newSViv (sh))); |
1597 | PUSHs (sv_2mortal (newSViv (sh))); |
1532 | PUSHs (darkness_sv); |
1598 | PUSHs (darkness_sv); |
1533 | } |
1599 | } |
1534 | |
1600 | |
1535 | SV * |
1601 | SV * |
1536 | get_rect (CFClient::Map self, int x0, int y0, int w, int h) |
1602 | get_rect (CFPlus::Map self, int x0, int y0, int w, int h) |
1537 | CODE: |
1603 | CODE: |
1538 | { |
1604 | { |
1539 | int x, y, x1, y1; |
1605 | int x, y, x1, y1; |
1540 | SV *data_sv = newSV (w * h * 7 + 5); |
1606 | SV *data_sv = newSV (w * h * 7 + 5); |
1541 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
1607 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
… | |
… | |
1603 | } |
1669 | } |
1604 | OUTPUT: |
1670 | OUTPUT: |
1605 | RETVAL |
1671 | RETVAL |
1606 | |
1672 | |
1607 | void |
1673 | void |
1608 | set_rect (CFClient::Map self, int x0, int y0, uint8_t *data) |
1674 | set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) |
1609 | PPCODE: |
1675 | PPCODE: |
1610 | { |
1676 | { |
1611 | int x, y, z; |
1677 | int x, y, z; |
1612 | int w, h; |
1678 | int w, h; |
1613 | int x1, y1; |
1679 | int x1, y1; |
… | |
… | |
1645 | |
1711 | |
1646 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1712 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1647 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1713 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1648 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1714 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1649 | |
1715 | |
1650 | if (cell->darkness <= 0) |
1716 | if (cell->darkness == 0) |
1651 | { |
1717 | { |
1652 | cell->darkness = -1; |
1718 | cell->darkness = 0; |
1653 | |
1719 | |
1654 | for (z = 0; z <= 2; z++) |
1720 | for (z = 0; z <= 2; z++) |
1655 | { |
1721 | { |
1656 | cell->face[z] = face[z]; |
1722 | cell->face[z] = face[z]; |
1657 | |
1723 | |
… | |
… | |
1662 | } |
1728 | } |
1663 | } |
1729 | } |
1664 | } |
1730 | } |
1665 | } |
1731 | } |
1666 | |
1732 | |
1667 | MODULE = CFClient PACKAGE = CFClient::MixChunk |
1733 | MODULE = CFPlus PACKAGE = CFPlus::MixChunk |
1668 | |
1734 | |
1669 | CFClient::MixChunk |
1735 | CFPlus::MixChunk |
1670 | new_from_file (SV *class, char *path) |
1736 | new_from_file (SV *class, char *path) |
1671 | CODE: |
1737 | CODE: |
1672 | RETVAL = Mix_LoadWAV (path); |
1738 | RETVAL = Mix_LoadWAV (path); |
1673 | OUTPUT: |
1739 | OUTPUT: |
1674 | RETVAL |
1740 | RETVAL |
1675 | |
1741 | |
1676 | void |
1742 | void |
1677 | DESTROY (CFClient::MixChunk self) |
1743 | DESTROY (CFPlus::MixChunk self) |
1678 | CODE: |
1744 | CODE: |
1679 | Mix_FreeChunk (self); |
1745 | Mix_FreeChunk (self); |
1680 | |
1746 | |
1681 | int |
1747 | int |
1682 | volume (CFClient::MixChunk self, int volume = -1) |
1748 | volume (CFPlus::MixChunk self, int volume = -1) |
1683 | CODE: |
1749 | CODE: |
1684 | RETVAL = Mix_VolumeChunk (self, volume); |
1750 | RETVAL = Mix_VolumeChunk (self, volume); |
1685 | OUTPUT: |
1751 | OUTPUT: |
1686 | RETVAL |
1752 | RETVAL |
1687 | |
1753 | |
1688 | int |
1754 | int |
1689 | play (CFClient::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1755 | play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1690 | CODE: |
1756 | CODE: |
1691 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1757 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1692 | OUTPUT: |
1758 | OUTPUT: |
1693 | RETVAL |
1759 | RETVAL |
1694 | |
1760 | |
1695 | MODULE = CFClient PACKAGE = CFClient::MixMusic |
1761 | MODULE = CFPlus PACKAGE = CFPlus::MixMusic |
1696 | |
1762 | |
1697 | int |
1763 | int |
1698 | volume (int volume = -1) |
1764 | volume (int volume = -1) |
1699 | CODE: |
1765 | CODE: |
1700 | RETVAL = Mix_VolumeMusic (volume); |
1766 | RETVAL = Mix_VolumeMusic (volume); |
1701 | OUTPUT: |
1767 | OUTPUT: |
1702 | RETVAL |
1768 | RETVAL |
1703 | |
1769 | |
1704 | CFClient::MixMusic |
1770 | CFPlus::MixMusic |
1705 | new_from_file (SV *class, char *path) |
1771 | new_from_file (SV *class, char *path) |
1706 | CODE: |
1772 | CODE: |
1707 | RETVAL = Mix_LoadMUS (path); |
1773 | RETVAL = Mix_LoadMUS (path); |
1708 | OUTPUT: |
1774 | OUTPUT: |
1709 | RETVAL |
1775 | RETVAL |
1710 | |
1776 | |
1711 | void |
1777 | void |
1712 | DESTROY (CFClient::MixMusic self) |
1778 | DESTROY (CFPlus::MixMusic self) |
1713 | CODE: |
1779 | CODE: |
1714 | Mix_FreeMusic (self); |
1780 | Mix_FreeMusic (self); |
1715 | |
1781 | |
1716 | int |
1782 | int |
1717 | play (CFClient::MixMusic self, int loops = -1) |
1783 | play (CFPlus::MixMusic self, int loops = -1) |
1718 | CODE: |
1784 | CODE: |
1719 | RETVAL = Mix_PlayMusic (self, loops); |
1785 | RETVAL = Mix_PlayMusic (self, loops); |
1720 | OUTPUT: |
1786 | OUTPUT: |
1721 | RETVAL |
1787 | RETVAL |
1722 | |
1788 | |
1723 | MODULE = CFClient PACKAGE = CFClient::OpenGL |
1789 | MODULE = CFPlus PACKAGE = CFPlus::OpenGL |
1724 | |
1790 | |
1725 | BOOT: |
1791 | BOOT: |
1726 | { |
1792 | { |
1727 | HV *stash = gv_stashpv ("CFClient::OpenGL", 1); |
1793 | HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); |
1728 | static const struct { |
1794 | static const struct { |
1729 | const char *name; |
1795 | const char *name; |
1730 | IV iv; |
1796 | IV iv; |
1731 | } *civ, const_iv[] = { |
1797 | } *civ, const_iv[] = { |
1732 | # define const_iv(name) { # name, (IV)name } |
1798 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
1795 | const_iv (GL_SEPARABLE_2D), |
1861 | const_iv (GL_SEPARABLE_2D), |
1796 | const_iv (GL_CONVOLUTION_2D), |
1862 | const_iv (GL_CONVOLUTION_2D), |
1797 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1863 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1798 | const_iv (GL_CONSTANT_BORDER), |
1864 | const_iv (GL_CONSTANT_BORDER), |
1799 | const_iv (GL_LINES), |
1865 | const_iv (GL_LINES), |
|
|
1866 | const_iv (GL_LINE_STRIP), |
1800 | const_iv (GL_LINE_LOOP), |
1867 | const_iv (GL_LINE_LOOP), |
1801 | const_iv (GL_QUADS), |
1868 | const_iv (GL_QUADS), |
1802 | const_iv (GL_QUAD_STRIP), |
1869 | const_iv (GL_QUAD_STRIP), |
1803 | const_iv (GL_TRIANGLES), |
1870 | const_iv (GL_TRIANGLES), |
1804 | const_iv (GL_TRIANGLE_STRIP), |
1871 | const_iv (GL_TRIANGLE_STRIP), |
… | |
… | |
2001 | |
2068 | |
2002 | void glEndList () |
2069 | void glEndList () |
2003 | |
2070 | |
2004 | void glCallList (int list) |
2071 | void glCallList (int list) |
2005 | |
2072 | |
2006 | |
|
|