gosu 0.14.5 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/COPYING +1 -1
  4. data/Gosu/Channel.h +25 -0
  5. data/Gosu/Color.h +38 -0
  6. data/Gosu/Font.h +36 -0
  7. data/Gosu/Gosu.h +79 -0
  8. data/Gosu/Image.h +54 -0
  9. data/Gosu/Sample.h +19 -0
  10. data/Gosu/Song.h +24 -0
  11. data/Gosu/TextInput.h +30 -0
  12. data/Gosu/Version.hpp +2 -2
  13. data/Gosu/Window.h +61 -0
  14. data/Gosu/Window.hpp +3 -2
  15. data/README.md +1 -1
  16. data/ext/gosu/extconf.rb +3 -0
  17. data/lib/gosu/compat.rb +12 -7
  18. data/lib/gosu/patches.rb +8 -2
  19. data/lib/gosu/swig_patches.rb +20 -9
  20. data/rdoc/gosu.rb +28 -7
  21. data/src/ChannelWrapper.cpp +50 -0
  22. data/src/ColorWrapper.cpp +126 -0
  23. data/src/Constants.cpp +287 -0
  24. data/src/Font.cpp +1 -0
  25. data/src/FontWrapper.cpp +74 -0
  26. data/src/GosuWrapper.cpp +232 -0
  27. data/src/Graphics.cpp +4 -1
  28. data/src/GraphicsImpl.hpp +0 -1
  29. data/src/ImageWrapper.cpp +168 -0
  30. data/src/LargeImageData.cpp +1 -0
  31. data/src/MarkupParser.cpp +11 -3
  32. data/src/RubyGosu.cxx +185 -121
  33. data/src/RubyGosu.h +2 -2
  34. data/src/SampleWrapper.cpp +30 -0
  35. data/src/SongWrapper.cpp +52 -0
  36. data/src/TexChunk.cpp +29 -19
  37. data/src/Text.cpp +2 -0
  38. data/src/TextBuilder.cpp +3 -3
  39. data/src/TextInputWrapper.cpp +101 -0
  40. data/src/TrueTypeFont.cpp +1 -0
  41. data/src/Window.cpp +62 -28
  42. data/src/WindowUIKit.cpp +8 -4
  43. data/src/WindowWrapper.cpp +289 -0
  44. data/src/stb_image.h +153 -56
  45. data/src/stb_image_write.h +111 -60
  46. data/src/stb_truetype.h +74 -39
  47. data/src/stb_vorbis.c +55 -15
  48. data/src/utf8proc.c +47 -29
  49. data/src/utf8proc.h +46 -24
  50. data/src/utf8proc_data.h +10043 -9609
  51. metadata +23 -4
data/rdoc/gosu.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Encoding: UTF-8
1
+ ## Encoding: UTF-8
2
2
 
3
3
  module Gosu
4
4
  ##
@@ -50,6 +50,7 @@ module Gosu
50
50
  KB_LEFT_SHIFT = :an_integer
51
51
  KB_MINUS = :an_integer
52
52
  KB_NUMPAD_0…KB_NUMPAD_9 = :an_integer
53
+ KB_NUMPAD_DELETE = :an_integer
53
54
  KB_NUMPAD_DIVIDE = :an_integer
54
55
  KB_NUMPAD_MINUS = :an_integer
55
56
  KB_NUMPAD_MULTIPLY = :an_integer
@@ -189,10 +190,19 @@ module Gosu
189
190
 
190
191
  # @!endgroup
191
192
 
192
- # Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed order in memory and its integer value may vary depending on your system's byte order.
193
+ ##
194
+ # @return [Integer] a 32-bit representation of the color in 0xAARRGGBB format.
195
+ def argb; end
196
+
197
+ alias_method :to_i, :argb
198
+
199
+ # Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed format in memory and its integer value may vary depending on your system's byte order.
193
200
  #
194
201
  # @return [Integer] a 32-bit OpenGL color.
195
202
  def gl; end
203
+
204
+ # Returns an OpenGL integer constant that identifies the RGBA color format that Gosu uses.
205
+ GL_FORMAT = :some_integer
196
206
 
197
207
  ##
198
208
  # @return [Color] a copy of the color.
@@ -347,6 +357,14 @@ module Gosu
347
357
  # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki
348
358
  def initialize(source, options = {}); end
349
359
 
360
+ ##
361
+ # Creates a new image with the given dimensions and RGBA pixel data.
362
+ #
363
+ # @param [Integer] width Width of the image in pixels.
364
+ # @param [Integer] height Height of the image in pixels.
365
+ # @param [String] rgba A string containing raw binary image data, with either one byte ('uint8') or four bytes ('float') per RGBA component.
366
+ def self.from_blob(width, height, rgba = "\0\0\0\0" * (width * height)); end
367
+
350
368
  ##
351
369
  # Creates a reusable image from one or more lines of text.
352
370
  #
@@ -471,7 +489,6 @@ module Gosu
471
489
  # @return [Gosu::GLTexInfo?] information about the underlying OpenGL texture.
472
490
  #
473
491
  # @see Gosu::GLTexInfo
474
- # @see file:examples/OpenGLIntegration.rb
475
492
  def gl_tex_info; end
476
493
 
477
494
  ##
@@ -764,6 +781,10 @@ module Gosu
764
781
  ##
765
782
  # Toggles between windowed mode and fullscreen.
766
783
  attr_writer :fullscreen
784
+
785
+ ##
786
+ # @return [true, false] whether this window is resizable.
787
+ def resizable?; end
767
788
 
