… | |
… | |
7 | |
7 | |
8 | #include "EXTERN.h" |
8 | #include "EXTERN.h" |
9 | #include "perl.h" |
9 | #include "perl.h" |
10 | #include "XSUB.h" |
10 | #include "XSUB.h" |
11 | |
11 | |
|
|
12 | #include <math.h> |
12 | #include <string.h> |
13 | #include <string.h> |
13 | #include <stdio.h> |
14 | #include <stdio.h> |
14 | |
15 | |
15 | #include <SDL.h> |
16 | #include <SDL.h> |
16 | #include <SDL_endian.h> |
17 | #include <SDL_endian.h> |
… | |
… | |
83 | |
84 | |
84 | static void |
85 | static void |
85 | substitute_func (FcPattern *pattern, gpointer data) |
86 | substitute_func (FcPattern *pattern, gpointer data) |
86 | { |
87 | { |
87 | FcPatternAddBool (pattern, FC_HINTING , 1); |
88 | FcPatternAddBool (pattern, FC_HINTING , 1); |
|
|
89 | #ifdef _WIN32 |
88 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
90 | FcPatternAddBool (pattern, FC_AUTOHINT, 1); |
|
|
91 | #else |
|
|
92 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
|
|
93 | #endif |
89 | } |
94 | } |
90 | |
95 | |
91 | static void |
96 | static void |
92 | layout_update_font (CFClient__Layout self) |
97 | layout_update_font (CFClient__Layout self) |
93 | { |
98 | { |
… | |
… | |
438 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 5); |
443 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 5); |
439 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5); |
444 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5); |
440 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); |
445 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); |
441 | SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 1); |
446 | SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 1); |
442 | |
447 | |
|
|
448 | SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15); |
|
|
449 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0); |
|
|
450 | |
443 | SDL_GL_SetAttribute (SDL_GL_ACCUM_RED_SIZE, 0); |
451 | SDL_GL_SetAttribute (SDL_GL_ACCUM_RED_SIZE, 0); |
444 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
452 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
445 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
453 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
446 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
454 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
447 | |
455 | |
448 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
456 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
449 | SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15); |
|
|
450 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0); |
|
|
451 | |
457 | |
452 | SDL_EnableUNICODE (1); |
458 | SDL_EnableUNICODE (1); |
453 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
459 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
454 | |
460 | |
455 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
461 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
… | |
… | |
796 | |
802 | |
797 | void |
803 | void |
798 | set_width (CFClient::Layout self, int max_width = -1) |
804 | set_width (CFClient::Layout self, int max_width = -1) |
799 | CODE: |
805 | CODE: |
800 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
806 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
|
|
807 | |
|
|
808 | void |
|
|
809 | set_indent (CFClient::Layout self, int indent) |
|
|
810 | CODE: |
|
|
811 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
|
|
812 | |
|
|
813 | void |
|
|
814 | set_spacing (CFClient::Layout self, int spacing) |
|
|
815 | CODE: |
|
|
816 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
|
|
817 | |
|
|
818 | void |
|
|
819 | set_ellipsise (CFClient::Layout self, int ellipsise) |
|
|
820 | CODE: |
|
|
821 | pango_layout_set_ellipsize (self->pl, |
|
|
822 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
|
|
823 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
|
|
824 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
|
|
825 | : PANGO_ELLIPSIZE_NONE |
|
|
826 | ); |
|
|
827 | |
|
|
828 | void |
|
|
829 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
|
|
830 | CODE: |
|
|
831 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
801 | |
832 | |
802 | void |
833 | void |
803 | size (CFClient::Layout self) |
834 | size (CFClient::Layout self) |
804 | PPCODE: |
835 | PPCODE: |
805 | { |
836 | { |
… | |
… | |
1589 | void glEnd () |
1620 | void glEnd () |
1590 | |
1621 | |
1591 | void glColor (float r, float g, float b, float a = 1.0) |
1622 | void glColor (float r, float g, float b, float a = 1.0) |
1592 | PROTOTYPE: @ |
1623 | PROTOTYPE: @ |
1593 | CODE: |
1624 | CODE: |
1594 | // 255.999 is close enough to correctness (256 and clamp) |
1625 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1595 | glColor4ub (r * 255.999, g * 255.999, b * 255.999, a * 255.999); |
1626 | MIN ((int)(g * 255.f), 255), |
|
|
1627 | MIN ((int)(b * 255.f), 255), |
|
|
1628 | MIN ((int)(a * 255.f), 255)); |
1596 | |
1629 | |
1597 | void glVertex (float x, float y, float z = 0.) |
1630 | void glVertex (float x, float y, float z = 0.) |
1598 | CODE: |
1631 | CODE: |
1599 | glVertex3f (x, y, z); |
1632 | glVertex3f (x, y, z); |
1600 | |
1633 | |