… | |
… | |
120 | |
120 | |
121 | #include "pango-font.c" |
121 | #include "pango-font.c" |
122 | #include "pango-fontmap.c" |
122 | #include "pango-fontmap.c" |
123 | #include "pango-render.c" |
123 | #include "pango-render.c" |
124 | |
124 | |
125 | typedef IV CFPlus__Channel; |
125 | typedef IV DC__Channel; |
126 | typedef SDL_RWops *CFPlus__RW; |
126 | typedef SDL_RWops *DC__RW; |
127 | typedef Mix_Chunk *CFPlus__MixChunk; |
127 | typedef Mix_Chunk *DC__MixChunk; |
128 | typedef Mix_Music *CFPlus__MixMusic; |
128 | typedef Mix_Music *DC__MixMusic; |
129 | |
129 | |
130 | typedef PangoFontDescription *CFPlus__Font; |
130 | typedef PangoFontDescription *DC__Font; |
131 | |
131 | |
132 | static int |
132 | static int |
133 | shape_attr_p (PangoLayoutRun *run) |
133 | shape_attr_p (PangoLayoutRun *run) |
134 | { |
134 | { |
135 | GSList *attrs = run->item->analysis.extra_attrs; |
135 | GSList *attrs = run->item->analysis.extra_attrs; |
… | |
… | |
149 | |
149 | |
150 | typedef struct cf_layout { |
150 | typedef struct cf_layout { |
151 | PangoLayout *pl; |
151 | PangoLayout *pl; |
152 | float r, g, b, a; // default color for rgba mode |
152 | float r, g, b, a; // default color for rgba mode |
153 | int base_height; |
153 | int base_height; |
154 | CFPlus__Font font; |
154 | DC__Font font; |
155 | rc_t *rc; |
155 | rc_t *rc; |
156 | } *CFPlus__Layout; |
156 | } *DC__Layout; |
157 | |
157 | |
158 | static CFPlus__Font default_font; |
158 | static DC__Font default_font; |
159 | static PangoContext *opengl_context; |
159 | static PangoContext *opengl_context; |
160 | static PangoFontMap *opengl_fontmap; |
160 | static PangoFontMap *opengl_fontmap; |
161 | |
161 | |
162 | static void |
162 | static void |
163 | substitute_func (FcPattern *pattern, gpointer data) |
163 | substitute_func (FcPattern *pattern, gpointer data) |
… | |
… | |
168 | #endif |
168 | #endif |
169 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
169 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
170 | } |
170 | } |
171 | |
171 | |
172 | static void |
172 | static void |
173 | layout_update_font (CFPlus__Layout self) |
173 | layout_update_font (DC__Layout self) |
174 | { |
174 | { |
175 | /* use a random scale factor to account for unknown descenders, 0.8 works |
175 | /* use a random scale factor to account for unknown descenders, 0.8 works |
176 | * reasonably well with bitstream vera |
176 | * reasonably well with bitstream vera |
177 | */ |
177 | */ |
178 | PangoFontDescription *font = self->font ? self->font : default_font; |
178 | PangoFontDescription *font = self->font ? self->font : default_font; |
… | |
… | |
182 | |
182 | |
183 | pango_layout_set_font_description (self->pl, font); |
183 | pango_layout_set_font_description (self->pl, font); |
184 | } |
184 | } |
185 | |
185 | |
186 | static void |
186 | static void |
187 | layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) |
187 | layout_get_pixel_size (DC__Layout self, int *w, int *h) |
188 | { |
188 | { |
189 | PangoRectangle rect; |
189 | PangoRectangle rect; |
190 | |
190 | |
191 | // get_pixel_* wrongly rounds down |
191 | // get_pixel_* wrongly rounds down |
192 | pango_layout_get_extents (self->pl, 0, &rect); |
192 | pango_layout_get_extents (self->pl, 0, &rect); |
… | |
… | |
231 | int faces; tileid *face2tile; // [faceid] |
231 | int faces; tileid *face2tile; // [faceid] |
232 | int texs; maptex *tex; // [tileid] |
232 | int texs; maptex *tex; // [tileid] |
233 | |
233 | |
234 | int32_t rows; |
234 | int32_t rows; |
235 | maprow *row; |
235 | maprow *row; |
236 | } *CFPlus__Map; |
236 | } *DC__Map; |
237 | |
237 | |
238 | static char * |
238 | static char * |
239 | prepend (char *ptr, int sze, int inc) |
239 | prepend (char *ptr, int sze, int inc) |
240 | { |
240 | { |
241 | char *p; |
241 | char *p; |
… | |
… | |
279 | self->texs *= 2; |
279 | self->texs *= 2; |
280 | } |
280 | } |
281 | } |
281 | } |
282 | |
282 | |
283 | static maprow * |
283 | static maprow * |
284 | map_get_row (CFPlus__Map self, int y) |
284 | map_get_row (DC__Map self, int y) |
285 | { |
285 | { |
286 | if (0 > y) |
286 | if (0 > y) |
287 | { |
287 | { |
288 | int extend = - y + MAP_EXTEND_Y; |
288 | int extend = - y + MAP_EXTEND_Y; |
289 | Prepend (maprow, self->row, self->rows, extend); |
289 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
327 | |
327 | |
328 | return row->col + (x - row->c0); |
328 | return row->col + (x - row->c0); |
329 | } |
329 | } |
330 | |
330 | |
331 | static mapcell * |
331 | static mapcell * |
332 | map_get_cell (CFPlus__Map self, int x, int y) |
332 | map_get_cell (DC__Map self, int x, int y) |
333 | { |
333 | { |
334 | return row_get_cell (map_get_row (self, y), x); |
334 | return row_get_cell (map_get_row (self, y), x); |
335 | } |
335 | } |
336 | |
336 | |
337 | static void |
337 | static void |
338 | map_clear (CFPlus__Map self) |
338 | map_clear (DC__Map self) |
339 | { |
339 | { |
340 | int r; |
340 | int r; |
341 | |
341 | |
342 | for (r = 0; r < self->rows; r++) |
342 | for (r = 0; r < self->rows; r++) |
343 | Safefree (self->row[r].col); |
343 | Safefree (self->row[r].col); |
… | |
… | |
351 | self->row = 0; |
351 | self->row = 0; |
352 | self->rows = 0; |
352 | self->rows = 0; |
353 | } |
353 | } |
354 | |
354 | |
355 | static void |
355 | static void |
356 | map_blank (CFPlus__Map self, int x0, int y0, int w, int h) |
356 | map_blank (DC__Map self, int x0, int y0, int w, int h) |
357 | { |
357 | { |
358 | int x, y; |
358 | int x, y; |
359 | maprow *row; |
359 | maprow *row; |
360 | mapcell *cell; |
360 | mapcell *cell; |
361 | |
361 | |
… | |
… | |
498 | return 0; |
498 | return 0; |
499 | |
499 | |
500 | return 1; |
500 | return 1; |
501 | } |
501 | } |
502 | |
502 | |
503 | MODULE = CFPlus PACKAGE = CFPlus |
503 | MODULE = Deliantra::Client PACKAGE = DC |
504 | |
504 | |
505 | PROTOTYPES: ENABLE |
505 | PROTOTYPES: ENABLE |
506 | |
506 | |
507 | BOOT: |
507 | BOOT: |
508 | { |
508 | { |
509 | HV *stash = gv_stashpv ("CFPlus", 1); |
509 | HV *stash = gv_stashpv ("DC", 1); |
510 | static const struct { |
510 | static const struct { |
511 | const char *name; |
511 | const char *name; |
512 | IV iv; |
512 | IV iv; |
513 | } *civ, const_iv[] = { |
513 | } *civ, const_iv[] = { |
514 | # define const_iv(name) { # name, (IV)name } |
514 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
825 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
825 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
826 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
826 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
827 | break; |
827 | break; |
828 | } |
828 | } |
829 | |
829 | |
830 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
830 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
831 | } |
831 | } |
832 | } |
832 | } |
833 | |
833 | |
834 | int |
834 | int |
835 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
835 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
… | |
… | |
993 | void |
993 | void |
994 | error (char *message) |
994 | error (char *message) |
995 | CODE: |
995 | CODE: |
996 | fprintf (stderr, "ERROR: %s\n", message); |
996 | fprintf (stderr, "ERROR: %s\n", message); |
997 | #ifdef _WIN32 |
997 | #ifdef _WIN32 |
998 | MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR); |
998 | MessageBox (0, message, "Deliantra Client Error", MB_OK | MB_ICONERROR); |
999 | #endif |
999 | #endif |
1000 | |
1000 | |
1001 | void |
1001 | void |
1002 | fatal (char *message) |
1002 | fatal (char *message) |
1003 | CODE: |
1003 | CODE: |
1004 | fprintf (stderr, "FATAL: %s\n", message); |
1004 | fprintf (stderr, "FATAL: %s\n", message); |
1005 | #ifdef _WIN32 |
1005 | #ifdef _WIN32 |
1006 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
1006 | MessageBox (0, message, "Deliantra Client Fatal Error", MB_OK | MB_ICONERROR); |
1007 | #endif |
1007 | #endif |
1008 | _exit (1); |
1008 | _exit (1); |
1009 | |
1009 | |
1010 | void |
1010 | void |
1011 | _exit (int retval = 0) |
1011 | _exit (int retval = 0) |
… | |
… | |
1023 | #if DEBUG |
1023 | #if DEBUG |
1024 | VALGRIND_DO_LEAK_CHECK; |
1024 | VALGRIND_DO_LEAK_CHECK; |
1025 | #endif |
1025 | #endif |
1026 | } |
1026 | } |
1027 | |
1027 | |
1028 | MODULE = CFPlus PACKAGE = CFPlus::Font |
1028 | MODULE = Deliantra::Client PACKAGE = DC::Font |
1029 | |
1029 | |
1030 | PROTOTYPES: DISABLE |
1030 | PROTOTYPES: DISABLE |
1031 | |
1031 | |
1032 | CFPlus::Font |
1032 | DC::Font |
1033 | new_from_file (SV *class, char *path, int id = 0) |
1033 | new_from_file (SV *class, char *path, int id = 0) |
1034 | CODE: |
1034 | CODE: |
1035 | { |
1035 | { |
1036 | int count; |
1036 | int count; |
1037 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
1037 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
… | |
… | |
1040 | } |
1040 | } |
1041 | OUTPUT: |
1041 | OUTPUT: |
1042 | RETVAL |
1042 | RETVAL |
1043 | |
1043 | |
1044 | void |
1044 | void |
1045 | DESTROY (CFPlus::Font self) |
1045 | DESTROY (DC::Font self) |
1046 | CODE: |
1046 | CODE: |
1047 | pango_font_description_free (self); |
1047 | pango_font_description_free (self); |
1048 | |
1048 | |
1049 | void |
1049 | void |
1050 | make_default (CFPlus::Font self) |
1050 | make_default (DC::Font self) |
1051 | PROTOTYPE: $ |
1051 | PROTOTYPE: $ |
1052 | CODE: |
1052 | CODE: |
1053 | default_font = self; |
1053 | default_font = self; |
1054 | |
1054 | |
1055 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
1055 | MODULE = Deliantra::Client PACKAGE = DC::Layout |
1056 | |
1056 | |
1057 | PROTOTYPES: DISABLE |
1057 | PROTOTYPES: DISABLE |
1058 | |
1058 | |
1059 | void |
1059 | void |
1060 | glyph_cache_backup () |
1060 | glyph_cache_backup () |
… | |
… | |
1066 | glyph_cache_restore () |
1066 | glyph_cache_restore () |
1067 | PROTOTYPE: |
1067 | PROTOTYPE: |
1068 | CODE: |
1068 | CODE: |
1069 | tc_restore (); |
1069 | tc_restore (); |
1070 | |
1070 | |
1071 | CFPlus::Layout |
1071 | DC::Layout |
1072 | new (SV *class) |
1072 | new (SV *class) |
1073 | CODE: |
1073 | CODE: |
1074 | New (0, RETVAL, 1, struct cf_layout); |
1074 | New (0, RETVAL, 1, struct cf_layout); |
1075 | |
1075 | |
1076 | RETVAL->pl = pango_layout_new (opengl_context); |
1076 | RETVAL->pl = pango_layout_new (opengl_context); |
… | |
… | |
1086 | layout_update_font (RETVAL); |
1086 | layout_update_font (RETVAL); |
1087 | OUTPUT: |
1087 | OUTPUT: |
1088 | RETVAL |
1088 | RETVAL |
1089 | |
1089 | |
1090 | void |
1090 | void |
1091 | DESTROY (CFPlus::Layout self) |
1091 | DESTROY (DC::Layout self) |
1092 | CODE: |
1092 | CODE: |
1093 | g_object_unref (self->pl); |
1093 | g_object_unref (self->pl); |
1094 | rc_free (self->rc); |
1094 | rc_free (self->rc); |
1095 | Safefree (self); |
1095 | Safefree (self); |
1096 | |
1096 | |
1097 | void |
1097 | void |
1098 | set_text (CFPlus::Layout self, SV *text_) |
1098 | set_text (DC::Layout self, SV *text_) |
1099 | CODE: |
1099 | CODE: |
1100 | { |
1100 | { |
1101 | STRLEN textlen; |
1101 | STRLEN textlen; |
1102 | char *text = SvPVutf8 (text_, textlen); |
1102 | char *text = SvPVutf8 (text_, textlen); |
1103 | |
1103 | |
1104 | pango_layout_set_text (self->pl, text, textlen); |
1104 | pango_layout_set_text (self->pl, text, textlen); |
1105 | } |
1105 | } |
1106 | |
1106 | |
1107 | void |
1107 | void |
1108 | set_markup (CFPlus::Layout self, SV *text_) |
1108 | set_markup (DC::Layout self, SV *text_) |
1109 | CODE: |
1109 | CODE: |
1110 | { |
1110 | { |
1111 | STRLEN textlen; |
1111 | STRLEN textlen; |
1112 | char *text = SvPVutf8 (text_, textlen); |
1112 | char *text = SvPVutf8 (text_, textlen); |
1113 | |
1113 | |
1114 | pango_layout_set_markup (self->pl, text, textlen); |
1114 | pango_layout_set_markup (self->pl, text, textlen); |
1115 | } |
1115 | } |
1116 | |
1116 | |
1117 | void |
1117 | void |
1118 | set_shapes (CFPlus::Layout self, ...) |
1118 | set_shapes (DC::Layout self, ...) |
1119 | CODE: |
1119 | CODE: |
1120 | { |
1120 | { |
1121 | PangoAttrList *attrs = 0; |
1121 | PangoAttrList *attrs = 0; |
1122 | const char *text = pango_layout_get_text (self->pl); |
1122 | const char *text = pango_layout_get_text (self->pl); |
1123 | const char *pos = text; |
1123 | const char *pos = text; |
… | |
… | |
1158 | if (attrs) |
1158 | if (attrs) |
1159 | pango_layout_set_attributes (self->pl, attrs); |
1159 | pango_layout_set_attributes (self->pl, attrs); |
1160 | } |
1160 | } |
1161 | |
1161 | |
1162 | void |
1162 | void |
1163 | get_shapes (CFPlus::Layout self) |
1163 | get_shapes (DC::Layout self) |
1164 | PPCODE: |
1164 | PPCODE: |
1165 | { |
1165 | { |
1166 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
1166 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
1167 | |
1167 | |
1168 | do |
1168 | do |
… | |
… | |
1183 | |
1183 | |
1184 | pango_layout_iter_free (iter); |
1184 | pango_layout_iter_free (iter); |
1185 | } |
1185 | } |
1186 | |
1186 | |
1187 | int |
1187 | int |
1188 | has_wrapped (CFPlus::Layout self) |
1188 | has_wrapped (DC::Layout self) |
1189 | CODE: |
1189 | CODE: |
1190 | { |
1190 | { |
1191 | int lines = 1; |
1191 | int lines = 1; |
1192 | const char *text = pango_layout_get_text (self->pl); |
1192 | const char *text = pango_layout_get_text (self->pl); |
1193 | |
1193 | |
… | |
… | |
1198 | } |
1198 | } |
1199 | OUTPUT: |
1199 | OUTPUT: |
1200 | RETVAL |
1200 | RETVAL |
1201 | |
1201 | |
1202 | SV * |
1202 | SV * |
1203 | get_text (CFPlus::Layout self) |
1203 | get_text (DC::Layout self) |
1204 | CODE: |
1204 | CODE: |
1205 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
1205 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
1206 | sv_utf8_decode (RETVAL); |
1206 | sv_utf8_decode (RETVAL); |
1207 | OUTPUT: |
1207 | OUTPUT: |
1208 | RETVAL |
1208 | RETVAL |
1209 | |
1209 | |
1210 | void |
1210 | void |
1211 | set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) |
1211 | set_foreground (DC::Layout self, float r, float g, float b, float a = 1.) |
1212 | CODE: |
1212 | CODE: |
1213 | self->r = r; |
1213 | self->r = r; |
1214 | self->g = g; |
1214 | self->g = g; |
1215 | self->b = b; |
1215 | self->b = b; |
1216 | self->a = a; |
1216 | self->a = a; |
1217 | |
1217 | |
1218 | void |
1218 | void |
1219 | set_font (CFPlus::Layout self, CFPlus::Font font = 0) |
1219 | set_font (DC::Layout self, DC::Font font = 0) |
1220 | CODE: |
1220 | CODE: |
1221 | if (self->font != font) |
1221 | if (self->font != font) |
1222 | { |
1222 | { |
1223 | self->font = font; |
1223 | self->font = font; |
1224 | layout_update_font (self); |
1224 | layout_update_font (self); |
1225 | } |
1225 | } |
1226 | |
1226 | |
1227 | void |
1227 | void |
1228 | set_height (CFPlus::Layout self, int base_height) |
1228 | set_height (DC::Layout self, int base_height) |
1229 | CODE: |
1229 | CODE: |
1230 | if (self->base_height != base_height) |
1230 | if (self->base_height != base_height) |
1231 | { |
1231 | { |
1232 | self->base_height = base_height; |
1232 | self->base_height = base_height; |
1233 | layout_update_font (self); |
1233 | layout_update_font (self); |
1234 | } |
1234 | } |
1235 | |
1235 | |
1236 | void |
1236 | void |
1237 | set_width (CFPlus::Layout self, int max_width = -1) |
1237 | set_width (DC::Layout self, int max_width = -1) |
1238 | CODE: |
1238 | CODE: |
1239 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
1239 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
1240 | |
1240 | |
1241 | void |
1241 | void |
1242 | set_indent (CFPlus::Layout self, int indent) |
1242 | set_indent (DC::Layout self, int indent) |
1243 | CODE: |
1243 | CODE: |
1244 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
1244 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
1245 | |
1245 | |
1246 | void |
1246 | void |
1247 | set_spacing (CFPlus::Layout self, int spacing) |
1247 | set_spacing (DC::Layout self, int spacing) |
1248 | CODE: |
1248 | CODE: |
1249 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
1249 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
1250 | |
1250 | |
1251 | void |
1251 | void |
1252 | set_ellipsise (CFPlus::Layout self, int ellipsise) |
1252 | set_ellipsise (DC::Layout self, int ellipsise) |
1253 | CODE: |
1253 | CODE: |
1254 | pango_layout_set_ellipsize (self->pl, |
1254 | pango_layout_set_ellipsize (self->pl, |
1255 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
1255 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
1256 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
1256 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
1257 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
1257 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
1258 | : PANGO_ELLIPSIZE_NONE |
1258 | : PANGO_ELLIPSIZE_NONE |
1259 | ); |
1259 | ); |
1260 | |
1260 | |
1261 | void |
1261 | void |
1262 | set_single_paragraph_mode (CFPlus::Layout self, int spm) |
1262 | set_single_paragraph_mode (DC::Layout self, int spm) |
1263 | CODE: |
1263 | CODE: |
1264 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
1264 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
1265 | |
1265 | |
1266 | void |
1266 | void |
1267 | size (CFPlus::Layout self) |
1267 | size (DC::Layout self) |
1268 | PPCODE: |
1268 | PPCODE: |
1269 | { |
1269 | { |
1270 | int w, h; |
1270 | int w, h; |
1271 | |
1271 | |
1272 | layout_get_pixel_size (self, &w, &h); |
1272 | layout_get_pixel_size (self, &w, &h); |
… | |
… | |
1275 | PUSHs (sv_2mortal (newSViv (w))); |
1275 | PUSHs (sv_2mortal (newSViv (w))); |
1276 | PUSHs (sv_2mortal (newSViv (h))); |
1276 | PUSHs (sv_2mortal (newSViv (h))); |
1277 | } |
1277 | } |
1278 | |
1278 | |
1279 | int |
1279 | int |
1280 | descent (CFPlus::Layout self) |
1280 | descent (DC::Layout self) |
1281 | CODE: |
1281 | CODE: |
1282 | { |
1282 | { |
1283 | PangoRectangle rect; |
1283 | PangoRectangle rect; |
1284 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1284 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1285 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1285 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
… | |
… | |
1287 | } |
1287 | } |
1288 | OUTPUT: |
1288 | OUTPUT: |
1289 | RETVAL |
1289 | RETVAL |
1290 | |
1290 | |
1291 | int |
1291 | int |
1292 | xy_to_index (CFPlus::Layout self, int x, int y) |
1292 | xy_to_index (DC::Layout self, int x, int y) |
1293 | CODE: |
1293 | CODE: |
1294 | { |
1294 | { |
1295 | int index, trailing; |
1295 | int index, trailing; |
1296 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1296 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1297 | RETVAL = index + trailing; |
1297 | RETVAL = index + trailing; |
1298 | } |
1298 | } |
1299 | OUTPUT: |
1299 | OUTPUT: |
1300 | RETVAL |
1300 | RETVAL |
1301 | |
1301 | |
1302 | void |
1302 | void |
1303 | cursor_pos (CFPlus::Layout self, int index) |
1303 | cursor_pos (DC::Layout self, int index) |
1304 | PPCODE: |
1304 | PPCODE: |
1305 | { |
1305 | { |
1306 | PangoRectangle strong_pos; |
1306 | PangoRectangle strong_pos; |
1307 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1307 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1308 | |
1308 | |
… | |
… | |
1311 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1311 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1312 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1312 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1313 | } |
1313 | } |
1314 | |
1314 | |
1315 | void |
1315 | void |
1316 | index_to_line_x (CFPlus::Layout self, int index, int trailing = 0) |
1316 | index_to_line_x (DC::Layout self, int index, int trailing = 0) |
1317 | PPCODE: |
1317 | PPCODE: |
1318 | { |
1318 | { |
1319 | int line, x; |
1319 | int line, x; |
1320 | |
1320 | |
1321 | pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); |
1321 | pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); |
… | |
… | |
1325 | PUSHs (sv_2mortal (newSViv (line - 1))); |
1325 | PUSHs (sv_2mortal (newSViv (line - 1))); |
1326 | PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); |
1326 | PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); |
1327 | } |
1327 | } |
1328 | |
1328 | |
1329 | void |
1329 | void |
1330 | line_x_to_index (CFPlus::Layout self, int line, int x) |
1330 | line_x_to_index (DC::Layout self, int line, int x) |
1331 | PPCODE: |
1331 | PPCODE: |
1332 | { |
1332 | { |
1333 | PangoLayoutLine *lp; |
1333 | PangoLayoutLine *lp; |
1334 | int index, trailing; |
1334 | int index, trailing; |
1335 | |
1335 | |
… | |
… | |
1350 | PUSHs (sv_2mortal (newSViv (trailing))); |
1350 | PUSHs (sv_2mortal (newSViv (trailing))); |
1351 | } |
1351 | } |
1352 | } |
1352 | } |
1353 | |
1353 | |
1354 | void |
1354 | void |
1355 | render (CFPlus::Layout self, float x, float y, int flags = 0) |
1355 | render (DC::Layout self, float x, float y, int flags = 0) |
1356 | CODE: |
1356 | CODE: |
1357 | rc_clear (self->rc); |
1357 | rc_clear (self->rc); |
1358 | pango_opengl_render_layout_subpixel ( |
1358 | pango_opengl_render_layout_subpixel ( |
1359 | self->pl, |
1359 | self->pl, |
1360 | self->rc, |
1360 | self->rc, |
… | |
… | |
1365 | // we assume that context_change actually clears/frees stuff |
1365 | // we assume that context_change actually clears/frees stuff |
1366 | // and does not do any recomputation... |
1366 | // and does not do any recomputation... |
1367 | pango_layout_context_changed (self->pl); |
1367 | pango_layout_context_changed (self->pl); |
1368 | |
1368 | |
1369 | void |
1369 | void |
1370 | draw (CFPlus::Layout self) |
1370 | draw (DC::Layout self) |
1371 | CODE: |
1371 | CODE: |
1372 | { |
1372 | { |
1373 | glEnable (GL_TEXTURE_2D); |
1373 | glEnable (GL_TEXTURE_2D); |
1374 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
1374 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
1375 | glEnable (GL_BLEND); |
1375 | glEnable (GL_BLEND); |
… | |
… | |
1383 | glDisable (GL_ALPHA_TEST); |
1383 | glDisable (GL_ALPHA_TEST); |
1384 | glDisable (GL_BLEND); |
1384 | glDisable (GL_BLEND); |
1385 | glDisable (GL_TEXTURE_2D); |
1385 | glDisable (GL_TEXTURE_2D); |
1386 | } |
1386 | } |
1387 | |
1387 | |
1388 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1388 | MODULE = Deliantra::Client PACKAGE = DC::Texture |
1389 | |
1389 | |
1390 | PROTOTYPES: ENABLE |
1390 | PROTOTYPES: ENABLE |
1391 | |
1391 | |
1392 | void |
1392 | void |
1393 | pad (SV *data_, int ow, int oh, int nw, int nh) |
1393 | pad (SV *data_, int ow, int oh, int nw, int nh) |
… | |
… | |
1472 | RETVAL = width > 0; |
1472 | RETVAL = width > 0; |
1473 | } |
1473 | } |
1474 | OUTPUT: |
1474 | OUTPUT: |
1475 | RETVAL |
1475 | RETVAL |
1476 | |
1476 | |
1477 | MODULE = CFPlus PACKAGE = CFPlus::Map |
1477 | MODULE = Deliantra::Client PACKAGE = DC::Map |
1478 | |
1478 | |
1479 | PROTOTYPES: DISABLE |
1479 | PROTOTYPES: DISABLE |
1480 | |
1480 | |
1481 | CFPlus::Map |
1481 | DC::Map |
1482 | new (SV *class) |
1482 | new (SV *class) |
1483 | CODE: |
1483 | CODE: |
1484 | New (0, RETVAL, 1, struct map); |
1484 | New (0, RETVAL, 1, struct map); |
1485 | RETVAL->x = 0; |
1485 | RETVAL->x = 0; |
1486 | RETVAL->y = 0; |
1486 | RETVAL->y = 0; |
… | |
… | |
1494 | RETVAL->row = 0; |
1494 | RETVAL->row = 0; |
1495 | OUTPUT: |
1495 | OUTPUT: |
1496 | RETVAL |
1496 | RETVAL |
1497 | |
1497 | |
1498 | void |
1498 | void |
1499 | DESTROY (CFPlus::Map self) |
1499 | DESTROY (DC::Map self) |
1500 | CODE: |
1500 | CODE: |
1501 | { |
1501 | { |
1502 | map_clear (self); |
1502 | map_clear (self); |
1503 | Safefree (self->face2tile); |
1503 | Safefree (self->face2tile); |
1504 | Safefree (self->tex); |
1504 | Safefree (self->tex); |
1505 | Safefree (self); |
1505 | Safefree (self); |
1506 | } |
1506 | } |
1507 | |
1507 | |
1508 | void |
1508 | void |
1509 | resize (CFPlus::Map self, int map_width, int map_height) |
1509 | resize (DC::Map self, int map_width, int map_height) |
1510 | CODE: |
1510 | CODE: |
1511 | self->w = map_width; |
1511 | self->w = map_width; |
1512 | self->h = map_height; |
1512 | self->h = map_height; |
1513 | |
1513 | |
1514 | void |
1514 | void |
1515 | clear (CFPlus::Map self) |
1515 | clear (DC::Map self) |
1516 | CODE: |
1516 | CODE: |
1517 | map_clear (self); |
1517 | map_clear (self); |
1518 | |
1518 | |
1519 | void |
1519 | void |
1520 | set_tileid (CFPlus::Map self, int face, int tile) |
1520 | set_tileid (DC::Map self, int face, int tile) |
1521 | CODE: |
1521 | CODE: |
1522 | { |
1522 | { |
1523 | need_facenum (self, face); self->face2tile [face] = tile; |
1523 | need_facenum (self, face); self->face2tile [face] = tile; |
1524 | need_texid (self, tile); |
1524 | need_texid (self, tile); |
1525 | } |
1525 | } |
1526 | |
1526 | |
1527 | void |
1527 | void |
1528 | set_smooth (CFPlus::Map self, int face, int smooth, int level) |
1528 | set_smooth (DC::Map self, int face, int smooth, int level) |
1529 | CODE: |
1529 | CODE: |
1530 | { |
1530 | { |
1531 | tileid texid; |
1531 | tileid texid; |
1532 | maptex *tex; |
1532 | maptex *tex; |
1533 | |
1533 | |
… | |
… | |
1546 | tex->smoothtile = self->face2tile [smooth]; |
1546 | tex->smoothtile = self->face2tile [smooth]; |
1547 | tex->smoothlevel = level; |
1547 | tex->smoothlevel = level; |
1548 | } |
1548 | } |
1549 | |
1549 | |
1550 | void |
1550 | void |
1551 | 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) |
1551 | set_texture (DC::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1552 | CODE: |
1552 | CODE: |
1553 | { |
1553 | { |
1554 | need_texid (self, texid); |
1554 | need_texid (self, texid); |
1555 | |
1555 | |
1556 | { |
1556 | { |
… | |
… | |
1576 | // from transparent color bleeding and ugly wrapping effects. |
1576 | // from transparent color bleeding and ugly wrapping effects. |
1577 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1577 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1578 | } |
1578 | } |
1579 | |
1579 | |
1580 | int |
1580 | int |
1581 | ox (CFPlus::Map self) |
1581 | ox (DC::Map self) |
1582 | ALIAS: |
1582 | ALIAS: |
1583 | oy = 1 |
1583 | oy = 1 |
1584 | x = 2 |
1584 | x = 2 |
1585 | y = 3 |
1585 | y = 3 |
1586 | w = 4 |
1586 | w = 4 |
… | |
… | |
1597 | } |
1597 | } |
1598 | OUTPUT: |
1598 | OUTPUT: |
1599 | RETVAL |
1599 | RETVAL |
1600 | |
1600 | |
1601 | void |
1601 | void |
1602 | scroll (CFPlus::Map self, int dx, int dy) |
1602 | scroll (DC::Map self, int dx, int dy) |
1603 | CODE: |
1603 | CODE: |
1604 | { |
1604 | { |
1605 | if (dx > 0) |
1605 | if (dx > 0) |
1606 | map_blank (self, self->x, self->y, dx, self->h); |
1606 | map_blank (self, self->x, self->y, dx, self->h); |
1607 | else if (dx < 0) |
1607 | else if (dx < 0) |
… | |
… | |
1623 | self->y += MAP_EXTEND_Y; |
1623 | self->y += MAP_EXTEND_Y; |
1624 | } |
1624 | } |
1625 | } |
1625 | } |
1626 | |
1626 | |
1627 | SV * |
1627 | SV * |
1628 | map1a_update (CFPlus::Map self, SV *data_, int extmap) |
1628 | map1a_update (DC::Map self, SV *data_, int extmap) |
1629 | CODE: |
1629 | CODE: |
1630 | { |
1630 | { |
1631 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1631 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1632 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1632 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1633 | mapcell *cell; |
1633 | mapcell *cell; |
… | |
… | |
1722 | } |
1722 | } |
1723 | OUTPUT: |
1723 | OUTPUT: |
1724 | RETVAL |
1724 | RETVAL |
1725 | |
1725 | |
1726 | SV * |
1726 | SV * |
1727 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1727 | mapmap (DC::Map self, int x0, int y0, int w, int h) |
1728 | CODE: |
1728 | CODE: |
1729 | { |
1729 | { |
1730 | int x1, x; |
1730 | int x1, x; |
1731 | int y1, y; |
1731 | int y1, y; |
1732 | int z; |
1732 | int z; |
… | |
… | |
1777 | } |
1777 | } |
1778 | OUTPUT: |
1778 | OUTPUT: |
1779 | RETVAL |
1779 | RETVAL |
1780 | |
1780 | |
1781 | void |
1781 | void |
1782 | draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) |
1782 | draw (DC::Map self, int mx, int my, int sw, int sh, int T) |
1783 | CODE: |
1783 | CODE: |
1784 | { |
1784 | { |
1785 | int x, y, z; |
1785 | int x, y, z; |
1786 | |
1786 | |
1787 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
1787 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
… | |
… | |
2058 | } |
2058 | } |
2059 | } |
2059 | } |
2060 | } |
2060 | } |
2061 | |
2061 | |
2062 | void |
2062 | void |
2063 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
2063 | draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data) |
2064 | CODE: |
2064 | CODE: |
2065 | { |
2065 | { |
2066 | static float color[16][3] = { |
2066 | static float color[16][3] = { |
2067 | { 0.00F, 0.00F, 0.00F }, |
2067 | { 0.00F, 0.00F, 0.00F }, |
2068 | { 1.00F, 1.00F, 1.00F }, |
2068 | { 1.00F, 1.00F, 1.00F }, |
… | |
… | |
2118 | glDisable (GL_BLEND); |
2118 | glDisable (GL_BLEND); |
2119 | glDisable (GL_TEXTURE_2D); |
2119 | glDisable (GL_TEXTURE_2D); |
2120 | } |
2120 | } |
2121 | |
2121 | |
2122 | void |
2122 | void |
2123 | fow_texture (CFPlus::Map self, int mx, int my, int sw, int sh) |
2123 | fow_texture (DC::Map self, int mx, int my, int sw, int sh) |
2124 | PPCODE: |
2124 | PPCODE: |
2125 | { |
2125 | { |
2126 | int x, y; |
2126 | int x, y; |
2127 | int sw1 = sw + 2; |
2127 | int sw1 = sw + 2; |
2128 | int sh1 = sh + 2; |
2128 | int sh1 = sh + 2; |
… | |
… | |
2199 | PUSHs (sv_2mortal (newSViv (sh3))); |
2199 | PUSHs (sv_2mortal (newSViv (sh3))); |
2200 | PUSHs (darkness3_sv); |
2200 | PUSHs (darkness3_sv); |
2201 | } |
2201 | } |
2202 | |
2202 | |
2203 | SV * |
2203 | SV * |
2204 | get_rect (CFPlus::Map self, int x0, int y0, int w, int h) |
2204 | get_rect (DC::Map self, int x0, int y0, int w, int h) |
2205 | CODE: |
2205 | CODE: |
2206 | { |
2206 | { |
2207 | int x, y, x1, y1; |
2207 | int x, y, x1, y1; |
2208 | SV *data_sv = newSV (w * h * 7 + 5); |
2208 | SV *data_sv = newSV (w * h * 7 + 5); |
2209 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
2209 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
… | |
… | |
2274 | } |
2274 | } |
2275 | OUTPUT: |
2275 | OUTPUT: |
2276 | RETVAL |
2276 | RETVAL |
2277 | |
2277 | |
2278 | void |
2278 | void |
2279 | set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) |
2279 | set_rect (DC::Map self, int x0, int y0, uint8_t *data) |
2280 | PPCODE: |
2280 | PPCODE: |
2281 | { |
2281 | { |
2282 | int x, y, z; |
2282 | int x, y, z; |
2283 | int w, h; |
2283 | int w, h; |
2284 | int x1, y1; |
2284 | int x1, y1; |
… | |
… | |
2337 | } |
2337 | } |
2338 | } |
2338 | } |
2339 | } |
2339 | } |
2340 | } |
2340 | } |
2341 | |
2341 | |
2342 | MODULE = CFPlus PACKAGE = CFPlus::RW |
2342 | MODULE = Deliantra::Client PACKAGE = DC::RW |
2343 | |
2343 | |
2344 | CFPlus::RW |
2344 | DC::RW |
2345 | new (SV *class, SV *data_sv) |
2345 | new (SV *class, SV *data_sv) |
2346 | CODE: |
2346 | CODE: |
2347 | { |
2347 | { |
2348 | STRLEN datalen; |
2348 | STRLEN datalen; |
2349 | char *data = SvPVbyte (data_sv, datalen); |
2349 | char *data = SvPVbyte (data_sv, datalen); |
… | |
… | |
2351 | RETVAL = SDL_RWFromConstMem (data, datalen); |
2351 | RETVAL = SDL_RWFromConstMem (data, datalen); |
2352 | } |
2352 | } |
2353 | OUTPUT: |
2353 | OUTPUT: |
2354 | RETVAL |
2354 | RETVAL |
2355 | |
2355 | |
2356 | CFPlus::RW |
2356 | DC::RW |
2357 | new_from_file (SV *class, const char *path, const char *mode = "rb") |
2357 | new_from_file (SV *class, const char *path, const char *mode = "rb") |
2358 | CODE: |
2358 | CODE: |
2359 | RETVAL = SDL_RWFromFile (path, mode); |
2359 | RETVAL = SDL_RWFromFile (path, mode); |
2360 | OUTPUT: |
2360 | OUTPUT: |
2361 | RETVAL |
2361 | RETVAL |
2362 | |
2362 | |
2363 | # fails on win32: |
2363 | # fails on win32: |
2364 | # CFPlus.xs(2268) : error C2059: syntax error : '(' |
2364 | # dc.xs(2268) : error C2059: syntax error : '(' |
2365 | #void |
2365 | #void |
2366 | #close (CFPlus::RW self) |
2366 | #close (DC::RW self) |
2367 | # CODE: |
2367 | # CODE: |
2368 | # (self->(close)) (self); |
2368 | # (self->(close)) (self); |
2369 | |
2369 | |
2370 | MODULE = CFPlus PACKAGE = CFPlus::Channel |
2370 | MODULE = Deliantra::Client PACKAGE = DC::Channel |
2371 | |
2371 | |
2372 | PROTOTYPES: DISABLE |
2372 | PROTOTYPES: DISABLE |
2373 | |
2373 | |
2374 | CFPlus::Channel |
2374 | DC::Channel |
2375 | find () |
2375 | find () |
2376 | CODE: |
2376 | CODE: |
2377 | { |
2377 | { |
2378 | RETVAL = Mix_GroupAvailable (-1); |
2378 | RETVAL = Mix_GroupAvailable (-1); |
2379 | |
2379 | |
… | |
… | |
2392 | } |
2392 | } |
2393 | OUTPUT: |
2393 | OUTPUT: |
2394 | RETVAL |
2394 | RETVAL |
2395 | |
2395 | |
2396 | void |
2396 | void |
2397 | halt (CFPlus::Channel self) |
2397 | halt (DC::Channel self) |
2398 | CODE: |
2398 | CODE: |
2399 | Mix_HaltChannel (self); |
2399 | Mix_HaltChannel (self); |
2400 | |
2400 | |
2401 | void |
2401 | void |
2402 | expire (CFPlus::Channel self, int ticks = -1) |
2402 | expire (DC::Channel self, int ticks = -1) |
2403 | CODE: |
2403 | CODE: |
2404 | Mix_ExpireChannel (self, ticks); |
2404 | Mix_ExpireChannel (self, ticks); |
2405 | |
2405 | |
2406 | void |
2406 | void |
2407 | fade_out (CFPlus::Channel self, int ticks = -1) |
2407 | fade_out (DC::Channel self, int ticks = -1) |
2408 | CODE: |
2408 | CODE: |
2409 | Mix_FadeOutChannel (self, ticks); |
2409 | Mix_FadeOutChannel (self, ticks); |
2410 | |
2410 | |
2411 | int |
2411 | int |
2412 | volume (CFPlus::Channel self, int volume) |
2412 | volume (DC::Channel self, int volume) |
2413 | CODE: |
2413 | CODE: |
2414 | RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); |
2414 | RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); |
2415 | OUTPUT: |
2415 | OUTPUT: |
2416 | RETVAL |
2416 | RETVAL |
2417 | |
2417 | |
2418 | void |
2418 | void |
2419 | unregister_all_effects (CFPlus::Channel self) |
2419 | unregister_all_effects (DC::Channel self) |
2420 | CODE: |
2420 | CODE: |
2421 | Mix_UnregisterAllEffects (self); |
2421 | Mix_UnregisterAllEffects (self); |
2422 | |
2422 | |
2423 | void |
2423 | void |
2424 | set_panning (CFPlus::Channel self, int left, int right) |
2424 | set_panning (DC::Channel self, int left, int right) |
2425 | CODE: |
2425 | CODE: |
2426 | left = CLAMP (left , 0, 255); |
2426 | left = CLAMP (left , 0, 255); |
2427 | right = CLAMP (right, 0, 255); |
2427 | right = CLAMP (right, 0, 255); |
2428 | Mix_SetPanning (self, left, right); |
2428 | Mix_SetPanning (self, left, right); |
2429 | |
2429 | |
2430 | void |
2430 | void |
2431 | set_distance (CFPlus::Channel self, int distance) |
2431 | set_distance (DC::Channel self, int distance) |
2432 | CODE: |
2432 | CODE: |
2433 | Mix_SetDistance (self, CLAMP (distance, 0, 255)); |
2433 | Mix_SetDistance (self, CLAMP (distance, 0, 255)); |
2434 | |
2434 | |
2435 | void |
2435 | void |
2436 | set_position (CFPlus::Channel self, int angle, int distance) |
2436 | set_position (DC::Channel self, int angle, int distance) |
2437 | CODE: |
2437 | CODE: |
2438 | |
2438 | |
2439 | void |
2439 | void |
2440 | set_position_r (CFPlus::Channel self, int dx, int dy, int maxdistance) |
2440 | set_position_r (DC::Channel self, int dx, int dy, int maxdistance) |
2441 | CODE: |
2441 | CODE: |
2442 | { |
2442 | { |
2443 | int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); |
2443 | int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); |
2444 | int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); |
2444 | int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); |
2445 | Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); |
2445 | Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); |
2446 | } |
2446 | } |
2447 | |
2447 | |
2448 | void |
2448 | void |
2449 | set_reverse_stereo (CFPlus::Channel self, int flip) |
2449 | set_reverse_stereo (DC::Channel self, int flip) |
2450 | CODE: |
2450 | CODE: |
2451 | Mix_SetReverseStereo (self, flip); |
2451 | Mix_SetReverseStereo (self, flip); |
2452 | |
2452 | |
2453 | MODULE = CFPlus PACKAGE = CFPlus::MixChunk |
2453 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2454 | |
2454 | |
2455 | PROTOTYPES: DISABLE |
2455 | PROTOTYPES: DISABLE |
2456 | |
2456 | |
2457 | CFPlus::MixChunk |
2457 | DC::MixChunk |
2458 | new (SV *class, CFPlus::RW rwops) |
2458 | new (SV *class, DC::RW rwops) |
2459 | CODE: |
2459 | CODE: |
2460 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2460 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2461 | OUTPUT: |
2461 | OUTPUT: |
2462 | RETVAL |
2462 | RETVAL |
2463 | |
2463 | |
2464 | void |
2464 | void |
2465 | DESTROY (CFPlus::MixChunk self) |
2465 | DESTROY (DC::MixChunk self) |
2466 | CODE: |
2466 | CODE: |
2467 | Mix_FreeChunk (self); |
2467 | Mix_FreeChunk (self); |
2468 | |
2468 | |
2469 | int |
2469 | int |
2470 | volume (CFPlus::MixChunk self, int volume = -1) |
2470 | volume (DC::MixChunk self, int volume = -1) |
2471 | CODE: |
2471 | CODE: |
2472 | if (items > 1) |
2472 | if (items > 1) |
2473 | volume = CLAMP (volume, 0, 128); |
2473 | volume = CLAMP (volume, 0, 128); |
2474 | RETVAL = Mix_VolumeChunk (self, volume); |
2474 | RETVAL = Mix_VolumeChunk (self, volume); |
2475 | OUTPUT: |
2475 | OUTPUT: |
2476 | RETVAL |
2476 | RETVAL |
2477 | |
2477 | |
2478 | CFPlus::Channel |
2478 | DC::Channel |
2479 | play (CFPlus::MixChunk self, CFPlus::Channel channel = -1, int loops = 0, int ticks = -1) |
2479 | play (DC::MixChunk self, DC::Channel channel = -1, int loops = 0, int ticks = -1) |
2480 | CODE: |
2480 | CODE: |
2481 | { |
2481 | { |
2482 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
2482 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
2483 | |
2483 | |
2484 | if (RETVAL < 0) |
2484 | if (RETVAL < 0) |
… | |
… | |
2491 | } |
2491 | } |
2492 | } |
2492 | } |
2493 | OUTPUT: |
2493 | OUTPUT: |
2494 | RETVAL |
2494 | RETVAL |
2495 | |
2495 | |
2496 | MODULE = CFPlus PACKAGE = CFPlus::MixMusic |
2496 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2497 | |
2497 | |
2498 | int |
2498 | int |
2499 | volume (int volume = -1) |
2499 | volume (int volume = -1) |
2500 | PROTOTYPE: ;$ |
2500 | PROTOTYPE: ;$ |
2501 | CODE: |
2501 | CODE: |
… | |
… | |
2513 | void |
2513 | void |
2514 | halt () |
2514 | halt () |
2515 | CODE: |
2515 | CODE: |
2516 | Mix_HaltMusic (); |
2516 | Mix_HaltMusic (); |
2517 | |
2517 | |
2518 | CFPlus::MixMusic |
2518 | DC::MixMusic |
2519 | new (SV *class, CFPlus::RW rwops) |
2519 | new (SV *class, DC::RW rwops) |
2520 | CODE: |
2520 | CODE: |
2521 | RETVAL = Mix_LoadMUS_RW (rwops); |
2521 | RETVAL = Mix_LoadMUS_RW (rwops); |
2522 | OUTPUT: |
2522 | OUTPUT: |
2523 | RETVAL |
2523 | RETVAL |
2524 | |
2524 | |
2525 | void |
2525 | void |
2526 | DESTROY (CFPlus::MixMusic self) |
2526 | DESTROY (DC::MixMusic self) |
2527 | CODE: |
2527 | CODE: |
2528 | Mix_FreeMusic (self); |
2528 | Mix_FreeMusic (self); |
2529 | |
2529 | |
2530 | int |
2530 | int |
2531 | play (CFPlus::MixMusic self, int loops = -1) |
2531 | play (DC::MixMusic self, int loops = -1) |
2532 | CODE: |
2532 | CODE: |
2533 | RETVAL = Mix_PlayMusic (self, loops); |
2533 | RETVAL = Mix_PlayMusic (self, loops); |
2534 | OUTPUT: |
2534 | OUTPUT: |
2535 | RETVAL |
2535 | RETVAL |
2536 | |
2536 | |
2537 | void |
2537 | void |
2538 | fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) |
2538 | fade_in_pos (DC::MixMusic self, int loops, int ms, double position) |
2539 | CODE: |
2539 | CODE: |
2540 | Mix_FadeInMusicPos (self, loops, ms, position); |
2540 | Mix_FadeInMusicPos (self, loops, ms, position); |
2541 | |
2541 | |
2542 | MODULE = CFPlus PACKAGE = CFPlus::OpenGL |
2542 | MODULE = Deliantra::Client PACKAGE = DC::OpenGL |
2543 | |
2543 | |
2544 | PROTOTYPES: ENABLE |
2544 | PROTOTYPES: ENABLE |
2545 | |
2545 | |
2546 | BOOT: |
2546 | BOOT: |
2547 | { |
2547 | { |
2548 | HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); |
2548 | HV *stash = gv_stashpv ("DC::OpenGL", 1); |
2549 | static const struct { |
2549 | static const struct { |
2550 | const char *name; |
2550 | const char *name; |
2551 | IV iv; |
2551 | IV iv; |
2552 | } *civ, const_iv[] = { |
2552 | } *civ, const_iv[] = { |
2553 | # define const_iv(name) { # name, (IV)name } |
2553 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
2882 | |
2882 | |
2883 | void glEndList () |
2883 | void glEndList () |
2884 | |
2884 | |
2885 | void glCallList (int list) |
2885 | void glCallList (int list) |
2886 | |
2886 | |
2887 | MODULE = CFPlus PACKAGE = CFPlus::UI::Base |
2887 | MODULE = Deliantra::Client PACKAGE = DC::UI::Base |
2888 | |
2888 | |
2889 | PROTOTYPES: DISABLE |
2889 | PROTOTYPES: DISABLE |
2890 | |
2890 | |
2891 | void |
2891 | void |
2892 | find_widget (SV *self, NV x, NV y) |
2892 | find_widget (SV *self, NV x, NV y) |
… | |
… | |
2896 | XPUSHs (self); |
2896 | XPUSHs (self); |
2897 | } |
2897 | } |
2898 | |
2898 | |
2899 | BOOT: |
2899 | BOOT: |
2900 | { |
2900 | { |
2901 | hover_gv = gv_fetchpv ("CFPlus::UI::HOVER", 1, SVt_NV); |
2901 | hover_gv = gv_fetchpv ("DC::UI::HOVER", 1, SVt_NV); |
2902 | |
2902 | |
2903 | draw_x_gv = gv_fetchpv ("CFPlus::UI::Base::draw_x", 1, SVt_NV); |
2903 | draw_x_gv = gv_fetchpv ("DC::UI::Base::draw_x", 1, SVt_NV); |
2904 | draw_y_gv = gv_fetchpv ("CFPlus::UI::Base::draw_y", 1, SVt_NV); |
2904 | draw_y_gv = gv_fetchpv ("DC::UI::Base::draw_y", 1, SVt_NV); |
2905 | draw_w_gv = gv_fetchpv ("CFPlus::UI::Base::draw_w", 1, SVt_NV); |
2905 | draw_w_gv = gv_fetchpv ("DC::UI::Base::draw_w", 1, SVt_NV); |
2906 | draw_h_gv = gv_fetchpv ("CFPlus::UI::Base::draw_h", 1, SVt_NV); |
2906 | draw_h_gv = gv_fetchpv ("DC::UI::Base::draw_h", 1, SVt_NV); |
2907 | } |
2907 | } |
2908 | |
2908 | |
2909 | void |
2909 | void |
2910 | draw (SV *self) |
2910 | draw (SV *self) |
2911 | CODE: |
2911 | CODE: |
… | |
… | |
2918 | SV *draw_w_sv = GvSV (draw_w_gv); |
2918 | SV *draw_w_sv = GvSV (draw_w_gv); |
2919 | SV *draw_h_sv = GvSV (draw_h_gv); |
2919 | SV *draw_h_sv = GvSV (draw_h_gv); |
2920 | double draw_x, draw_y; |
2920 | double draw_x, draw_y; |
2921 | |
2921 | |
2922 | if (!SvROK (self)) |
2922 | if (!SvROK (self)) |
2923 | croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); |
2923 | croak ("DC::Base::draw: %s not a reference", SvPV_nolen (self)); |
2924 | |
2924 | |
2925 | hv = (HV *)SvRV (self); |
2925 | hv = (HV *)SvRV (self); |
2926 | |
2926 | |
2927 | if (SvTYPE (hv) != SVt_PVHV) |
2927 | if (SvTYPE (hv) != SVt_PVHV) |
2928 | croak ("CFPlus::Base::draw: %s not a hashref", SvPV_nolen (self)); |
2928 | croak ("DC::Base::draw: %s not a hashref", SvPV_nolen (self)); |
2929 | |
2929 | |
2930 | svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; |
2930 | svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; |
2931 | svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.; |
2931 | svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.; |
2932 | |
2932 | |
2933 | if (!h || !w) |
2933 | if (!h || !w) |