768
789
  ##
769
790
  # @return [Float] the interval between calls to {#update}, in milliseconds.
@@ -772,8 +793,9 @@ module Gosu
772
793
  ##
773
794
  # Creates a new window with the requested size.
774
795
  #
775
- # @note The actual window may be smaller if the requested size is too large for the current display resolution; in that case, Gosu will automatically scale all coordinates to transparently emulate a larger window. No need to thank us.
776
- #
796
+ # Resizable fullscreen windows always use the full desktop resolution.
797
+ # Windows that are larger than the desktop resolution will be shrunk.
798
+ #
777
799
  # @overload initialize(width, height, options = {})
778
800
  # @overload initialize(width, height, fullscreen, update_interval = 16.666666)
779
801
  #
@@ -781,6 +803,7 @@ module Gosu
781
803
  # @param height [Integer] the desired window height.
782
804
  # @param [Hash] options
783
805
  # @option options [true, false] :fullscreen (false) whether to present the window in fullscreen mode.
806
+ # @option options [true, false] :resizable (false) whether the window can be resized by the user.
784
807
  # @option options [Float] :update_interval (16.666666) the interval between frames, in milliseconds.
785
808
  def initialize(width, height, options); end
786
809
 
@@ -889,7 +912,6 @@ module Gosu
889
912
  # Can be retrieved from some images to use them in OpenGL operations.
890
913
  #
891
914
  # @see Gosu::Image#gl_tex_info
892
- # @see file:examples/OpenGLIntegration.rb
893
915
  class GLTexInfo
894
916
  ##
895
917
  # @return [Integer] OpenGL texture id
@@ -1040,7 +1062,6 @@ module Gosu
1040
1062
  #
1041
1063
  # @see Window#draw
1042
1064
  # @see file:reference/Z-Ordering
1043
- # @see file:examples/OpenGLIntegration.rb
1044
1065
  def gl(z=nil); end
1045
1066
 
1046
1067
  ##
