… | |
… | |
33 | typedef signed char int8_t; |
33 | typedef signed char int8_t; |
34 | typedef signed short int16_t; |
34 | typedef signed short int16_t; |
35 | typedef signed int int32_t; |
35 | typedef signed int int32_t; |
36 | #endif |
36 | #endif |
37 | |
37 | |
|
|
38 | #include "glext.h" |
|
|
39 | |
38 | #define FOW_DARKNESS 32 |
40 | #define FOW_DARKNESS 32 |
39 | |
41 | |
40 | #define MAP_EXTEND_X 32 |
42 | #define MAP_EXTEND_X 32 |
41 | #define MAP_EXTEND_Y 512 |
43 | #define MAP_EXTEND_Y 512 |
|
|
44 | |
|
|
45 | #define MIN_FONT_HEIGHT 8 * PANGO_SCALE |
42 | |
46 | |
43 | typedef Mix_Chunk *CFClient__MixChunk; |
47 | typedef Mix_Chunk *CFClient__MixChunk; |
44 | typedef Mix_Music *CFClient__MixMusic; |
48 | typedef Mix_Music *CFClient__MixMusic; |
45 | |
49 | |
46 | static PangoContext *context; |
50 | static PangoContext *context; |
… | |
… | |
62 | layout_update (CFClient__Layout self) |
66 | layout_update (CFClient__Layout self) |
63 | { |
67 | { |
64 | /* use a random scale factor to account for unknown descenders, 0.8 works |
68 | /* use a random scale factor to account for unknown descenders, 0.8 works |
65 | * reasonably well with bitstream vera |
69 | * reasonably well with bitstream vera |
66 | */ |
70 | */ |
67 | PangoFontDescription *font = pango_context_get_font_description (context); |
71 | PangoFontDescription *font = (PangoFontDescription *) |
|
|
72 | pango_layout_get_font_description (self->pl); |
68 | |
73 | |
69 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
74 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
|
|
75 | |
|
|
76 | if (height < MIN_FONT_HEIGHT) |
|
|
77 | height = MIN_FONT_HEIGHT; |
70 | |
78 | |
71 | if (pango_font_description_get_size (font) != height) |
79 | if (pango_font_description_get_size (font) != height) |
72 | { |
80 | { |
|
|
81 | font = pango_font_description_copy (font); |
73 | pango_font_description_set_absolute_size (font, height); |
82 | pango_font_description_set_absolute_size (font, height); |
74 | pango_layout_context_changed (self->pl); |
83 | pango_layout_set_font_description (self->pl, font); |
75 | } |
84 | } |
76 | } |
85 | } |
77 | |
86 | |
78 | static void |
87 | static void |
79 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
88 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
… | |
… | |
237 | break; |
246 | break; |
238 | |
247 | |
239 | row->col[x - row->c0].darkness = -1; |
248 | row->col[x - row->c0].darkness = -1; |
240 | } |
249 | } |
241 | } |
250 | } |
|
|
251 | } |
|
|
252 | |
|
|
253 | static void |
|
|
254 | music_finished () |
|
|
255 | { |
|
|
256 | SDL_UserEvent ev; |
|
|
257 | |
|
|
258 | ev.type = SDL_USEREVENT; |
|
|
259 | ev.code = 0; |
|
|
260 | ev.data1 = 0; |
|
|
261 | ev.data2 = 0; |
|
|
262 | |
|
|
263 | SDL_PushEvent ((SDL_Event *)&ev); |
242 | } |
264 | } |
243 | |
265 | |
244 | MODULE = CFClient PACKAGE = CFClient |
266 | MODULE = CFClient PACKAGE = CFClient |
245 | |
267 | |
246 | PROTOTYPES: ENABLE |
268 | PROTOTYPES: ENABLE |
… | |
… | |
463 | } |
485 | } |
464 | } |
486 | } |
465 | |
487 | |
466 | int |
488 | int |
467 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
489 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
|
|
490 | POSTCALL: |
|
|
491 | Mix_HookMusicFinished (music_finished); |
468 | |
492 | |
469 | void |
493 | void |
470 | Mix_CloseAudio () |
494 | Mix_CloseAudio () |
471 | |
495 | |
472 | int |
496 | int |
… | |
… | |
504 | { |
528 | { |
505 | int count; |
529 | int count; |
506 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
530 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
507 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
531 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
508 | FcPatternDestroy (pattern); |
532 | FcPatternDestroy (pattern); |
|
|
533 | pango_font_description_set_absolute_size (font, MIN_FONT_HEIGHT); |
509 | pango_context_set_font_description (context, font); |
534 | pango_context_set_font_description (context, font); |
510 | } |
535 | } |
511 | |
536 | |
512 | void |
537 | void |
513 | load_image_inline (SV *image_) |
538 | load_image_inline (SV *image_) |
… | |
… | |
615 | CODE: |
640 | CODE: |
616 | New (0, RETVAL, 1, struct cf_layout); |
641 | New (0, RETVAL, 1, struct cf_layout); |
617 | RETVAL->base_height = base_height; |
642 | RETVAL->base_height = base_height; |
618 | RETVAL->pl = pango_layout_new (context); |
643 | RETVAL->pl = pango_layout_new (context); |
619 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
644 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
|
|
645 | pango_layout_set_font_description (RETVAL->pl, |
|
|
646 | pango_font_description_copy ( |
|
|
647 | pango_context_get_font_description (context))); |
620 | OUTPUT: |
648 | OUTPUT: |
621 | RETVAL |
649 | RETVAL |
622 | |
650 | |
623 | void |
651 | void |
624 | DESTROY (CFClient::Layout self) |
652 | DESTROY (CFClient::Layout self) |
… | |
… | |
1308 | const_iv (GL_TEXTURE_WRAP_T), |
1336 | const_iv (GL_TEXTURE_WRAP_T), |
1309 | const_iv (GL_CLAMP), |
1337 | const_iv (GL_CLAMP), |
1310 | const_iv (GL_REPEAT), |
1338 | const_iv (GL_REPEAT), |
1311 | const_iv (GL_NEAREST), |
1339 | const_iv (GL_NEAREST), |
1312 | const_iv (GL_LINEAR), |
1340 | const_iv (GL_LINEAR), |
|
|
1341 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
|
|
1342 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
|
|
1343 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
|
|
1344 | const_iv (GL_LINEAR_MIPMAP_LINEAR), |
|
|
1345 | const_iv (GL_GENERATE_MIPMAP), |
|
|
1346 | const_iv (GL_LINEAR), |
1313 | const_iv (GL_MODULATE), |
1347 | const_iv (GL_MODULATE), |
1314 | const_iv (GL_REPLACE), |
1348 | const_iv (GL_REPLACE), |
1315 | const_iv (GL_COLOR_BUFFER_BIT), |
1349 | const_iv (GL_COLOR_BUFFER_BIT), |
1316 | const_iv (GL_PROJECTION), |
1350 | const_iv (GL_PROJECTION), |
1317 | const_iv (GL_MODELVIEW), |
1351 | const_iv (GL_MODELVIEW), |