… | |
… | |
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 = pango_layout_get_font_description (self->pl); |
68 | |
72 | |
69 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
73 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
|
|
74 | |
|
|
75 | if (height < MIN_FONT_HEIGHT) |
|
|
76 | height = MIN_FONT_HEIGHT; |
70 | |
77 | |
71 | if (pango_font_description_get_size (font) != height) |
78 | if (pango_font_description_get_size (font) != height) |
72 | { |
79 | { |
|
|
80 | font = pango_font_description_copy (font); |
73 | pango_font_description_set_absolute_size (font, height); |
81 | pango_font_description_set_absolute_size (font, height); |
74 | pango_layout_context_changed (self->pl); |
82 | pango_layout_set_font_description (self->pl, font); |
75 | } |
83 | } |
76 | } |
84 | } |
77 | |
85 | |
78 | static void |
86 | static void |
79 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
87 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
… | |
… | |
249 | ev.type = SDL_USEREVENT; |
257 | ev.type = SDL_USEREVENT; |
250 | ev.code = 0; |
258 | ev.code = 0; |
251 | ev.data1 = 0; |
259 | ev.data1 = 0; |
252 | ev.data2 = 0; |
260 | ev.data2 = 0; |
253 | |
261 | |
254 | SDL_PushEvent (&ev); |
262 | SDL_PushEvent ((SDL_Event *)&ev); |
255 | } |
263 | } |
256 | |
264 | |
257 | MODULE = CFClient PACKAGE = CFClient |
265 | MODULE = CFClient PACKAGE = CFClient |
258 | |
266 | |
259 | PROTOTYPES: ENABLE |
267 | PROTOTYPES: ENABLE |
… | |
… | |
519 | { |
527 | { |
520 | int count; |
528 | int count; |
521 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
529 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
522 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
530 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
523 | FcPatternDestroy (pattern); |
531 | FcPatternDestroy (pattern); |
|
|
532 | pango_font_description_set_absolute_size (font, MIN_FONT_HEIGHT); |
524 | pango_context_set_font_description (context, font); |
533 | pango_context_set_font_description (context, font); |
525 | } |
534 | } |
526 | |
535 | |
527 | void |
536 | void |
528 | load_image_inline (SV *image_) |
537 | load_image_inline (SV *image_) |
… | |
… | |
630 | CODE: |
639 | CODE: |
631 | New (0, RETVAL, 1, struct cf_layout); |
640 | New (0, RETVAL, 1, struct cf_layout); |
632 | RETVAL->base_height = base_height; |
641 | RETVAL->base_height = base_height; |
633 | RETVAL->pl = pango_layout_new (context); |
642 | RETVAL->pl = pango_layout_new (context); |
634 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
643 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
|
|
644 | pango_layout_set_font_description (RETVAL->pl, |
|
|
645 | pango_font_description_copy ( |
|
|
646 | pango_context_get_font_description (context))); |
635 | OUTPUT: |
647 | OUTPUT: |
636 | RETVAL |
648 | RETVAL |
637 | |
649 | |
638 | void |
650 | void |
639 | DESTROY (CFClient::Layout self) |
651 | DESTROY (CFClient::Layout self) |
… | |
… | |
1323 | const_iv (GL_TEXTURE_WRAP_T), |
1335 | const_iv (GL_TEXTURE_WRAP_T), |
1324 | const_iv (GL_CLAMP), |
1336 | const_iv (GL_CLAMP), |
1325 | const_iv (GL_REPEAT), |
1337 | const_iv (GL_REPEAT), |
1326 | const_iv (GL_NEAREST), |
1338 | const_iv (GL_NEAREST), |
1327 | const_iv (GL_LINEAR), |
1339 | const_iv (GL_LINEAR), |
|
|
1340 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
|
|
1341 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
|
|
1342 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
|
|
1343 | const_iv (GL_LINEAR_MIPMAP_LINEAR), |
|
|
1344 | const_iv (GL_GENERATE_MIPMAP), |
|
|
1345 | const_iv (GL_LINEAR), |
1328 | const_iv (GL_MODULATE), |
1346 | const_iv (GL_MODULATE), |
1329 | const_iv (GL_REPLACE), |
1347 | const_iv (GL_REPLACE), |
1330 | const_iv (GL_COLOR_BUFFER_BIT), |
1348 | const_iv (GL_COLOR_BUFFER_BIT), |
1331 | const_iv (GL_PROJECTION), |
1349 | const_iv (GL_PROJECTION), |
1332 | const_iv (GL_MODELVIEW), |
1350 | const_iv (GL_MODELVIEW), |