@@ -0,0 +1,50 @@
1
+ #include <Gosu/Audio.hpp>
2
+ #include <Gosu/Channel.h>
3
+
4
+ extern "C" {
5
+
6
+ Gosu_Channel *Gosu_Channel_create(Gosu_Channel *channel)
7
+ {
8
+ return channel;
9
+ }
10
+
11
+ bool Gosu_Channel_playing(Gosu_Channel *channel)
12
+ {
13
+ return reinterpret_cast<Gosu::Channel *>(channel)->playing();
14
+ }
15
+ void Gosu_Channel_pause(Gosu_Channel *channel)
16
+ {
17
+ reinterpret_cast<Gosu::Channel *>(channel)->pause();
18
+ }
19
+ bool Gosu_Channel_paused(Gosu_Channel *channel)
20
+ {
21
+ return reinterpret_cast<Gosu::Channel *>(channel)->paused();
22
+ }
23
+ void Gosu_Channel_resume(Gosu_Channel *channel)
24
+ {
25
+ reinterpret_cast<Gosu::Channel *>(channel)->resume();
26
+ }
27
+ void Gosu_Channel_stop(Gosu_Channel *channel)
28
+ {
29
+ reinterpret_cast<Gosu::Channel *>(channel)->stop();
30
+ }
31
+
32
+ void Gosu_Channel_set_volume(Gosu_Channel *channel, double volume)
33
+ {
34
+ reinterpret_cast<Gosu::Channel *>(channel)->set_volume(volume);
35
+ }
36
+ void Gosu_Channel_set_speed(Gosu_Channel *channel, double speed)
37
+ {
38
+ reinterpret_cast<Gosu::Channel *>(channel)->set_speed(speed);
39
+ }
40
+ void Gosu_Channel_set_pan(Gosu_Channel *channel, double pan)
41
+ {
42
+ reinterpret_cast<Gosu::Channel *>(channel)->set_pan(pan);
43
+ }
44
+
45
+ void Gosu_Channel_destroy(Gosu_Channel *channel)
46
+ {
47
+ delete (reinterpret_cast<Gosu::Channel *>(channel));
48
+ }
49
+
50
+ }
@@ -0,0 +1,126 @@
1
+ #include <Gosu/Color.hpp>
2
+ #include <Gosu/Color.h>
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ unsigned Gosu_Color_create(unsigned argb)
9
+ {
10
+ return Gosu::Color(argb).argb();
11
+ }
12
+ unsigned Gosu_Color_create_argb(Gosu_Color_Channel a, Gosu_Color_Channel r, Gosu_Color_Channel g, Gosu_Color_Channel b)
13
+ {
14
+ return Gosu::Color(a, r, g, b).argb();
15
+ }
16
+ unsigned Gosu_Color_create_from_hsv(double h, double s, double v)
17
+ {
18
+ return Gosu::Color::from_hsv(h, s, v).argb();
19
+ }
20
+ unsigned Gosu_Color_create_from_ahsv(Gosu_Color_Channel alpha, double h, double s, double v)
21
+ {
22
+ return Gosu::Color::from_ahsv(alpha, h, s, v).argb();
23
+ }
24
+
25
+ Gosu_Color_Channel Gosu_Color_alpha(unsigned color)
26
+ {
27
+ return Gosu::Color(color).alpha();
28
+ }
29
+ Gosu_Color_Channel Gosu_Color_red(unsigned color)
30
+ {
31
+ return Gosu::Color(color).red();
32
+ }
33
+ Gosu_Color_Channel Gosu_Color_green(unsigned color)
34
+ {
35
+ return Gosu::Color(color).green();
36
+ }
37
+ Gosu_Color_Channel Gosu_Color_blue(unsigned color)
38
+ {
39
+ return Gosu::Color(color).blue();
40
+ }
41
+
42
+ unsigned Gosu_Color_set_alpha(unsigned color, Gosu_Color_Channel value)
43
+ {
44
+ Gosu::Color gosu_color = Gosu::Color(color);
45
+ gosu_color.set_alpha(value);
46
+
47
+ return gosu_color.argb();
48
+ }
49
+ unsigned Gosu_Color_set_red(unsigned color, Gosu_Color_Channel value)
50
+ {
51
+ Gosu::Color gosu_color = Gosu::Color(color);
52
+ gosu_color.set_red(value);
53
+
54
+ return gosu_color.argb();
55
+ }
56
+ unsigned Gosu_Color_set_green(unsigned color, Gosu_Color_Channel value)
57
+ {
58
+ Gosu::Color gosu_color = Gosu::Color(color);
59
+ gosu_color.set_green(value);
60
+
61
+ return gosu_color.argb();
62
+ }
63
+ unsigned Gosu_Color_set_blue(unsigned color, Gosu_Color_Channel value)
64
+ {
65
+ Gosu::Color gosu_color = Gosu::Color(color);
66
+ gosu_color.set_blue(value);
67
+
68
+ return gosu_color.argb();
69
+ }
70
+
71
+ double Gosu_Color_hue(unsigned color)
72
+ {
73
+ return Gosu::Color(color).hue();
74
+ }
75
+ double Gosu_Color_saturation(unsigned color)
76
+ {
77
+ return Gosu::Color(color).saturation();
78
+ }
79
+ double Gosu_Color_value(unsigned color)
80
+ {
81
+ return Gosu::Color(color).value();
82
+ }
83
+
84
+ unsigned Gosu_Color_set_hue(unsigned color, double value)
85
+ {
86
+ Gosu::Color gosu_color = Gosu::Color(color);
87
+ gosu_color.set_hue(value);
88
+
89
+ return gosu_color.argb();
90
+ }
91
+ unsigned Gosu_Color_set_saturation(unsigned color, double value)
92
+ {
93
+ Gosu::Color gosu_color = Gosu::Color(color);
94
+ gosu_color.set_saturation(value);
95
+
96
+ return gosu_color.argb();
97
+ }
98
+ unsigned Gosu_Color_set_value(unsigned color, double value)
99
+ {
100
+ Gosu::Color gosu_color = Gosu::Color(color);
101
+ gosu_color.set_value(value);
102
+
103
+ return gosu_color.argb();
104
+ }
105
+
106
+ unsigned Gosu_Color_argb(unsigned color)
107
+ {
108
+ return Gosu::Color(color).argb();
109
+ }
110
+ unsigned Gosu_Color_bgr(unsigned color)
111
+ {
112
+ return Gosu::Color(color).bgr();
113
+ }
114
+ unsigned Gosu_Color_abgr(unsigned color)
115
+ {
116
+ return Gosu::Color(color).abgr();
117
+ }
118
+
119
+ unsigned Gosu_Color_gl(unsigned color)
120
+ {
121
+ return color;
122
+ }
123
+
124
+ #ifdef __cplusplus
125
+ }
126
+ #endif
data/src/Constants.cpp ADDED
@@ -0,0 +1,287 @@
1
+ #include <Gosu/Version.hpp>
2
+ #include <Gosu/Buttons.hpp>
3
+ #include <Gosu/GraphicsBase.hpp>
4
+
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ const char *Gosu_version()
10
+ {
11
+ return Gosu::VERSION.c_str();
12
+ }
13
+
14
+ const char *Gosu_licenses()
15
+ {
16
+ return Gosu::LICENSES.c_str();
17
+ }
18
+
19
+ unsigned Gosu_MAJOR_VERSION = GOSU_MAJOR_VERSION;
20
+ unsigned Gosu_MINOR_VERSION = GOSU_MINOR_VERSION;
21
+ unsigned Gosu_POINT_VERSION = GOSU_POINT_VERSION;
22
+
23
+ // Alpha/Blend Modes
24
+ unsigned Gosu_AM_DEFAULT = Gosu::AM_DEFAULT;
25
+ unsigned Gosu_AM_INTERPOLATE = Gosu::AM_INTERPOLATE;
26
+ unsigned Gosu_AM_ADD = Gosu::AM_ADD;
27
+ unsigned Gosu_AM_MULTIPLY = Gosu::AM_MULTIPLY;
28
+
29
+ // Font Flags
30
+ unsigned Gosu_FF_BOLD = Gosu::FF_BOLD;
31
+ unsigned Gosu_FF_ITALIC = Gosu::FF_ITALIC;
32
+ unsigned Gosu_FF_UNDERLINE = Gosu::FF_UNDERLINE;
33
+ unsigned Gosu_FF_COMBINATIONS = Gosu::FF_COMBINATIONS;
34
+
35
+ // Alignment
36
+ unsigned Gosu_AL_LEFT = Gosu::AL_LEFT;
37
+ unsigned Gosu_AL_RIGHT = Gosu::AL_RIGHT;
38
+ unsigned Gosu_AL_CENTER = Gosu::AL_CENTER;
39
+ unsigned Gosu_AL_JUSTIFY = Gosu::AL_JUSTIFY;
40
+
41
+ // Image Flags
42
+ unsigned Gosu_IF_SMOOTH = Gosu::IF_SMOOTH;
43
+ unsigned Gosu_IF_TILEABLE_LEFT = Gosu::IF_TILEABLE_LEFT;
44
+ unsigned Gosu_IF_TILEABLE_TOP = Gosu::IF_TILEABLE_TOP;
45
+ unsigned Gosu_IF_TILEABLE_RIGHT = Gosu::IF_TILEABLE_RIGHT;
46
+ unsigned Gosu_IF_TILEABLE_BOTTOM = Gosu::IF_TILEABLE_BOTTOM;
47
+ unsigned Gosu_IF_TILEABLE = Gosu::IF_TILEABLE;
48
+ unsigned Gosu_IF_RETRO = Gosu::IF_RETRO;
49
+
50
+ unsigned Gosu_KB_RANGE_BEGIN = Gosu::KB_RANGE_BEGIN;
51
+ unsigned Gosu_KB_ESCAPE = Gosu::KB_ESCAPE;
52
+ unsigned Gosu_KB_F1 = Gosu::KB_F1;
53
+ unsigned Gosu_KB_F2 = Gosu::KB_F2;
54
+ unsigned Gosu_KB_F3 = Gosu::KB_F3;
55
+ unsigned Gosu_KB_F4 = Gosu::KB_F4;
56
+ unsigned Gosu_KB_F5 = Gosu::KB_F5;
57
+ unsigned Gosu_KB_F6 = Gosu::KB_F6;
58
+ unsigned Gosu_KB_F7 = Gosu::KB_F7;
59
+ unsigned Gosu_KB_F8 = Gosu::KB_F8;
60
+ unsigned Gosu_KB_F9 = Gosu::KB_F9;
61
+ unsigned Gosu_KB_F10 = Gosu::KB_F10;
62
+ unsigned Gosu_KB_F11 = Gosu::KB_F11;
63
+ unsigned Gosu_KB_F12 = Gosu::KB_F12;
64
+ unsigned Gosu_KB_0 = Gosu::KB_0;
65
+ unsigned Gosu_KB_1 = Gosu::KB_1;
66
+ unsigned Gosu_KB_2 = Gosu::KB_2;
67
+ unsigned Gosu_KB_3 = Gosu::KB_3;
68
+ unsigned Gosu_KB_4 = Gosu::KB_4;
69
+ unsigned Gosu_KB_5 = Gosu::KB_5;
70
+ unsigned Gosu_KB_6 = Gosu::KB_6;
71
+ unsigned Gosu_KB_7 = Gosu::KB_7;
72
+ unsigned Gosu_KB_8 = Gosu::KB_8;
73
+ unsigned Gosu_KB_9 = Gosu::KB_9;
74
+ unsigned Gosu_KB_TAB = Gosu::KB_TAB;
75
+ unsigned Gosu_KB_RETURN = Gosu::KB_RETURN;
76
+ unsigned Gosu_KB_SPACE = Gosu::KB_SPACE;
77
+ unsigned Gosu_KB_LEFT_SHIFT = Gosu::KB_LEFT_SHIFT;
78
+ unsigned Gosu_KB_RIGHT_SHIFT = Gosu::KB_RIGHT_SHIFT;
79
+ unsigned Gosu_KB_LEFT_CONTROL = Gosu::KB_LEFT_CONTROL;
80
+ unsigned Gosu_KB_RIGHT_CONTROL = Gosu::KB_RIGHT_CONTROL;
81
+ unsigned Gosu_KB_LEFT_ALT = Gosu::KB_LEFT_ALT;
82
+ unsigned Gosu_KB_RIGHT_ALT = Gosu::KB_RIGHT_ALT;
83
+ unsigned Gosu_KB_LEFT_META = Gosu::KB_LEFT_META;
84
+ unsigned Gosu_KB_RIGHT_META = Gosu::KB_RIGHT_META;
85
+ unsigned Gosu_KB_BACKSPACE = Gosu::KB_BACKSPACE;
86
+ unsigned Gosu_KB_LEFT = Gosu::KB_LEFT;
87
+ unsigned Gosu_KB_RIGHT = Gosu::KB_RIGHT;
88
+ unsigned Gosu_KB_UP = Gosu::KB_UP;
89
+ unsigned Gosu_KB_DOWN = Gosu::KB_DOWN;
90
+ unsigned Gosu_KB_HOME = Gosu::KB_HOME;
91
+ unsigned Gosu_KB_END = Gosu::KB_END;
92
+ unsigned Gosu_KB_INSERT = Gosu::KB_INSERT;
93
+ unsigned Gosu_KB_DELETE = Gosu::KB_DELETE;
94
+ unsigned Gosu_KB_PAGE_UP = Gosu::KB_PAGE_UP;
95
+ unsigned Gosu_KB_PAGE_DOWN = Gosu::KB_PAGE_DOWN;
96
+ unsigned Gosu_KB_ENTER = Gosu::KB_ENTER;
97
+ unsigned Gosu_KB_BACKTICK = Gosu::KB_BACKTICK;
98
+ unsigned Gosu_KB_MINUS = Gosu::KB_MINUS;
99
+ unsigned Gosu_KB_EQUALS = Gosu::KB_EQUALS;
100
+ unsigned Gosu_KB_LEFT_BRACKET = Gosu::KB_LEFT_BRACKET;
101
+ unsigned Gosu_KB_RIGHT_BRACKET = Gosu::KB_RIGHT_BRACKET;
102
+ unsigned Gosu_KB_BACKSLASH = Gosu::KB_BACKSLASH;
103
+ unsigned Gosu_KB_SEMICOLON = Gosu::KB_SEMICOLON;
104
+ unsigned Gosu_KB_APOSTROPHE = Gosu::KB_APOSTROPHE;
105
+ unsigned Gosu_KB_COMMA = Gosu::KB_COMMA;
106
+ unsigned Gosu_KB_PERIOD = Gosu::KB_PERIOD;
107
+ unsigned Gosu_KB_SLASH = Gosu::KB_SLASH;
108
+ unsigned Gosu_KB_A = Gosu::KB_A;
109
+ unsigned Gosu_KB_B = Gosu::KB_B;
110
+ unsigned Gosu_KB_C = Gosu::KB_C;
111
+ unsigned Gosu_KB_D = Gosu::KB_D;
112
+ unsigned Gosu_KB_E = Gosu::KB_E;
113
+ unsigned Gosu_KB_F = Gosu::KB_F;
114
+ unsigned Gosu_KB_G = Gosu::KB_G;
115
+ unsigned Gosu_KB_H = Gosu::KB_H;
116
+ unsigned Gosu_KB_I = Gosu::KB_I;
117
+ unsigned Gosu_KB_J = Gosu::KB_J;
118
+ unsigned Gosu_KB_K = Gosu::KB_K;
119
+ unsigned Gosu_KB_L = Gosu::KB_L;
120
+ unsigned Gosu_KB_M = Gosu::KB_M;
121
+ unsigned Gosu_KB_N = Gosu::KB_N;
122
+ unsigned Gosu_KB_O = Gosu::KB_O;
123
+ unsigned Gosu_KB_P = Gosu::KB_P;
124
+ unsigned Gosu_KB_Q = Gosu::KB_Q;
125
+ unsigned Gosu_KB_R = Gosu::KB_R;
126
+ unsigned Gosu_KB_S = Gosu::KB_S;
127
+ unsigned Gosu_KB_T = Gosu::KB_T;
128
+ unsigned Gosu_KB_U = Gosu::KB_U;
129
+ unsigned Gosu_KB_V = Gosu::KB_V;
130
+ unsigned Gosu_KB_W = Gosu::KB_W;
131
+ unsigned Gosu_KB_X = Gosu::KB_X;
132
+ unsigned Gosu_KB_Y = Gosu::KB_Y;
133
+ unsigned Gosu_KB_Z = Gosu::KB_Z;
134
+ unsigned Gosu_KB_ISO = Gosu::KB_ISO;
135
+ unsigned Gosu_KB_NUMPAD_0 = Gosu::KB_NUMPAD_0;
136
+ unsigned Gosu_KB_NUMPAD_1 = Gosu::KB_NUMPAD_1;
137
+ unsigned Gosu_KB_NUMPAD_2 = Gosu::KB_NUMPAD_2;
138
+ unsigned Gosu_KB_NUMPAD_3 = Gosu::KB_NUMPAD_3;
139
+ unsigned Gosu_KB_NUMPAD_4 = Gosu::KB_NUMPAD_4;
140
+ unsigned Gosu_KB_NUMPAD_5 = Gosu::KB_NUMPAD_5;
141
+ unsigned Gosu_KB_NUMPAD_6 = Gosu::KB_NUMPAD_6;
142
+ unsigned Gosu_KB_NUMPAD_7 = Gosu::KB_NUMPAD_7;
143
+ unsigned Gosu_KB_NUMPAD_8 = Gosu::KB_NUMPAD_8;
144
+ unsigned Gosu_KB_NUMPAD_9 = Gosu::KB_NUMPAD_9;
145
+ unsigned Gosu_KB_NUMPAD_DELETE = Gosu::KB_NUMPAD_DELETE;
146
+ unsigned Gosu_KB_NUMPAD_PLUS = Gosu::KB_NUMPAD_PLUS;
147
+ unsigned Gosu_KB_NUMPAD_MINUS = Gosu::KB_NUMPAD_MINUS;
148
+ unsigned Gosu_KB_NUMPAD_MULTIPLY = Gosu::KB_NUMPAD_MULTIPLY;
149
+ unsigned Gosu_KB_NUMPAD_DIVIDE = Gosu::KB_NUMPAD_DIVIDE;
150
+ unsigned Gosu_KB_RANGE_END = Gosu::KB_RANGE_END;
151
+
152
+ unsigned Gosu_MS_RANGE_BEGIN = Gosu::MS_RANGE_BEGIN;
153
+ unsigned Gosu_MS_LEFT = Gosu::MS_LEFT;
154
+ unsigned Gosu_MS_MIDDLE = Gosu::MS_MIDDLE;
155
+ unsigned Gosu_MS_RIGHT = Gosu::MS_RIGHT;
156
+ unsigned Gosu_MS_WHEEL_UP = Gosu::MS_WHEEL_UP;
157
+ unsigned Gosu_MS_WHEEL_DOWN = Gosu::MS_WHEEL_DOWN;
158
+ unsigned Gosu_MS_OTHER_0 = Gosu::MS_OTHER_0;
159
+ unsigned Gosu_MS_OTHER_1 = Gosu::MS_OTHER_1;
160
+ unsigned Gosu_MS_OTHER_2 = Gosu::MS_OTHER_2;
161
+ unsigned Gosu_MS_OTHER_3 = Gosu::MS_OTHER_3;
162
+ unsigned Gosu_MS_OTHER_4 = Gosu::MS_OTHER_4;
163
+ unsigned Gosu_MS_OTHER_5 = Gosu::MS_OTHER_5;
164
+ unsigned Gosu_MS_OTHER_6 = Gosu::MS_OTHER_6;
165
+ unsigned Gosu_MS_OTHER_7 = Gosu::MS_OTHER_7;
166
+ unsigned Gosu_MS_RANGE_END = Gosu::MS_RANGE_END;
167
+
168
+ unsigned Gosu_GP_RANGE_BEGIN = Gosu::GP_RANGE_BEGIN;
169
+ unsigned Gosu_GP_LEFT = Gosu::GP_LEFT;
170
+ unsigned Gosu_GP_RIGHT = Gosu::GP_RIGHT;
171
+ unsigned Gosu_GP_UP = Gosu::GP_UP;
172
+ unsigned Gosu_GP_DOWN = Gosu::GP_DOWN;
173
+ unsigned Gosu_GP_BUTTON_0 = Gosu::GP_BUTTON_0;
174
+ unsigned Gosu_GP_BUTTON_1 = Gosu::GP_BUTTON_1;
175
+ unsigned Gosu_GP_BUTTON_2 = Gosu::GP_BUTTON_2;
176
+ unsigned Gosu_GP_BUTTON_3 = Gosu::GP_BUTTON_3;
177
+ unsigned Gosu_GP_BUTTON_4 = Gosu::GP_BUTTON_4;
178
+ unsigned Gosu_GP_BUTTON_5 = Gosu::GP_BUTTON_5;
179
+ unsigned Gosu_GP_BUTTON_6 = Gosu::GP_BUTTON_6;
180
+ unsigned Gosu_GP_BUTTON_7 = Gosu::GP_BUTTON_7;
181
+ unsigned Gosu_GP_BUTTON_8 = Gosu::GP_BUTTON_8;
182
+ unsigned Gosu_GP_BUTTON_9 = Gosu::GP_BUTTON_9;
183
+ unsigned Gosu_GP_BUTTON_10 = Gosu::GP_BUTTON_10;
184
+ unsigned Gosu_GP_BUTTON_11 = Gosu::GP_BUTTON_11;
185
+ unsigned Gosu_GP_BUTTON_12 = Gosu::GP_BUTTON_12;
186
+ unsigned Gosu_GP_BUTTON_13 = Gosu::GP_BUTTON_13;
187
+ unsigned Gosu_GP_BUTTON_14 = Gosu::GP_BUTTON_14;
188
+ unsigned Gosu_GP_BUTTON_15 = Gosu::GP_BUTTON_15;
189
+
190
+ unsigned Gosu_GP_0_LEFT = Gosu::GP_0_LEFT;
191
+ unsigned Gosu_GP_0_RIGHT = Gosu::GP_0_RIGHT;
192
+ unsigned Gosu_GP_0_UP = Gosu::GP_0_UP;
193
+ unsigned Gosu_GP_0_DOWN = Gosu::GP_0_DOWN;
194
+ unsigned Gosu_GP_0_BUTTON_0 = Gosu::GP_0_BUTTON_0;
195
+ unsigned Gosu_GP_0_BUTTON_1 = Gosu::GP_0_BUTTON_1;
196
+ unsigned Gosu_GP_0_BUTTON_2 = Gosu::GP_0_BUTTON_2;
197
+ unsigned Gosu_GP_0_BUTTON_3 = Gosu::GP_0_BUTTON_3;
198
+ unsigned Gosu_GP_0_BUTTON_4 = Gosu::GP_0_BUTTON_4;
199
+ unsigned Gosu_GP_0_BUTTON_5 = Gosu::GP_0_BUTTON_5;
200
+ unsigned Gosu_GP_0_BUTTON_6 = Gosu::GP_0_BUTTON_6;
201
+ unsigned Gosu_GP_0_BUTTON_7 = Gosu::GP_0_BUTTON_7;
202
+ unsigned Gosu_GP_0_BUTTON_8 = Gosu::GP_0_BUTTON_8;
203
+ unsigned Gosu_GP_0_BUTTON_9 = Gosu::GP_0_BUTTON_9;
204
+ unsigned Gosu_GP_0_BUTTON_10 = Gosu::GP_0_BUTTON_10;
205
+ unsigned Gosu_GP_0_BUTTON_11 = Gosu::GP_0_BUTTON_11;
206
+ unsigned Gosu_GP_0_BUTTON_12 = Gosu::GP_0_BUTTON_12;
207
+ unsigned Gosu_GP_0_BUTTON_13 = Gosu::GP_0_BUTTON_13;
208
+ unsigned Gosu_GP_0_BUTTON_14 = Gosu::GP_0_BUTTON_14;
209
+ unsigned Gosu_GP_0_BUTTON_15 = Gosu::GP_0_BUTTON_15;
210
+
211
+ unsigned Gosu_GP_1_LEFT = Gosu::GP_1_LEFT;
212
+ unsigned Gosu_GP_1_RIGHT = Gosu::GP_1_RIGHT;
213
+ unsigned Gosu_GP_1_UP = Gosu::GP_1_UP;
214
+ unsigned Gosu_GP_1_DOWN = Gosu::GP_1_DOWN;
215
+ unsigned Gosu_GP_1_BUTTON_0 = Gosu::GP_1_BUTTON_0;
216
+ unsigned Gosu_GP_1_BUTTON_1 = Gosu::GP_1_BUTTON_1;
217
+ unsigned Gosu_GP_1_BUTTON_2 = Gosu::GP_1_BUTTON_2;
218
+ unsigned Gosu_GP_1_BUTTON_3 = Gosu::GP_1_BUTTON_3;
219
+ unsigned Gosu_GP_1_BUTTON_4 = Gosu::GP_1_BUTTON_4;
220
+ unsigned Gosu_GP_1_BUTTON_5 = Gosu::GP_1_BUTTON_5;
221
+ unsigned Gosu_GP_1_BUTTON_6 = Gosu::GP_1_BUTTON_6;
222
+ unsigned Gosu_GP_1_BUTTON_7 = Gosu::GP_1_BUTTON_7;
223
+ unsigned Gosu_GP_1_BUTTON_8 = Gosu::GP_1_BUTTON_8;
224
+ unsigned Gosu_GP_1_BUTTON_9 = Gosu::GP_1_BUTTON_9;
225
+ unsigned Gosu_GP_1_BUTTON_10 = Gosu::GP_1_BUTTON_10;
226
+ unsigned Gosu_GP_1_BUTTON_11 = Gosu::GP_1_BUTTON_11;
227
+ unsigned Gosu_GP_1_BUTTON_12 = Gosu::GP_1_BUTTON_12;
228
+ unsigned Gosu_GP_1_BUTTON_13 = Gosu::GP_1_BUTTON_13;
229
+ unsigned Gosu_GP_1_BUTTON_14 = Gosu::GP_1_BUTTON_14;
230
+ unsigned Gosu_GP_1_BUTTON_15 = Gosu::GP_1_BUTTON_15;
231
+
232
+ unsigned Gosu_GP_2_LEFT = Gosu::GP_2_LEFT;
233
+ unsigned Gosu_GP_2_RIGHT = Gosu::GP_2_RIGHT;
234
+ unsigned Gosu_GP_2_UP = Gosu::GP_2_UP;
235
+ unsigned Gosu_GP_2_DOWN = Gosu::GP_2_DOWN;
236
+ unsigned Gosu_GP_2_BUTTON_0 = Gosu::GP_2_BUTTON_0;
237
+ unsigned Gosu_GP_2_BUTTON_1 = Gosu::GP_2_BUTTON_1;
238
+ unsigned Gosu_GP_2_BUTTON_2 = Gosu::GP_2_BUTTON_2;
239
+ unsigned Gosu_GP_2_BUTTON_3 = Gosu::GP_2_BUTTON_3;
240
+ unsigned Gosu_GP_2_BUTTON_4 = Gosu::GP_2_BUTTON_4;
241
+ unsigned Gosu_GP_2_BUTTON_5 = Gosu::GP_2_BUTTON_5;
242
+ unsigned Gosu_GP_2_BUTTON_6 = Gosu::GP_2_BUTTON_6;
243
+ unsigned Gosu_GP_2_BUTTON_7 = Gosu::GP_2_BUTTON_7;
244
+ unsigned Gosu_GP_2_BUTTON_8 = Gosu::GP_2_BUTTON_8;
245
+ unsigned Gosu_GP_2_BUTTON_9 = Gosu::GP_2_BUTTON_9;
246
+ unsigned Gosu_GP_2_BUTTON_10 = Gosu::GP_2_BUTTON_10;
247
+ unsigned Gosu_GP_2_BUTTON_11 = Gosu::GP_2_BUTTON_11;
248
+ unsigned Gosu_GP_2_BUTTON_12 = Gosu::GP_2_BUTTON_12;
249
+ unsigned Gosu_GP_2_BUTTON_13 = Gosu::GP_2_BUTTON_13;
250
+ unsigned Gosu_GP_2_BUTTON_14 = Gosu::GP_2_BUTTON_14;
251
+ unsigned Gosu_GP_2_BUTTON_15 = Gosu::GP_2_BUTTON_15;
252
+
253
+ unsigned Gosu_GP_3_LEFT = Gosu::GP_3_LEFT;
254
+ unsigned Gosu_GP_3_RIGHT = Gosu::GP_3_RIGHT;
255
+ unsigned Gosu_GP_3_UP = Gosu::GP_3_UP;
256
+ unsigned Gosu_GP_3_DOWN = Gosu::GP_3_DOWN;
257
+ unsigned Gosu_GP_3_BUTTON_0 = Gosu::GP_3_BUTTON_0;
258
+ unsigned Gosu_GP_3_BUTTON_1 = Gosu::GP_3_BUTTON_1;
259
+ unsigned Gosu_GP_3_BUTTON_2 = Gosu::GP_3_BUTTON_2;
260
+ unsigned Gosu_GP_3_BUTTON_3 = Gosu::GP_3_BUTTON_3;
261
+ unsigned Gosu_GP_3_BUTTON_4 = Gosu::GP_3_BUTTON_4;
262
+ unsigned Gosu_GP_3_BUTTON_5 = Gosu::GP_3_BUTTON_5;
263
+ unsigned Gosu_GP_3_BUTTON_6 = Gosu::GP_3_BUTTON_6;
264
+ unsigned Gosu_GP_3_BUTTON_7 = Gosu::GP_3_BUTTON_7;
265
+ unsigned Gosu_GP_3_BUTTON_8 = Gosu::GP_3_BUTTON_8;
266
+ unsigned Gosu_GP_3_BUTTON_9 = Gosu::GP_3_BUTTON_9;
267
+ unsigned Gosu_GP_3_BUTTON_10 = Gosu::GP_3_BUTTON_10;
268
+ unsigned Gosu_GP_3_BUTTON_11 = Gosu::GP_3_BUTTON_11;
269
+ unsigned Gosu_GP_3_BUTTON_12 = Gosu::GP_3_BUTTON_12;
270
+ unsigned Gosu_GP_3_BUTTON_13 = Gosu::GP_3_BUTTON_13;
271
+ unsigned Gosu_GP_3_BUTTON_14 = Gosu::GP_3_BUTTON_14;
272
+ unsigned Gosu_GP_3_BUTTON_15 = Gosu::GP_3_BUTTON_15;
273
+
274
+ unsigned Gosu_GP_RANGE_END = Gosu::GP_RANGE_END;
275
+
276
+ unsigned Gosu_NUM_BUTTONS = Gosu::NUM_BUTTONS;
277
+ unsigned Gosu_NUM_GAMEPADS = Gosu::NUM_GAMEPADS;
278
+ unsigned Gosu_NO_BUTTON = Gosu::NO_BUTTON;
279
+
280
+ unsigned Gosu_KB_NUM = Gosu::KB_NUM;
281
+ unsigned Gosu_MS_NUM = Gosu::MS_NUM;
282
+ unsigned Gosu_GP_NUM = Gosu::GP_NUM;
283
+ unsigned Gosu_GP_NUM_PER_GAMEPAD = Gosu::GP_NUM_PER_GAMEPAD;
284
+
285
+ #ifdef __cplusplus
286
+ }
287
+ #endif
data/src/Font.cpp CHANGED
@@ -10,6 +10,7 @@
10
10
  #include <array>
