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 | { |
146 | pango_layout_get_pixel_size (self->pl, w, h); |
149 | pango_layout_get_pixel_size (self->pl, w, h); |
147 | |
150 | |
148 | if (!*w) *w = 1; |
151 | if (!*w) *w = 1; |
149 | if (!*h) *h = 1; |
152 | if (!*h) *h = 1; |
… | |
… | |
179 | int texs; |
182 | int texs; |
180 | maptex *tex; |
183 | maptex *tex; |
181 | |
184 | |
182 | int32_t rows; |
185 | int32_t rows; |
183 | maprow *row; |
186 | maprow *row; |
184 | } *CFClient__Map; |
187 | } *CFPlus__Map; |
185 | |
188 | |
186 | static char * |
189 | static char * |
187 | prepend (char *ptr, int sze, int inc) |
190 | prepend (char *ptr, int sze, int inc) |
188 | { |
191 | { |
189 | char *p; |
192 | char *p; |
… | |
… | |
207 | |
210 | |
208 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
211 | #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)) |
212 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
210 | |
213 | |
211 | static maprow * |
214 | static maprow * |
212 | map_get_row (CFClient__Map self, int y) |
215 | map_get_row (CFPlus__Map self, int y) |
213 | { |
216 | { |
214 | if (0 > y) |
217 | if (0 > y) |
215 | { |
218 | { |
216 | int extend = - y + MAP_EXTEND_Y; |
219 | int extend = - y + MAP_EXTEND_Y; |
217 | Prepend (maprow, self->row, self->rows, extend); |
220 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
255 | |
258 | |
256 | return row->col + (x - row->c0); |
259 | return row->col + (x - row->c0); |
257 | } |
260 | } |
258 | |
261 | |
259 | static mapcell * |
262 | static mapcell * |
260 | map_get_cell (CFClient__Map self, int x, int y) |
263 | map_get_cell (CFPlus__Map self, int x, int y) |
261 | { |
264 | { |
262 | return row_get_cell (map_get_row (self, y), x); |
265 | return row_get_cell (map_get_row (self, y), x); |
263 | } |
266 | } |
264 | |
267 | |
265 | static void |
268 | static void |
266 | map_clear (CFClient__Map self) |
269 | map_clear (CFPlus__Map self) |
267 | { |
270 | { |
268 | int r; |
271 | int r; |
269 | |
272 | |
270 | for (r = 0; r < self->rows; r++) |
273 | for (r = 0; r < self->rows; r++) |
271 | Safefree (self->row[r].col); |
274 | Safefree (self->row[r].col); |
… | |
… | |
279 | self->row = 0; |
282 | self->row = 0; |
280 | self->rows = 0; |
283 | self->rows = 0; |
281 | } |
284 | } |
282 | |
285 | |
283 | static void |
286 | static void |
284 | map_blank (CFClient__Map self, int x0, int y0, int w, int h) |
287 | map_blank (CFPlus__Map self, int x0, int y0, int w, int h) |
285 | { |
288 | { |
286 | int x, y; |
289 | int x, y; |
287 | maprow *row; |
290 | maprow *row; |
288 | |
291 | |
289 | for (y = y0; y < y0 + h; y++) |
292 | for (y = y0; y < y0 + h; y++) |
… | |
… | |
346 | n |= n >> 16; |
349 | n |= n >> 16; |
347 | |
350 | |
348 | return n + 1; |
351 | return n + 1; |
349 | } |
352 | } |
350 | |
353 | |
351 | MODULE = CFClient PACKAGE = CFClient |
354 | MODULE = CFPlus PACKAGE = CFPlus |
352 | |
355 | |
353 | PROTOTYPES: ENABLE |
356 | PROTOTYPES: ENABLE |
354 | |
357 | |
355 | BOOT: |
358 | BOOT: |
356 | { |
359 | { |
357 | HV *stash = gv_stashpv ("CFClient", 1); |
360 | HV *stash = gv_stashpv ("CFPlus", 1); |
358 | static const struct { |
361 | static const struct { |
359 | const char *name; |
362 | const char *name; |
360 | IV iv; |
363 | IV iv; |
361 | } *civ, const_iv[] = { |
364 | } *civ, const_iv[] = { |
362 | # define const_iv(name) { # name, (IV)name } |
365 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
463 | |
466 | |
464 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
467 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
465 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
468 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
466 | } |
469 | } |
467 | |
470 | |
|
|
471 | int |
|
|
472 | in_destruct () |
|
|
473 | CODE: |
|
|
474 | RETVAL = PL_main_cv == Nullcv; |
|
|
475 | OUTPUT: |
|
|
476 | RETVAL |
|
|
477 | |
468 | NV floor (NV x) |
478 | NV floor (NV x) |
469 | |
479 | |
470 | NV ceil (NV x) |
480 | NV ceil (NV x) |
471 | |
481 | |
472 | void |
482 | void |
… | |
… | |
502 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
512 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
503 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
513 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
504 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
514 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
505 | |
515 | |
506 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
516 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
|
|
517 | #if SDL_VERSION_ATLEAST(1,2,10) |
|
|
518 | SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1); |
|
|
519 | SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); |
|
|
520 | #endif |
507 | |
521 | |
508 | SDL_EnableUNICODE (1); |
522 | SDL_EnableUNICODE (1); |
509 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
523 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
510 | |
524 | |
511 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
525 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
… | |
… | |
598 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
612 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
599 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
613 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
600 | break; |
614 | break; |
601 | } |
615 | } |
602 | |
616 | |
603 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
617 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
604 | } |
618 | } |
605 | } |
619 | } |
606 | |
620 | |
607 | int |
621 | int |
608 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
622 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
… | |
… | |
624 | #endif |
638 | #endif |
625 | |
639 | |
626 | void |
640 | void |
627 | add_font (char *file) |
641 | add_font (char *file) |
628 | CODE: |
642 | CODE: |
629 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
643 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
630 | |
644 | |
631 | void |
645 | void |
632 | load_image_inline (SV *image_) |
646 | load_image_inline (SV *image_) |
633 | ALIAS: |
647 | ALIAS: |
634 | load_image_file = 1 |
648 | load_image_file = 1 |
… | |
… | |
676 | |
690 | |
677 | surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); |
691 | surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); |
678 | |
692 | |
679 | assert (surface2->pitch == surface2->w * 4); |
693 | assert (surface2->pitch == surface2->w * 4); |
680 | |
694 | |
|
|
695 | SDL_LockSurface (surface2); |
681 | EXTEND (SP, 5); |
696 | EXTEND (SP, 6); |
682 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
697 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
683 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
698 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
684 | SDL_LockSurface (surface2); |
|
|
685 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
699 | 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))); |
700 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
688 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
701 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
689 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
702 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
|
|
703 | SDL_UnlockSurface (surface2); |
690 | |
704 | |
691 | SDL_FreeSurface (surface); |
705 | SDL_FreeSurface (surface); |
692 | SDL_FreeSurface (surface2); |
706 | SDL_FreeSurface (surface2); |
693 | } |
707 | } |
694 | |
708 | |
… | |
… | |
737 | void |
751 | void |
738 | _exit (int retval) |
752 | _exit (int retval) |
739 | CODE: |
753 | CODE: |
740 | _exit (retval); |
754 | _exit (retval); |
741 | |
755 | |
742 | MODULE = CFClient PACKAGE = CFClient::Font |
756 | MODULE = CFPlus PACKAGE = CFPlus::Font |
743 | |
757 | |
744 | CFClient::Font |
758 | CFPlus::Font |
745 | new_from_file (SV *class, char *path, int id = 0) |
759 | new_from_file (SV *class, char *path, int id = 0) |
746 | CODE: |
760 | CODE: |
747 | { |
761 | { |
748 | int count; |
762 | int count; |
749 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
763 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
… | |
… | |
752 | } |
766 | } |
753 | OUTPUT: |
767 | OUTPUT: |
754 | RETVAL |
768 | RETVAL |
755 | |
769 | |
756 | void |
770 | void |
757 | DESTROY (CFClient::Font self) |
771 | DESTROY (CFPlus::Font self) |
758 | CODE: |
772 | CODE: |
759 | pango_font_description_free (self); |
773 | pango_font_description_free (self); |
760 | |
774 | |
761 | void |
775 | void |
762 | make_default (CFClient::Font self) |
776 | make_default (CFPlus::Font self) |
763 | CODE: |
777 | CODE: |
764 | default_font = self; |
778 | default_font = self; |
765 | |
779 | |
766 | MODULE = CFClient PACKAGE = CFClient::Layout |
780 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
767 | |
781 | |
768 | void |
782 | void |
769 | clear_font_cache () |
783 | reset_glyph_cache () |
770 | CODE: |
784 | CODE: |
771 | tc_clear (); |
785 | tc_clear (); |
772 | |
786 | |
773 | CFClient::Layout |
787 | CFPlus::Layout |
774 | new (SV *class, int type = 0) |
788 | new (SV *class) |
775 | CODE: |
789 | CODE: |
776 | New (0, RETVAL, 1, struct cf_layout); |
790 | New (0, RETVAL, 1, struct cf_layout); |
777 | |
791 | |
778 | RETVAL->pl = pango_layout_new (opengl_context); |
792 | RETVAL->pl = pango_layout_new (opengl_context); |
779 | RETVAL->r = 1.; |
793 | RETVAL->r = 1.; |
… | |
… | |
787 | layout_update_font (RETVAL); |
801 | layout_update_font (RETVAL); |
788 | OUTPUT: |
802 | OUTPUT: |
789 | RETVAL |
803 | RETVAL |
790 | |
804 | |
791 | void |
805 | void |
792 | DESTROY (CFClient::Layout self) |
806 | DESTROY (CFPlus::Layout self) |
793 | CODE: |
807 | CODE: |
794 | g_object_unref (self->pl); |
808 | g_object_unref (self->pl); |
795 | Safefree (self); |
809 | Safefree (self); |
796 | |
810 | |
797 | void |
811 | void |
798 | set_text (CFClient::Layout self, SV *text_) |
812 | set_text (CFPlus::Layout self, SV *text_) |
799 | CODE: |
813 | CODE: |
800 | { |
814 | { |
801 | STRLEN textlen; |
815 | STRLEN textlen; |
802 | char *text = SvPVutf8 (text_, textlen); |
816 | char *text = SvPVutf8 (text_, textlen); |
803 | |
817 | |
804 | pango_layout_set_text (self->pl, text, textlen); |
818 | pango_layout_set_text (self->pl, text, textlen); |
805 | } |
819 | } |
806 | |
820 | |
807 | void |
821 | void |
808 | set_markup (CFClient::Layout self, SV *text_) |
822 | set_markup (CFPlus::Layout self, SV *text_) |
809 | CODE: |
823 | CODE: |
810 | { |
824 | { |
811 | STRLEN textlen; |
825 | STRLEN textlen; |
812 | char *text = SvPVutf8 (text_, textlen); |
826 | char *text = SvPVutf8 (text_, textlen); |
813 | |
827 | |
814 | pango_layout_set_markup (self->pl, text, textlen); |
828 | pango_layout_set_markup (self->pl, text, textlen); |
815 | } |
829 | } |
816 | |
830 | |
817 | void |
831 | void |
818 | set_shapes (CFClient::Layout self, ...) |
832 | set_shapes (CFPlus::Layout self, ...) |
819 | CODE: |
833 | CODE: |
820 | { |
834 | { |
821 | PangoAttrList *attrs = 0; |
835 | PangoAttrList *attrs = 0; |
822 | const char *text = pango_layout_get_text (self->pl); |
836 | const char *text = pango_layout_get_text (self->pl); |
823 | const char *pos = text; |
837 | const char *pos = text; |
… | |
… | |
858 | if (attrs) |
872 | if (attrs) |
859 | pango_layout_set_attributes (self->pl, attrs); |
873 | pango_layout_set_attributes (self->pl, attrs); |
860 | } |
874 | } |
861 | |
875 | |
862 | void |
876 | void |
863 | get_shapes (CFClient::Layout self) |
877 | get_shapes (CFPlus::Layout self) |
864 | PPCODE: |
878 | PPCODE: |
865 | { |
879 | { |
866 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
880 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
867 | |
881 | |
868 | do |
882 | do |
… | |
… | |
872 | if (run && shape_attr_p (run)) |
886 | if (run && shape_attr_p (run)) |
873 | { |
887 | { |
874 | PangoRectangle extents; |
888 | PangoRectangle extents; |
875 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
889 | pango_layout_iter_get_run_extents (iter, 0, &extents); |
876 | |
890 | |
|
|
891 | EXTEND (SP, 2); |
877 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); |
892 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); |
878 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); |
893 | PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); |
879 | } |
894 | } |
880 | } |
895 | } |
881 | while (pango_layout_iter_next_run (iter)); |
896 | while (pango_layout_iter_next_run (iter)); |
882 | |
897 | |
883 | pango_layout_iter_free (iter); |
898 | pango_layout_iter_free (iter); |
884 | } |
899 | } |
885 | |
900 | |
886 | int |
901 | int |
887 | has_wrapped (CFClient::Layout self) |
902 | has_wrapped (CFPlus::Layout self) |
888 | CODE: |
903 | CODE: |
889 | { |
904 | { |
890 | int lines = 1; |
905 | int lines = 1; |
891 | const char *text = pango_layout_get_text (self->pl); |
906 | const char *text = pango_layout_get_text (self->pl); |
892 | |
907 | |
… | |
… | |
897 | } |
912 | } |
898 | OUTPUT: |
913 | OUTPUT: |
899 | RETVAL |
914 | RETVAL |
900 | |
915 | |
901 | SV * |
916 | SV * |
902 | get_text (CFClient::Layout self) |
917 | get_text (CFPlus::Layout self) |
903 | CODE: |
918 | CODE: |
904 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
919 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
905 | sv_utf8_decode (RETVAL); |
920 | sv_utf8_decode (RETVAL); |
906 | OUTPUT: |
921 | OUTPUT: |
907 | RETVAL |
922 | RETVAL |
908 | |
923 | |
909 | void |
924 | void |
910 | set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) |
925 | set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) |
911 | CODE: |
926 | CODE: |
912 | self->r = r; |
927 | self->r = r; |
913 | self->g = g; |
928 | self->g = g; |
914 | self->b = b; |
929 | self->b = b; |
915 | self->a = a; |
930 | self->a = a; |
916 | |
931 | |
917 | void |
932 | void |
918 | set_font (CFClient::Layout self, CFClient::Font font = 0) |
933 | set_font (CFPlus::Layout self, CFPlus::Font font = 0) |
919 | CODE: |
934 | CODE: |
920 | if (self->font != font) |
935 | if (self->font != font) |
921 | { |
936 | { |
922 | self->font = font; |
937 | self->font = font; |
923 | layout_update_font (self); |
938 | layout_update_font (self); |
924 | } |
939 | } |
925 | |
940 | |
926 | void |
941 | void |
927 | set_height (CFClient::Layout self, int base_height) |
942 | set_height (CFPlus::Layout self, int base_height) |
928 | CODE: |
943 | CODE: |
929 | if (self->base_height != base_height) |
944 | if (self->base_height != base_height) |
930 | { |
945 | { |
931 | self->base_height = base_height; |
946 | self->base_height = base_height; |
932 | layout_update_font (self); |
947 | layout_update_font (self); |
933 | } |
948 | } |
934 | |
949 | |
935 | void |
950 | void |
936 | set_width (CFClient::Layout self, int max_width = -1) |
951 | set_width (CFPlus::Layout self, int max_width = -1) |
937 | CODE: |
952 | CODE: |
938 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
953 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
939 | |
954 | |
940 | void |
955 | void |
941 | set_indent (CFClient::Layout self, int indent) |
956 | set_indent (CFPlus::Layout self, int indent) |
942 | CODE: |
957 | CODE: |
943 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
958 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
944 | |
959 | |
945 | void |
960 | void |
946 | set_spacing (CFClient::Layout self, int spacing) |
961 | set_spacing (CFPlus::Layout self, int spacing) |
947 | CODE: |
962 | CODE: |
948 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
963 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
949 | |
964 | |
950 | void |
965 | void |
951 | set_ellipsise (CFClient::Layout self, int ellipsise) |
966 | set_ellipsise (CFPlus::Layout self, int ellipsise) |
952 | CODE: |
967 | CODE: |
953 | pango_layout_set_ellipsize (self->pl, |
968 | pango_layout_set_ellipsize (self->pl, |
954 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
969 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
955 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
970 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
956 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
971 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
957 | : PANGO_ELLIPSIZE_NONE |
972 | : PANGO_ELLIPSIZE_NONE |
958 | ); |
973 | ); |
959 | |
974 | |
960 | void |
975 | void |
961 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
976 | set_single_paragraph_mode (CFPlus::Layout self, int spm) |
962 | CODE: |
977 | CODE: |
963 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
978 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
964 | |
979 | |
965 | void |
980 | void |
966 | size (CFClient::Layout self) |
981 | size (CFPlus::Layout self) |
967 | PPCODE: |
982 | PPCODE: |
968 | { |
983 | { |
969 | int w, h; |
984 | int w, h; |
970 | |
985 | |
971 | layout_get_pixel_size (self, &w, &h); |
986 | layout_get_pixel_size (self, &w, &h); |
… | |
… | |
974 | PUSHs (sv_2mortal (newSViv (w))); |
989 | PUSHs (sv_2mortal (newSViv (w))); |
975 | PUSHs (sv_2mortal (newSViv (h))); |
990 | PUSHs (sv_2mortal (newSViv (h))); |
976 | } |
991 | } |
977 | |
992 | |
978 | int |
993 | int |
979 | descent (CFClient::Layout self) |
994 | descent (CFPlus::Layout self) |
980 | CODE: |
995 | CODE: |
981 | { |
996 | { |
982 | PangoRectangle rect; |
997 | PangoRectangle rect; |
983 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
998 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
984 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
999 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
… | |
… | |
986 | } |
1001 | } |
987 | OUTPUT: |
1002 | OUTPUT: |
988 | RETVAL |
1003 | RETVAL |
989 | |
1004 | |
990 | int |
1005 | int |
991 | xy_to_index (CFClient::Layout self, int x, int y) |
1006 | xy_to_index (CFPlus::Layout self, int x, int y) |
992 | CODE: |
1007 | CODE: |
993 | { |
1008 | { |
994 | int index, trailing; |
1009 | int index, trailing; |
995 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1010 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
996 | RETVAL = index; |
1011 | RETVAL = index; |
997 | } |
1012 | } |
998 | OUTPUT: |
1013 | OUTPUT: |
999 | RETVAL |
1014 | RETVAL |
1000 | |
1015 | |
1001 | void |
1016 | void |
1002 | cursor_pos (CFClient::Layout self, int index) |
1017 | cursor_pos (CFPlus::Layout self, int index) |
1003 | PPCODE: |
1018 | PPCODE: |
1004 | { |
1019 | { |
1005 | PangoRectangle strong_pos; |
1020 | PangoRectangle strong_pos; |
1006 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1021 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1007 | |
1022 | |
… | |
… | |
1010 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1025 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1011 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1026 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1012 | } |
1027 | } |
1013 | |
1028 | |
1014 | void |
1029 | void |
1015 | render (CFClient::Layout self, float x, float y) |
1030 | render (CFPlus::Layout self, float x, float y, int flags = 0) |
1016 | PPCODE: |
1031 | PPCODE: |
1017 | pango_opengl_render_layout_subpixel ( |
1032 | pango_opengl_render_layout_subpixel ( |
1018 | self->pl, |
1033 | self->pl, |
1019 | x * PANGO_SCALE, y * PANGO_SCALE, |
1034 | x * PANGO_SCALE, y * PANGO_SCALE, |
1020 | self->r, self->g, self->b, self->a |
1035 | self->r, self->g, self->b, self->a, |
|
|
1036 | flags |
1021 | ); |
1037 | ); |
1022 | |
1038 | |
1023 | MODULE = CFClient PACKAGE = CFClient::Texture |
1039 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1024 | |
1040 | |
1025 | void |
1041 | void |
1026 | pad2pot (SV *data_, SV *w_, SV *h_) |
1042 | pad2pot (SV *data_, SV *w_, SV *h_) |
1027 | CODE: |
1043 | CODE: |
1028 | { |
1044 | { |
… | |
… | |
1106 | glDisable (GL_ALPHA_TEST); |
1122 | glDisable (GL_ALPHA_TEST); |
1107 | glDisable (GL_BLEND); |
1123 | glDisable (GL_BLEND); |
1108 | } |
1124 | } |
1109 | } |
1125 | } |
1110 | |
1126 | |
1111 | MODULE = CFClient PACKAGE = CFClient::Map |
1127 | MODULE = CFPlus PACKAGE = CFPlus::Map |
1112 | |
1128 | |
1113 | CFClient::Map |
1129 | CFPlus::Map |
1114 | new (SV *class, int map_width, int map_height) |
1130 | new (SV *class, int map_width, int map_height) |
1115 | CODE: |
1131 | CODE: |
1116 | New (0, RETVAL, 1, struct map); |
1132 | New (0, RETVAL, 1, struct map); |
1117 | RETVAL->x = 0; |
1133 | RETVAL->x = 0; |
1118 | RETVAL->y = 0; |
1134 | RETVAL->y = 0; |
… | |
… | |
1128 | RETVAL->row = 0; |
1144 | RETVAL->row = 0; |
1129 | OUTPUT: |
1145 | OUTPUT: |
1130 | RETVAL |
1146 | RETVAL |
1131 | |
1147 | |
1132 | void |
1148 | void |
1133 | DESTROY (CFClient::Map self) |
1149 | DESTROY (CFPlus::Map self) |
1134 | CODE: |
1150 | CODE: |
1135 | { |
1151 | { |
1136 | map_clear (self); |
1152 | map_clear (self); |
1137 | Safefree (self->face); |
1153 | Safefree (self->face); |
1138 | Safefree (self->tex); |
1154 | Safefree (self->tex); |
1139 | Safefree (self); |
1155 | Safefree (self); |
1140 | } |
1156 | } |
1141 | |
1157 | |
1142 | void |
1158 | void |
1143 | clear (CFClient::Map self) |
1159 | clear (CFPlus::Map self) |
1144 | CODE: |
1160 | CODE: |
1145 | map_clear (self); |
1161 | map_clear (self); |
1146 | |
1162 | |
1147 | void |
1163 | void |
1148 | set_face (CFClient::Map self, int face, int texid) |
1164 | set_face (CFPlus::Map self, int face, int texid) |
1149 | CODE: |
1165 | CODE: |
1150 | { |
1166 | { |
1151 | while (self->faces <= face) |
1167 | while (self->faces <= face) |
1152 | { |
1168 | { |
1153 | Append (mapface, self->face, self->faces, self->faces); |
1169 | Append (mapface, self->face, self->faces, self->faces); |
… | |
… | |
1156 | |
1172 | |
1157 | self->face [face] = texid; |
1173 | self->face [face] = texid; |
1158 | } |
1174 | } |
1159 | |
1175 | |
1160 | void |
1176 | void |
1161 | 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) |
1177 | 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) |
1162 | CODE: |
1178 | CODE: |
1163 | { |
1179 | { |
1164 | while (self->texs <= texid) |
1180 | while (self->texs <= texid) |
1165 | { |
1181 | { |
1166 | Append (maptex, self->tex, self->texs, self->texs); |
1182 | Append (maptex, self->tex, self->texs, self->texs); |
… | |
… | |
1190 | // from transparent color bleeding and ugly wrapping effects. |
1206 | // from transparent color bleeding and ugly wrapping effects. |
1191 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1207 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1192 | } |
1208 | } |
1193 | |
1209 | |
1194 | int |
1210 | int |
1195 | ox (CFClient::Map self) |
1211 | ox (CFPlus::Map self) |
1196 | ALIAS: |
1212 | ALIAS: |
1197 | oy = 1 |
1213 | oy = 1 |
1198 | x = 2 |
1214 | x = 2 |
1199 | y = 3 |
1215 | y = 3 |
1200 | w = 4 |
1216 | w = 4 |
… | |
… | |
1211 | } |
1227 | } |
1212 | OUTPUT: |
1228 | OUTPUT: |
1213 | RETVAL |
1229 | RETVAL |
1214 | |
1230 | |
1215 | void |
1231 | void |
1216 | scroll (CFClient::Map self, int dx, int dy) |
1232 | scroll (CFPlus::Map self, int dx, int dy) |
1217 | CODE: |
1233 | CODE: |
1218 | { |
1234 | { |
1219 | if (dx > 0) |
1235 | if (dx > 0) |
1220 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1236 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1221 | else if (dx < 0) |
1237 | else if (dx < 0) |
… | |
… | |
1237 | self->y += MAP_EXTEND_Y; |
1253 | self->y += MAP_EXTEND_Y; |
1238 | } |
1254 | } |
1239 | } |
1255 | } |
1240 | |
1256 | |
1241 | void |
1257 | void |
1242 | map1a_update (CFClient::Map self, SV *data_) |
1258 | map1a_update (CFPlus::Map self, SV *data_) |
1243 | CODE: |
1259 | CODE: |
1244 | { |
1260 | { |
1245 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1261 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1246 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1262 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1247 | mapcell *cell; |
1263 | mapcell *cell; |
… | |
… | |
1289 | cell->darkness = -1; |
1305 | cell->darkness = -1; |
1290 | } |
1306 | } |
1291 | } |
1307 | } |
1292 | |
1308 | |
1293 | SV * |
1309 | SV * |
1294 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
1310 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1295 | CODE: |
1311 | CODE: |
1296 | { |
1312 | { |
1297 | int x1, x; |
1313 | int x1, x; |
1298 | int y1, y; |
1314 | int y1, y; |
1299 | int z; |
1315 | int z; |
… | |
… | |
1349 | } |
1365 | } |
1350 | OUTPUT: |
1366 | OUTPUT: |
1351 | RETVAL |
1367 | RETVAL |
1352 | |
1368 | |
1353 | void |
1369 | void |
1354 | draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1370 | draw (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1355 | CODE: |
1371 | CODE: |
1356 | { |
1372 | { |
1357 | int vx, vy; |
1373 | int vx, vy; |
1358 | int x, y, z; |
1374 | int x, y, z; |
1359 | int last_name; |
1375 | int last_name; |
… | |
… | |
1424 | glDisable (GL_TEXTURE_2D); |
1440 | glDisable (GL_TEXTURE_2D); |
1425 | glDisable (GL_BLEND); |
1441 | glDisable (GL_BLEND); |
1426 | } |
1442 | } |
1427 | |
1443 | |
1428 | void |
1444 | void |
1429 | draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1445 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1430 | CODE: |
1446 | CODE: |
1431 | { |
1447 | { |
1432 | static float color[16][3] = { |
1448 | static float color[16][3] = { |
1433 | { 0.00F, 0.00F, 0.00F }, |
1449 | { 0.00F, 0.00F, 0.00F }, |
1434 | { 1.00F, 1.00F, 1.00F }, |
1450 | { 1.00F, 1.00F, 1.00F }, |
… | |
… | |
1484 | glDisable (GL_BLEND); |
1500 | glDisable (GL_BLEND); |
1485 | glDisable (GL_TEXTURE_2D); |
1501 | glDisable (GL_TEXTURE_2D); |
1486 | } |
1502 | } |
1487 | |
1503 | |
1488 | void |
1504 | void |
1489 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1505 | fow_texture (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1490 | PPCODE: |
1506 | PPCODE: |
1491 | { |
1507 | { |
1492 | int vx, vy; |
1508 | int vx, vy; |
1493 | int x, y; |
1509 | int x, y; |
1494 | int sw4 = (sw + 3) & ~3; |
1510 | int sw4 = (sw + 3) & ~3; |
… | |
… | |
1523 | PUSHs (sv_2mortal (newSViv (sh))); |
1539 | PUSHs (sv_2mortal (newSViv (sh))); |
1524 | PUSHs (darkness_sv); |
1540 | PUSHs (darkness_sv); |
1525 | } |
1541 | } |
1526 | |
1542 | |
1527 | SV * |
1543 | SV * |
1528 | get_rect (CFClient::Map self, int x0, int y0, int w, int h) |
1544 | get_rect (CFPlus::Map self, int x0, int y0, int w, int h) |
1529 | CODE: |
1545 | CODE: |
1530 | { |
1546 | { |
1531 | int x, y, x1, y1; |
1547 | int x, y, x1, y1; |
1532 | SV *data_sv = newSV (w * h * 7 + 5); |
1548 | SV *data_sv = newSV (w * h * 7 + 5); |
1533 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
1549 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
… | |
… | |
1595 | } |
1611 | } |
1596 | OUTPUT: |
1612 | OUTPUT: |
1597 | RETVAL |
1613 | RETVAL |
1598 | |
1614 | |
1599 | void |
1615 | void |
1600 | set_rect (CFClient::Map self, int x0, int y0, uint8_t *data) |
1616 | set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) |
1601 | PPCODE: |
1617 | PPCODE: |
1602 | { |
1618 | { |
1603 | int x, y, z; |
1619 | int x, y, z; |
1604 | int w, h; |
1620 | int w, h; |
1605 | int x1, y1; |
1621 | int x1, y1; |
… | |
… | |
1654 | } |
1670 | } |
1655 | } |
1671 | } |
1656 | } |
1672 | } |
1657 | } |
1673 | } |
1658 | |
1674 | |
1659 | MODULE = CFClient PACKAGE = CFClient::MixChunk |
1675 | MODULE = CFPlus PACKAGE = CFPlus::MixChunk |
1660 | |
1676 | |
1661 | CFClient::MixChunk |
1677 | CFPlus::MixChunk |
1662 | new_from_file (SV *class, char *path) |
1678 | new_from_file (SV *class, char *path) |
1663 | CODE: |
1679 | CODE: |
1664 | RETVAL = Mix_LoadWAV (path); |
1680 | RETVAL = Mix_LoadWAV (path); |
1665 | OUTPUT: |
1681 | OUTPUT: |
1666 | RETVAL |
1682 | RETVAL |
1667 | |
1683 | |
1668 | void |
1684 | void |
1669 | DESTROY (CFClient::MixChunk self) |
1685 | DESTROY (CFPlus::MixChunk self) |
1670 | CODE: |
1686 | CODE: |
1671 | Mix_FreeChunk (self); |
1687 | Mix_FreeChunk (self); |
1672 | |
1688 | |
1673 | int |
1689 | int |
1674 | volume (CFClient::MixChunk self, int volume = -1) |
1690 | volume (CFPlus::MixChunk self, int volume = -1) |
1675 | CODE: |
1691 | CODE: |
1676 | RETVAL = Mix_VolumeChunk (self, volume); |
1692 | RETVAL = Mix_VolumeChunk (self, volume); |
1677 | OUTPUT: |
1693 | OUTPUT: |
1678 | RETVAL |
1694 | RETVAL |
1679 | |
1695 | |
1680 | int |
1696 | int |
1681 | play (CFClient::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1697 | play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1682 | CODE: |
1698 | CODE: |
1683 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1699 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1684 | OUTPUT: |
1700 | OUTPUT: |
1685 | RETVAL |
1701 | RETVAL |
1686 | |
1702 | |
1687 | MODULE = CFClient PACKAGE = CFClient::MixMusic |
1703 | MODULE = CFPlus PACKAGE = CFPlus::MixMusic |
1688 | |
1704 | |
1689 | int |
1705 | int |
1690 | volume (int volume = -1) |
1706 | volume (int volume = -1) |
1691 | CODE: |
1707 | CODE: |
1692 | RETVAL = Mix_VolumeMusic (volume); |
1708 | RETVAL = Mix_VolumeMusic (volume); |
1693 | OUTPUT: |
1709 | OUTPUT: |
1694 | RETVAL |
1710 | RETVAL |
1695 | |
1711 | |
1696 | CFClient::MixMusic |
1712 | CFPlus::MixMusic |
1697 | new_from_file (SV *class, char *path) |
1713 | new_from_file (SV *class, char *path) |
1698 | CODE: |
1714 | CODE: |
1699 | RETVAL = Mix_LoadMUS (path); |
1715 | RETVAL = Mix_LoadMUS (path); |
1700 | OUTPUT: |
1716 | OUTPUT: |
1701 | RETVAL |
1717 | RETVAL |
1702 | |
1718 | |
1703 | void |
1719 | void |
1704 | DESTROY (CFClient::MixMusic self) |
1720 | DESTROY (CFPlus::MixMusic self) |
1705 | CODE: |
1721 | CODE: |
1706 | Mix_FreeMusic (self); |
1722 | Mix_FreeMusic (self); |
1707 | |
1723 | |
1708 | int |
1724 | int |
1709 | play (CFClient::MixMusic self, int loops = -1) |
1725 | play (CFPlus::MixMusic self, int loops = -1) |
1710 | CODE: |
1726 | CODE: |
1711 | RETVAL = Mix_PlayMusic (self, loops); |
1727 | RETVAL = Mix_PlayMusic (self, loops); |
1712 | OUTPUT: |
1728 | OUTPUT: |
1713 | RETVAL |
1729 | RETVAL |
1714 | |
1730 | |
1715 | MODULE = CFClient PACKAGE = CFClient::OpenGL |
1731 | MODULE = CFPlus PACKAGE = CFPlus::OpenGL |
1716 | |
1732 | |
1717 | BOOT: |
1733 | BOOT: |
1718 | { |
1734 | { |
1719 | HV *stash = gv_stashpv ("CFClient::OpenGL", 1); |
1735 | HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); |
1720 | static const struct { |
1736 | static const struct { |
1721 | const char *name; |
1737 | const char *name; |
1722 | IV iv; |
1738 | IV iv; |
1723 | } *civ, const_iv[] = { |
1739 | } *civ, const_iv[] = { |
1724 | # define const_iv(name) { # name, (IV)name } |
1740 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
1906 | r *= a; |
1922 | r *= a; |
1907 | g *= a; |
1923 | g *= a; |
1908 | b *= a; |
1924 | b *= a; |
1909 | } |
1925 | } |
1910 | // microsoft visual "c" rounds instead of truncating... |
1926 | // microsoft visual "c" rounds instead of truncating... |
1911 | glColor4ub (MIN ((int)(r * 256.f), 255), |
1927 | glColor4f (r, g, b, a); |
1912 | MIN ((int)(g * 256.f), 255), |
|
|
1913 | MIN ((int)(b * 256.f), 255), |
|
|
1914 | MIN ((int)(a * 256.f), 255)); |
|
|
1915 | |
1928 | |
1916 | void glInterleavedArrays (int format, int stride, char *data) |
1929 | void glInterleavedArrays (int format, int stride, char *data) |
1917 | |
1930 | |
1918 | void glDrawElements (int mode, int count, int type, char *indices) |
1931 | void glDrawElements (int mode, int count, int type, char *indices) |
1919 | |
1932 | |
… | |
… | |
1996 | |
2009 | |
1997 | void glEndList () |
2010 | void glEndList () |
1998 | |
2011 | |
1999 | void glCallList (int list) |
2012 | void glCallList (int list) |
2000 | |
2013 | |
|
|
2014 | int glX () |
|
|
2015 | CODE: |
|
|
2016 | GLdouble m[4][4]; |
|
|
2017 | glGetDoublev (GL_MODELVIEW_MATRIX, m); |
|
|
2018 | printf ("%f %f %f %f\n", m[0][0], m[0][1], m[0][2], m[0][3]); |
|
|
2019 | printf ("%f %f %f %f\n", m[1][0], m[1][1], m[1][2], m[1][3]); |
|
|
2020 | printf ("%f %f %f %f\n", m[2][0], m[2][1], m[2][2], m[2][3]); |
|
|
2021 | printf ("%f %f %f %f\n", m[3][0], m[3][1], m[3][2], m[3][3]); |
|
|
2022 | printf ("\n"); |
2001 | |
2023 | |