11
11
  #include <cassert>
12
12
  #include <map>
13
+ #include <stdexcept>
13
14
  using namespace std;
14
15
 
15
16
  static const int FONT_RENDER_SCALE = 2;
@@ -0,0 +1,74 @@
1
+ #include <Gosu/Gosu.hpp>
2
+
3
+ extern "C" {
4
+ #include <Gosu/Image.h>
5
+ #include <Gosu/Font.h>
6
+
7
+ Gosu_Font *Gosu_Font_create(int height, const char *name, unsigned flags)
8
+ {
9
+ return reinterpret_cast<Gosu_Font *>(new Gosu::Font(height, name, flags));
10
+ }
11
+
12
+ const char *Gosu_Font_name(Gosu_Font *font)
13
+ {
14
+ return reinterpret_cast<Gosu::Font *>(font)->name().c_str();
15
+ }
16
+
17
+ int Gosu_Font_height(Gosu_Font *font)
18
+ {
19
+ return reinterpret_cast<Gosu::Font *>(font)->height();
20
+ }
21
+
22
+ unsigned Gosu_Font_flags(Gosu_Font *font)
23
+ {
24
+ return reinterpret_cast<Gosu::Font *>(font)->flags();
25
+ }
26
+
27
+ double Gosu_Font_text_width(Gosu_Font *font, const char *text)
28
+ {
29
+ return reinterpret_cast<Gosu::Font *>(font)->text_width(text);
30
+ }
31
+
32
+ double Gosu_Font_markup_width(Gosu_Font *font, const char *text)
33
+ {
34
+ return reinterpret_cast<Gosu::Font *>(font)->markup_width(text);
35
+ }
36
+
37
+ void Gosu_Font_draw_text(Gosu_Font *font, const char *text, double x, double y, double z,
38
+ double scale_x, double scale_y, unsigned c, unsigned mode)
39
+ {
40
+ reinterpret_cast<Gosu::Font *>(font)->draw_text(text, x, y, z, scale_x, scale_y, c, (Gosu::AlphaMode)mode);
41
+ }
42
+
43
+ void Gosu_Font_draw_markup(Gosu_Font *font, const char *text, double x, double y, double z,
44
+ double scale_x, double scale_y, unsigned c, unsigned mode)
45
+ {
46
+ reinterpret_cast<Gosu::Font *>(font)->draw_markup(text, x, y, z, scale_x, scale_y, c, (Gosu::AlphaMode)mode);
47
+ }
48
+
49
+ void Gosu_Font_draw_text_rel(Gosu_Font *font, const char *text, double x, double y, double z,
50
+ double rel_x, double rel_y, double scale_x, double scale_y,
51
+ unsigned c, unsigned mode)
52
+ {
53
+ reinterpret_cast<Gosu::Font *>(font)->draw_text_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, c, (Gosu::AlphaMode)mode);
54
+ }
55
+
56
+ void Gosu_Font_draw_markup_rel(Gosu_Font *font, const char *text, double x, double y, double z,
57
+ double rel_x, double rel_y, double scale_x, double scale_y,
58
+ unsigned c, unsigned mode)
59
+ {
60
+ reinterpret_cast<Gosu::Font *>(font)->draw_markup_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, c, (Gosu::AlphaMode)mode);
61
+ }
62
+
63
+ void Gosu_Font_set_image(Gosu_Font *font, const char *codepoint, unsigned font_flags, Gosu_Image *image)
64
+ {
65
+
66
+ const Gosu::Image *gosu_image = reinterpret_cast<Gosu::Image *>(image);
67
+ reinterpret_cast<Gosu::Font *>(font)->set_image(codepoint, font_flags, *gosu_image);
68
+ }
69
+
70
+ void Gosu_Font_destroy(Gosu_Font *font)
71
+ {
72
+ delete (reinterpret_cast<Gosu::Font *>(font));
73
+ }
74
+ }