gosu 1.4.6 → 2.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +2 -1
  3. data/dependencies/SDL/include/SDL_atomic.h +2 -3
  4. data/dependencies/SDL/include/SDL_audio.h +7 -7
  5. data/dependencies/SDL/include/SDL_blendmode.h +1 -1
  6. data/dependencies/SDL/include/SDL_endian.h +3 -3
  7. data/dependencies/SDL/include/SDL_gamecontroller.h +4 -4
  8. data/dependencies/SDL/include/SDL_hints.h +72 -28
  9. data/dependencies/SDL/include/SDL_joystick.h +8 -5
  10. data/dependencies/SDL/include/SDL_keycode.h +1 -1
  11. data/dependencies/SDL/include/SDL_main.h +7 -0
  12. data/dependencies/SDL/include/SDL_mouse.h +6 -7
  13. data/dependencies/SDL/include/SDL_mutex.h +79 -5
  14. data/dependencies/SDL/include/SDL_opengl_glext.h +5 -1
  15. data/dependencies/SDL/include/SDL_power.h +7 -8
  16. data/dependencies/SDL/include/SDL_render.h +5 -0
  17. data/dependencies/SDL/include/SDL_revision.h +2 -2
  18. data/dependencies/SDL/include/SDL_sensor.h +1 -1
  19. data/dependencies/SDL/include/SDL_stdinc.h +19 -11
  20. data/dependencies/SDL/include/SDL_thread.h +2 -2
  21. data/dependencies/SDL/include/SDL_version.h +2 -2
  22. data/dependencies/SDL/include/SDL_video.h +30 -2
  23. data/dependencies/SDL/include/begin_code.h +7 -7
  24. data/dependencies/SDL/include/close_code.h +2 -2
  25. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  26. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  27. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  28. data/dependencies/SDL_sound/dr_flac.h +48 -23
  29. data/dependencies/SDL_sound/dr_mp3.h +34 -14
  30. data/dependencies/SDL_sound/stb_vorbis.h +3 -2
  31. data/dependencies/mojoAL/mojoal.c +1 -1
  32. data/ext/{gosu → gosu-ffi}/extconf.rb +34 -33
  33. data/ext/gosu-ffi/gosu-ffi.def +464 -0
  34. data/ffi/Gosu.cpp +307 -0
  35. data/ffi/Gosu.h +84 -0
  36. data/ffi/Gosu_Channel.cpp +62 -0
  37. data/ffi/Gosu_Channel.h +17 -0
  38. data/ffi/Gosu_Color.cpp +132 -0
  39. data/ffi/Gosu_Color.h +31 -0
  40. data/ffi/Gosu_Constants.cpp +334 -0
  41. data/ffi/Gosu_FFI.h +34 -0
  42. data/ffi/Gosu_FFI_internal.h +161 -0
  43. data/ffi/Gosu_Font.cpp +92 -0
  44. data/ffi/Gosu_Font.h +32 -0
  45. data/ffi/Gosu_Image.cpp +206 -0
  46. data/ffi/Gosu_Image.h +60 -0
  47. data/ffi/Gosu_Sample.cpp +29 -0
  48. data/ffi/Gosu_Sample.h +14 -0
  49. data/ffi/Gosu_Song.cpp +69 -0
  50. data/ffi/Gosu_Song.h +18 -0
  51. data/ffi/Gosu_TextInput.cpp +94 -0
  52. data/ffi/Gosu_TextInput.h +25 -0
  53. data/ffi/Gosu_Window.cpp +314 -0
  54. data/ffi/Gosu_Window.h +78 -0
  55. data/include/Gosu/Audio.hpp +6 -11
  56. data/include/Gosu/Bitmap.hpp +38 -53
  57. data/include/Gosu/Buffer.hpp +54 -0
  58. data/include/Gosu/Color.hpp +27 -35
  59. data/include/Gosu/Directories.hpp +25 -28
  60. data/include/Gosu/Drawable.hpp +58 -0
  61. data/include/Gosu/Font.hpp +6 -5
  62. data/include/Gosu/Fwd.hpp +4 -6
  63. data/include/Gosu/Gosu.hpp +5 -5
  64. data/include/Gosu/Graphics.hpp +51 -61
  65. data/include/Gosu/GraphicsBase.hpp +1 -11
  66. data/include/Gosu/Image.hpp +11 -14
  67. data/include/Gosu/Math.hpp +50 -72
  68. data/include/Gosu/Transform.hpp +32 -0
  69. data/include/Gosu/Utility.hpp +51 -1
  70. data/include/Gosu/Version.hpp +3 -3
  71. data/include/Gosu/Window.hpp +15 -9
  72. data/lib/SDL2.dll +0 -0
  73. data/lib/gosu/channel.rb +49 -0
  74. data/lib/gosu/color.rb +150 -0
  75. data/lib/gosu/compat.rb +29 -8
  76. data/lib/gosu/constants.rb +386 -0
  77. data/lib/gosu/ffi.rb +258 -0
  78. data/lib/gosu/font.rb +56 -0
  79. data/lib/gosu/gl_tex_info.rb +33 -0
  80. data/lib/gosu/gosu.rb +210 -0
  81. data/lib/gosu/image.rb +141 -0
  82. data/lib/gosu/numeric.rb +17 -0
  83. data/lib/gosu/preview.rb +6 -6
  84. data/lib/gosu/sample.rb +24 -0
  85. data/lib/gosu/song.rb +56 -0
  86. data/lib/gosu/text_input.rb +69 -0
  87. data/lib/gosu/window.rb +228 -0
  88. data/lib/gosu.rb +29 -8
  89. data/lib64/SDL2.dll +0 -0
  90. data/rdoc/gosu.rb +0 -2
  91. data/src/Audio.cpp +12 -12
  92. data/src/AudioFile.hpp +5 -4
  93. data/src/AudioFileAudioToolbox.cpp +8 -8
  94. data/src/AudioFileSDLSound.cpp +7 -10
  95. data/src/BinPacker.cpp +187 -0
  96. data/src/BinPacker.hpp +55 -0
  97. data/src/Bitmap.cpp +166 -144
  98. data/src/BitmapIO.cpp +60 -86
  99. data/src/Buffer.cpp +159 -0
  100. data/src/Color.cpp +75 -80
  101. data/src/Directories.cpp +47 -0
  102. data/src/DirectoriesUIKit.cpp +50 -0
  103. data/src/DrawOp.hpp +9 -4
  104. data/src/DrawOpQueue.hpp +2 -2
  105. data/src/Drawable.cpp +95 -0
  106. data/src/EmptyDrawable.hpp +38 -0
  107. data/src/FPS.cpp +31 -0
  108. data/src/Font.cpp +104 -74
  109. data/src/GosuGLView.cpp +14 -6
  110. data/src/GosuViewController.cpp +2 -10
  111. data/src/Graphics.cpp +60 -126
  112. data/src/GraphicsImpl.hpp +17 -47
  113. data/src/Image.cpp +41 -35
  114. data/src/Input.cpp +7 -8
  115. data/src/Macro.cpp +6 -6
  116. data/src/Macro.hpp +4 -4
  117. data/src/MarkupParser.cpp +5 -5
  118. data/src/Math.cpp +35 -22
  119. data/src/OffScreenTarget.cpp +53 -49
  120. data/src/OffScreenTarget.hpp +13 -11
  121. data/src/OpenGLContext.cpp +117 -0
  122. data/src/OpenGLContext.hpp +41 -0
  123. data/src/RenderState.hpp +21 -19
  124. data/src/Resolution.cpp +23 -21
  125. data/src/TexChunk.cpp +35 -80
  126. data/src/TexChunk.hpp +44 -35
  127. data/src/Text.cpp +1 -1
  128. data/src/TextBuilder.cpp +35 -21
  129. data/src/TextBuilder.hpp +6 -9
  130. data/src/Texture.cpp +62 -80
  131. data/src/Texture.hpp +25 -23
  132. data/src/TiledDrawable.cpp +150 -0
  133. data/src/TiledDrawable.hpp +47 -0
  134. data/src/TimingApple.cpp +1 -1
  135. data/src/Transform.cpp +45 -50
  136. data/src/TransformStack.hpp +16 -16
  137. data/src/TrueTypeFont.cpp +59 -51
  138. data/src/TrueTypeFont.hpp +6 -7
  139. data/src/TrueTypeFontApple.cpp +28 -19
  140. data/src/TrueTypeFontUnix.cpp +27 -23
  141. data/src/TrueTypeFontWin.cpp +30 -30
  142. data/src/Utility.cpp +84 -21
  143. data/src/UtilityWin.cpp +45 -0
  144. data/src/Window.cpp +92 -142
  145. data/src/WindowUIKit.cpp +14 -14
  146. metadata +72 -31
  147. data/include/Gosu/IO.hpp +0 -254
  148. data/include/Gosu/ImageData.hpp +0 -53
  149. data/include/Gosu/Inspection.hpp +0 -7
  150. data/lib/gosu/patches.rb +0 -66
  151. data/lib/gosu/run.rb +0 -20
  152. data/lib/gosu/swig_patches.rb +0 -110
  153. data/src/BlockAllocator.cpp +0 -131
  154. data/src/BlockAllocator.hpp +0 -32
  155. data/src/DirectoriesApple.cpp +0 -69
  156. data/src/DirectoriesUnix.cpp +0 -46
  157. data/src/DirectoriesWin.cpp +0 -65
  158. data/src/EmptyImageData.hpp +0 -52
  159. data/src/FileUnix.cpp +0 -99
  160. data/src/FileWin.cpp +0 -88
  161. data/src/IO.cpp +0 -60
  162. data/src/Iconv.hpp +0 -51
  163. data/src/Inspection.cpp +0 -27
  164. data/src/LargeImageData.cpp +0 -215
  165. data/src/LargeImageData.hpp +0 -39
  166. data/src/Log.hpp +0 -19
  167. data/src/RubyGosu.cxx +0 -13100
  168. data/src/RubyGosu.h +0 -49
  169. data/src/WinUtility.cpp +0 -61
  170. data/src/WinUtility.hpp +0 -27
@@ -0,0 +1,334 @@
1
+ #include "Gosu_FFI_internal.h"
2
+
3
+ GOSU_FFI_API const char* Gosu_version()
4
+ {
5
+ return Gosu::VERSION.c_str();
6
+ }
7
+
8
+ GOSU_FFI_API const char* Gosu_licenses()
9
+ {
10
+ return Gosu::LICENSES.c_str();
11
+ }
12
+
13
+ GOSU_FFI_API const unsigned Gosu_MAJOR_VERSION = GOSU_MAJOR_VERSION;
14
+ GOSU_FFI_API const unsigned Gosu_MINOR_VERSION = GOSU_MINOR_VERSION;
15
+ GOSU_FFI_API const unsigned Gosu_POINT_VERSION = GOSU_POINT_VERSION;
16
+
17
+ // Window Flags
18
+ GOSU_FFI_API const unsigned Gosu_WF_WINDOWED = Gosu::WF_WINDOWED;
19
+ GOSU_FFI_API const unsigned Gosu_WF_FULLSCREEN = Gosu::WF_FULLSCREEN;
20
+ GOSU_FFI_API const unsigned Gosu_WF_RESIZABLE = Gosu::WF_RESIZABLE;
21
+ GOSU_FFI_API const unsigned Gosu_WF_BORDERLESS = Gosu::WF_BORDERLESS;
22
+
23
+ // Blend Modes
24
+ GOSU_FFI_API const unsigned Gosu_BM_DEFAULT = Gosu::BM_DEFAULT;
25
+ GOSU_FFI_API const unsigned Gosu_BM_INTERPOLATE = Gosu::BM_INTERPOLATE;
26
+ GOSU_FFI_API const unsigned Gosu_BM_ADD = Gosu::BM_ADD;
27
+ GOSU_FFI_API const unsigned Gosu_BM_MULTIPLY = Gosu::BM_MULTIPLY;
28
+
29
+ // Font Flags
30
+ GOSU_FFI_API const unsigned Gosu_FF_BOLD = Gosu::FF_BOLD;
31
+ GOSU_FFI_API const unsigned Gosu_FF_ITALIC = Gosu::FF_ITALIC;
32
+ GOSU_FFI_API const unsigned Gosu_FF_UNDERLINE = Gosu::FF_UNDERLINE;
33
+ GOSU_FFI_API const unsigned Gosu_FF_COMBINATIONS = Gosu::FF_COMBINATIONS;
34
+
35
+ // Alignment
36
+ GOSU_FFI_API const unsigned Gosu_AL_LEFT = Gosu::AL_LEFT;
37
+ GOSU_FFI_API const unsigned Gosu_AL_RIGHT = Gosu::AL_RIGHT;
38
+ GOSU_FFI_API const unsigned Gosu_AL_CENTER = Gosu::AL_CENTER;
39
+ GOSU_FFI_API const unsigned Gosu_AL_JUSTIFY = Gosu::AL_JUSTIFY;
40
+
41
+ // Image Flags
42
+ GOSU_FFI_API const unsigned Gosu_IF_SMOOTH = Gosu::IF_SMOOTH;
43
+ GOSU_FFI_API const unsigned Gosu_IF_TILEABLE_LEFT = Gosu::IF_TILEABLE_LEFT;
44
+ GOSU_FFI_API const unsigned Gosu_IF_TILEABLE_TOP = Gosu::IF_TILEABLE_TOP;
45
+ GOSU_FFI_API const unsigned Gosu_IF_TILEABLE_RIGHT = Gosu::IF_TILEABLE_RIGHT;
46
+ GOSU_FFI_API const unsigned Gosu_IF_TILEABLE_BOTTOM = Gosu::IF_TILEABLE_BOTTOM;
47
+ GOSU_FFI_API const unsigned Gosu_IF_TILEABLE = Gosu::IF_TILEABLE;
48
+ GOSU_FFI_API const unsigned Gosu_IF_RETRO = Gosu::IF_RETRO;
49
+
50
+ GOSU_FFI_API const unsigned Gosu_KB_ESCAPE = Gosu::KB_ESCAPE;
51
+ GOSU_FFI_API const unsigned Gosu_KB_F1 = Gosu::KB_F1;
52
+ GOSU_FFI_API const unsigned Gosu_KB_F2 = Gosu::KB_F2;
53
+ GOSU_FFI_API const unsigned Gosu_KB_F3 = Gosu::KB_F3;
54
+ GOSU_FFI_API const unsigned Gosu_KB_F4 = Gosu::KB_F4;
55
+ GOSU_FFI_API const unsigned Gosu_KB_F5 = Gosu::KB_F5;
56
+ GOSU_FFI_API const unsigned Gosu_KB_F6 = Gosu::KB_F6;
57
+ GOSU_FFI_API const unsigned Gosu_KB_F7 = Gosu::KB_F7;
58
+ GOSU_FFI_API const unsigned Gosu_KB_F8 = Gosu::KB_F8;
59
+ GOSU_FFI_API const unsigned Gosu_KB_F9 = Gosu::KB_F9;
60
+ GOSU_FFI_API const unsigned Gosu_KB_F10 = Gosu::KB_F10;
61
+ GOSU_FFI_API const unsigned Gosu_KB_F11 = Gosu::KB_F11;
62
+ GOSU_FFI_API const unsigned Gosu_KB_F12 = Gosu::KB_F12;
63
+ GOSU_FFI_API const unsigned Gosu_KB_0 = Gosu::KB_0;
64
+ GOSU_FFI_API const unsigned Gosu_KB_1 = Gosu::KB_1;
65
+ GOSU_FFI_API const unsigned Gosu_KB_2 = Gosu::KB_2;
66
+ GOSU_FFI_API const unsigned Gosu_KB_3 = Gosu::KB_3;
67
+ GOSU_FFI_API const unsigned Gosu_KB_4 = Gosu::KB_4;
68
+ GOSU_FFI_API const unsigned Gosu_KB_5 = Gosu::KB_5;
69
+ GOSU_FFI_API const unsigned Gosu_KB_6 = Gosu::KB_6;
70
+ GOSU_FFI_API const unsigned Gosu_KB_7 = Gosu::KB_7;
71
+ GOSU_FFI_API const unsigned Gosu_KB_8 = Gosu::KB_8;
72
+ GOSU_FFI_API const unsigned Gosu_KB_9 = Gosu::KB_9;
73
+ GOSU_FFI_API const unsigned Gosu_KB_TAB = Gosu::KB_TAB;
74
+ GOSU_FFI_API const unsigned Gosu_KB_RETURN = Gosu::KB_RETURN;
75
+ GOSU_FFI_API const unsigned Gosu_KB_SPACE = Gosu::KB_SPACE;
76
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT_SHIFT = Gosu::KB_LEFT_SHIFT;
77
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT_SHIFT = Gosu::KB_RIGHT_SHIFT;
78
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT_CONTROL = Gosu::KB_LEFT_CONTROL;
79
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT_CONTROL = Gosu::KB_RIGHT_CONTROL;
80
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT_ALT = Gosu::KB_LEFT_ALT;
81
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT_ALT = Gosu::KB_RIGHT_ALT;
82
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT_META = Gosu::KB_LEFT_META;
83
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT_META = Gosu::KB_RIGHT_META;
84
+ GOSU_FFI_API const unsigned Gosu_KB_BACKSPACE = Gosu::KB_BACKSPACE;
85
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT = Gosu::KB_LEFT;
86
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT = Gosu::KB_RIGHT;
87
+ GOSU_FFI_API const unsigned Gosu_KB_UP = Gosu::KB_UP;
88
+ GOSU_FFI_API const unsigned Gosu_KB_DOWN = Gosu::KB_DOWN;
89
+ GOSU_FFI_API const unsigned Gosu_KB_HOME = Gosu::KB_HOME;
90
+ GOSU_FFI_API const unsigned Gosu_KB_END = Gosu::KB_END;
91
+ GOSU_FFI_API const unsigned Gosu_KB_PRINT_SCREEN = Gosu::KB_PRINT_SCREEN;
92
+ GOSU_FFI_API const unsigned Gosu_KB_SCROLL_LOCK = Gosu::KB_SCROLL_LOCK;
93
+ GOSU_FFI_API const unsigned Gosu_KB_PAUSE = Gosu::KB_PAUSE;
94
+ GOSU_FFI_API const unsigned Gosu_KB_INSERT = Gosu::KB_INSERT;
95
+ GOSU_FFI_API const unsigned Gosu_KB_DELETE = Gosu::KB_DELETE;
96
+ GOSU_FFI_API const unsigned Gosu_KB_PAGE_UP = Gosu::KB_PAGE_UP;
97
+ GOSU_FFI_API const unsigned Gosu_KB_PAGE_DOWN = Gosu::KB_PAGE_DOWN;
98
+ GOSU_FFI_API const unsigned Gosu_KB_ENTER = Gosu::KB_ENTER;
99
+ GOSU_FFI_API const unsigned Gosu_KB_BACKTICK = Gosu::KB_BACKTICK;
100
+ GOSU_FFI_API const unsigned Gosu_KB_MINUS = Gosu::KB_MINUS;
101
+ GOSU_FFI_API const unsigned Gosu_KB_EQUALS = Gosu::KB_EQUALS;
102
+ GOSU_FFI_API const unsigned Gosu_KB_LEFT_BRACKET = Gosu::KB_LEFT_BRACKET;
103
+ GOSU_FFI_API const unsigned Gosu_KB_RIGHT_BRACKET = Gosu::KB_RIGHT_BRACKET;
104
+ GOSU_FFI_API const unsigned Gosu_KB_BACKSLASH = Gosu::KB_BACKSLASH;
105
+ GOSU_FFI_API const unsigned Gosu_KB_SEMICOLON = Gosu::KB_SEMICOLON;
106
+ GOSU_FFI_API const unsigned Gosu_KB_APOSTROPHE = Gosu::KB_APOSTROPHE;
107
+ GOSU_FFI_API const unsigned Gosu_KB_COMMA = Gosu::KB_COMMA;
108
+ GOSU_FFI_API const unsigned Gosu_KB_PERIOD = Gosu::KB_PERIOD;
109
+ GOSU_FFI_API const unsigned Gosu_KB_SLASH = Gosu::KB_SLASH;
110
+ GOSU_FFI_API const unsigned Gosu_KB_CAPS_LOCK = Gosu::KB_CAPS_LOCK;
111
+ GOSU_FFI_API const unsigned Gosu_KB_A = Gosu::KB_A;
112
+ GOSU_FFI_API const unsigned Gosu_KB_B = Gosu::KB_B;
113
+ GOSU_FFI_API const unsigned Gosu_KB_C = Gosu::KB_C;
114
+ GOSU_FFI_API const unsigned Gosu_KB_D = Gosu::KB_D;
115
+ GOSU_FFI_API const unsigned Gosu_KB_E = Gosu::KB_E;
116
+ GOSU_FFI_API const unsigned Gosu_KB_F = Gosu::KB_F;
117
+ GOSU_FFI_API const unsigned Gosu_KB_G = Gosu::KB_G;
118
+ GOSU_FFI_API const unsigned Gosu_KB_H = Gosu::KB_H;
119
+ GOSU_FFI_API const unsigned Gosu_KB_I = Gosu::KB_I;
120
+ GOSU_FFI_API const unsigned Gosu_KB_J = Gosu::KB_J;
121
+ GOSU_FFI_API const unsigned Gosu_KB_K = Gosu::KB_K;
122
+ GOSU_FFI_API const unsigned Gosu_KB_L = Gosu::KB_L;
123
+ GOSU_FFI_API const unsigned Gosu_KB_M = Gosu::KB_M;
124
+ GOSU_FFI_API const unsigned Gosu_KB_N = Gosu::KB_N;
125
+ GOSU_FFI_API const unsigned Gosu_KB_O = Gosu::KB_O;
126
+ GOSU_FFI_API const unsigned Gosu_KB_P = Gosu::KB_P;
127
+ GOSU_FFI_API const unsigned Gosu_KB_Q = Gosu::KB_Q;
128
+ GOSU_FFI_API const unsigned Gosu_KB_R = Gosu::KB_R;
129
+ GOSU_FFI_API const unsigned Gosu_KB_S = Gosu::KB_S;
130
+ GOSU_FFI_API const unsigned Gosu_KB_T = Gosu::KB_T;
131
+ GOSU_FFI_API const unsigned Gosu_KB_U = Gosu::KB_U;
132
+ GOSU_FFI_API const unsigned Gosu_KB_V = Gosu::KB_V;
133
+ GOSU_FFI_API const unsigned Gosu_KB_W = Gosu::KB_W;
134
+ GOSU_FFI_API const unsigned Gosu_KB_X = Gosu::KB_X;
135
+ GOSU_FFI_API const unsigned Gosu_KB_Y = Gosu::KB_Y;
136
+ GOSU_FFI_API const unsigned Gosu_KB_Z = Gosu::KB_Z;
137
+ GOSU_FFI_API const unsigned Gosu_KB_ISO = Gosu::KB_ISO;
138
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_0 = Gosu::KB_NUMPAD_0;
139
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_1 = Gosu::KB_NUMPAD_1;
140
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_2 = Gosu::KB_NUMPAD_2;
141
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_3 = Gosu::KB_NUMPAD_3;
142
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_4 = Gosu::KB_NUMPAD_4;
143
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_5 = Gosu::KB_NUMPAD_5;
144
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_6 = Gosu::KB_NUMPAD_6;
145
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_7 = Gosu::KB_NUMPAD_7;
146
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_8 = Gosu::KB_NUMPAD_8;
147
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_9 = Gosu::KB_NUMPAD_9;
148
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_DELETE = Gosu::KB_NUMPAD_DELETE;
149
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_PLUS = Gosu::KB_NUMPAD_PLUS;
150
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_MINUS = Gosu::KB_NUMPAD_MINUS;
151
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_MULTIPLY = Gosu::KB_NUMPAD_MULTIPLY;
152
+ GOSU_FFI_API const unsigned Gosu_KB_NUMPAD_DIVIDE = Gosu::KB_NUMPAD_DIVIDE;
153
+
154
+ GOSU_FFI_API const unsigned Gosu_MS_LEFT = Gosu::MS_LEFT;
155
+ GOSU_FFI_API const unsigned Gosu_MS_MIDDLE = Gosu::MS_MIDDLE;
156
+ GOSU_FFI_API const unsigned Gosu_MS_RIGHT = Gosu::MS_RIGHT;
157
+ GOSU_FFI_API const unsigned Gosu_MS_WHEEL_UP = Gosu::MS_WHEEL_UP;
158
+ GOSU_FFI_API const unsigned Gosu_MS_WHEEL_DOWN = Gosu::MS_WHEEL_DOWN;
159
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_0 = Gosu::MS_OTHER_0;
160
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_1 = Gosu::MS_OTHER_1;
161
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_2 = Gosu::MS_OTHER_2;
162
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_3 = Gosu::MS_OTHER_3;
163
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_4 = Gosu::MS_OTHER_4;
164
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_5 = Gosu::MS_OTHER_5;
165
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_6 = Gosu::MS_OTHER_6;
166
+ GOSU_FFI_API const unsigned Gosu_MS_OTHER_7 = Gosu::MS_OTHER_7;
167
+
168
+ GOSU_FFI_API const unsigned Gosu_GP_DPAD_LEFT = Gosu::GP_DPAD_LEFT;
169
+ GOSU_FFI_API const unsigned Gosu_GP_DPAD_RIGHT = Gosu::GP_DPAD_RIGHT;
170
+ GOSU_FFI_API const unsigned Gosu_GP_DPAD_UP = Gosu::GP_DPAD_UP;
171
+ GOSU_FFI_API const unsigned Gosu_GP_DPAD_DOWN = Gosu::GP_DPAD_DOWN;
172
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_0 = Gosu::GP_BUTTON_0;
173
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_1 = Gosu::GP_BUTTON_1;
174
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_2 = Gosu::GP_BUTTON_2;
175
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_3 = Gosu::GP_BUTTON_3;
176
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_4 = Gosu::GP_BUTTON_4;
177
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_5 = Gosu::GP_BUTTON_5;
178
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_6 = Gosu::GP_BUTTON_6;
179
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_7 = Gosu::GP_BUTTON_7;
180
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_8 = Gosu::GP_BUTTON_8;
181
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_9 = Gosu::GP_BUTTON_9;
182
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_10 = Gosu::GP_BUTTON_10;
183
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_11 = Gosu::GP_BUTTON_11;
184
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_12 = Gosu::GP_BUTTON_12;
185
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_13 = Gosu::GP_BUTTON_13;
186
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_14 = Gosu::GP_BUTTON_14;
187
+ GOSU_FFI_API const unsigned Gosu_GP_BUTTON_15 = Gosu::GP_BUTTON_15;
188
+
189
+ GOSU_FFI_API const unsigned Gosu_GP_0_DPAD_LEFT = Gosu::GP_0_DPAD_LEFT;
190
+ GOSU_FFI_API const unsigned Gosu_GP_0_DPAD_RIGHT = Gosu::GP_0_DPAD_RIGHT;
191
+ GOSU_FFI_API const unsigned Gosu_GP_0_DPAD_UP = Gosu::GP_0_DPAD_UP;
192
+ GOSU_FFI_API const unsigned Gosu_GP_0_DPAD_DOWN = Gosu::GP_0_DPAD_DOWN;
193
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_0 = Gosu::GP_0_BUTTON_0;
194
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_1 = Gosu::GP_0_BUTTON_1;
195
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_2 = Gosu::GP_0_BUTTON_2;
196
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_3 = Gosu::GP_0_BUTTON_3;
197
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_4 = Gosu::GP_0_BUTTON_4;
198
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_5 = Gosu::GP_0_BUTTON_5;
199
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_6 = Gosu::GP_0_BUTTON_6;
200
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_7 = Gosu::GP_0_BUTTON_7;
201
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_8 = Gosu::GP_0_BUTTON_8;
202
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_9 = Gosu::GP_0_BUTTON_9;
203
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_10 = Gosu::GP_0_BUTTON_10;
204
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_11 = Gosu::GP_0_BUTTON_11;
205
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_12 = Gosu::GP_0_BUTTON_12;
206
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_13 = Gosu::GP_0_BUTTON_13;
207
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_14 = Gosu::GP_0_BUTTON_14;
208
+ GOSU_FFI_API const unsigned Gosu_GP_0_BUTTON_15 = Gosu::GP_0_BUTTON_15;
209
+
210
+ GOSU_FFI_API const unsigned Gosu_GP_1_DPAD_LEFT = Gosu::GP_1_DPAD_LEFT;
211
+ GOSU_FFI_API const unsigned Gosu_GP_1_DPAD_RIGHT = Gosu::GP_1_DPAD_RIGHT;
212
+ GOSU_FFI_API const unsigned Gosu_GP_1_DPAD_UP = Gosu::GP_1_DPAD_UP;
213
+ GOSU_FFI_API const unsigned Gosu_GP_1_DPAD_DOWN = Gosu::GP_1_DPAD_DOWN;
214
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_0 = Gosu::GP_1_BUTTON_0;
215
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_1 = Gosu::GP_1_BUTTON_1;
216
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_2 = Gosu::GP_1_BUTTON_2;
217
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_3 = Gosu::GP_1_BUTTON_3;
218
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_4 = Gosu::GP_1_BUTTON_4;
219
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_5 = Gosu::GP_1_BUTTON_5;
220
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_6 = Gosu::GP_1_BUTTON_6;
221
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_7 = Gosu::GP_1_BUTTON_7;
222
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_8 = Gosu::GP_1_BUTTON_8;
223
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_9 = Gosu::GP_1_BUTTON_9;
224
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_10 = Gosu::GP_1_BUTTON_10;
225
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_11 = Gosu::GP_1_BUTTON_11;
226
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_12 = Gosu::GP_1_BUTTON_12;
227
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_13 = Gosu::GP_1_BUTTON_13;
228
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_14 = Gosu::GP_1_BUTTON_14;
229
+ GOSU_FFI_API const unsigned Gosu_GP_1_BUTTON_15 = Gosu::GP_1_BUTTON_15;
230
+
231
+ GOSU_FFI_API const unsigned Gosu_GP_2_DPAD_LEFT = Gosu::GP_2_DPAD_LEFT;
232
+ GOSU_FFI_API const unsigned Gosu_GP_2_DPAD_RIGHT = Gosu::GP_2_DPAD_RIGHT;
233
+ GOSU_FFI_API const unsigned Gosu_GP_2_DPAD_UP = Gosu::GP_2_DPAD_UP;
234
+ GOSU_FFI_API const unsigned Gosu_GP_2_DPAD_DOWN = Gosu::GP_2_DPAD_DOWN;
235
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_0 = Gosu::GP_2_BUTTON_0;
236
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_1 = Gosu::GP_2_BUTTON_1;
237
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_2 = Gosu::GP_2_BUTTON_2;
238
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_3 = Gosu::GP_2_BUTTON_3;
239
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_4 = Gosu::GP_2_BUTTON_4;
240
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_5 = Gosu::GP_2_BUTTON_5;
241
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_6 = Gosu::GP_2_BUTTON_6;
242
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_7 = Gosu::GP_2_BUTTON_7;
243
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_8 = Gosu::GP_2_BUTTON_8;
244
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_9 = Gosu::GP_2_BUTTON_9;
245
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_10 = Gosu::GP_2_BUTTON_10;
246
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_11 = Gosu::GP_2_BUTTON_11;
247
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_12 = Gosu::GP_2_BUTTON_12;
248
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_13 = Gosu::GP_2_BUTTON_13;
249
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_14 = Gosu::GP_2_BUTTON_14;
250
+ GOSU_FFI_API const unsigned Gosu_GP_2_BUTTON_15 = Gosu::GP_2_BUTTON_15;
251
+
252
+ GOSU_FFI_API const unsigned Gosu_GP_3_DPAD_LEFT = Gosu::GP_3_DPAD_LEFT;
253
+ GOSU_FFI_API const unsigned Gosu_GP_3_DPAD_RIGHT = Gosu::GP_3_DPAD_RIGHT;
254
+ GOSU_FFI_API const unsigned Gosu_GP_3_DPAD_UP = Gosu::GP_3_DPAD_UP;
255
+ GOSU_FFI_API const unsigned Gosu_GP_3_DPAD_DOWN = Gosu::GP_3_DPAD_DOWN;
256
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_0 = Gosu::GP_3_BUTTON_0;
257
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_1 = Gosu::GP_3_BUTTON_1;
258
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_2 = Gosu::GP_3_BUTTON_2;
259
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_3 = Gosu::GP_3_BUTTON_3;
260
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_4 = Gosu::GP_3_BUTTON_4;
261
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_5 = Gosu::GP_3_BUTTON_5;
262
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_6 = Gosu::GP_3_BUTTON_6;
263
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_7 = Gosu::GP_3_BUTTON_7;
264
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_8 = Gosu::GP_3_BUTTON_8;
265
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_9 = Gosu::GP_3_BUTTON_9;
266
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_10 = Gosu::GP_3_BUTTON_10;
267
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_11 = Gosu::GP_3_BUTTON_11;
268
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_12 = Gosu::GP_3_BUTTON_12;
269
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_13 = Gosu::GP_3_BUTTON_13;
270
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_14 = Gosu::GP_3_BUTTON_14;
271
+ GOSU_FFI_API const unsigned Gosu_GP_3_BUTTON_15 = Gosu::GP_3_BUTTON_15;
272
+
273
+ GOSU_FFI_API const unsigned Gosu_GP_LEFT = Gosu::GP_LEFT;
274
+ GOSU_FFI_API const unsigned Gosu_GP_RIGHT = Gosu::GP_RIGHT;
275
+ GOSU_FFI_API const unsigned Gosu_GP_UP = Gosu::GP_UP;
276
+ GOSU_FFI_API const unsigned Gosu_GP_DOWN = Gosu::GP_DOWN;
277
+
278
+ GOSU_FFI_API const unsigned Gosu_GP_0_LEFT = Gosu::GP_0_LEFT;
279
+ GOSU_FFI_API const unsigned Gosu_GP_0_RIGHT = Gosu::GP_0_RIGHT;
280
+ GOSU_FFI_API const unsigned Gosu_GP_0_UP = Gosu::GP_0_UP;
281
+ GOSU_FFI_API const unsigned Gosu_GP_0_DOWN = Gosu::GP_0_DOWN;
282
+
283
+ GOSU_FFI_API const unsigned Gosu_GP_1_LEFT = Gosu::GP_1_LEFT;
284
+ GOSU_FFI_API const unsigned Gosu_GP_1_RIGHT = Gosu::GP_1_RIGHT;
285
+ GOSU_FFI_API const unsigned Gosu_GP_1_UP = Gosu::GP_1_UP;
286
+ GOSU_FFI_API const unsigned Gosu_GP_1_DOWN = Gosu::GP_1_DOWN;
287
+
288
+ GOSU_FFI_API const unsigned Gosu_GP_2_LEFT = Gosu::GP_2_LEFT;
289
+ GOSU_FFI_API const unsigned Gosu_GP_2_RIGHT = Gosu::GP_2_RIGHT;
290
+ GOSU_FFI_API const unsigned Gosu_GP_2_UP = Gosu::GP_2_UP;
291
+ GOSU_FFI_API const unsigned Gosu_GP_2_DOWN = Gosu::GP_2_DOWN;
292
+
293
+ GOSU_FFI_API const unsigned Gosu_GP_3_LEFT = Gosu::GP_3_LEFT;
294
+ GOSU_FFI_API const unsigned Gosu_GP_3_RIGHT = Gosu::GP_3_RIGHT;
295
+ GOSU_FFI_API const unsigned Gosu_GP_3_UP = Gosu::GP_3_UP;
296
+ GOSU_FFI_API const unsigned Gosu_GP_3_DOWN = Gosu::GP_3_DOWN;
297
+
298
+ GOSU_FFI_API const unsigned Gosu_GP_LEFT_STICK_X_AXIS = Gosu::GP_LEFT_STICK_X_AXIS;
299
+ GOSU_FFI_API const unsigned Gosu_GP_LEFT_STICK_Y_AXIS = Gosu::GP_LEFT_STICK_Y_AXIS;
300
+ GOSU_FFI_API const unsigned Gosu_GP_RIGHT_STICK_X_AXIS = Gosu::GP_RIGHT_STICK_X_AXIS;
301
+ GOSU_FFI_API const unsigned Gosu_GP_RIGHT_STICK_Y_AXIS = Gosu::GP_RIGHT_STICK_Y_AXIS;
302
+ GOSU_FFI_API const unsigned Gosu_GP_LEFT_TRIGGER_AXIS = Gosu::GP_LEFT_TRIGGER_AXIS;
303
+ GOSU_FFI_API const unsigned Gosu_GP_RIGHT_TRIGGER_AXIS = Gosu::GP_RIGHT_TRIGGER_AXIS;
304
+
305
+ GOSU_FFI_API const unsigned Gosu_GP_0_LEFT_STICK_X_AXIS = Gosu::GP_0_LEFT_STICK_X_AXIS;
306
+ GOSU_FFI_API const unsigned Gosu_GP_0_LEFT_STICK_Y_AXIS = Gosu::GP_0_LEFT_STICK_Y_AXIS;
307
+ GOSU_FFI_API const unsigned Gosu_GP_0_RIGHT_STICK_X_AXIS = Gosu::GP_0_RIGHT_STICK_X_AXIS;
308
+ GOSU_FFI_API const unsigned Gosu_GP_0_RIGHT_STICK_Y_AXIS = Gosu::GP_0_RIGHT_STICK_Y_AXIS;
309
+ GOSU_FFI_API const unsigned Gosu_GP_0_LEFT_TRIGGER_AXIS = Gosu::GP_0_LEFT_TRIGGER_AXIS;
310
+ GOSU_FFI_API const unsigned Gosu_GP_0_RIGHT_TRIGGER_AXIS = Gosu::GP_0_RIGHT_TRIGGER_AXIS;
311
+
312
+ GOSU_FFI_API const unsigned Gosu_GP_1_LEFT_STICK_X_AXIS = Gosu::GP_1_LEFT_STICK_X_AXIS;
313
+ GOSU_FFI_API const unsigned Gosu_GP_1_LEFT_STICK_Y_AXIS = Gosu::GP_1_LEFT_STICK_Y_AXIS;
314
+ GOSU_FFI_API const unsigned Gosu_GP_1_RIGHT_STICK_X_AXIS = Gosu::GP_1_RIGHT_STICK_X_AXIS;
315
+ GOSU_FFI_API const unsigned Gosu_GP_1_RIGHT_STICK_Y_AXIS = Gosu::GP_1_RIGHT_STICK_Y_AXIS;
316
+ GOSU_FFI_API const unsigned Gosu_GP_1_LEFT_TRIGGER_AXIS = Gosu::GP_1_LEFT_TRIGGER_AXIS;
317
+ GOSU_FFI_API const unsigned Gosu_GP_1_RIGHT_TRIGGER_AXIS = Gosu::GP_1_RIGHT_TRIGGER_AXIS;
318
+
319
+ GOSU_FFI_API const unsigned Gosu_GP_2_LEFT_STICK_X_AXIS = Gosu::GP_2_LEFT_STICK_X_AXIS;
320
+ GOSU_FFI_API const unsigned Gosu_GP_2_LEFT_STICK_Y_AXIS = Gosu::GP_2_LEFT_STICK_Y_AXIS;
321
+ GOSU_FFI_API const unsigned Gosu_GP_2_RIGHT_STICK_X_AXIS = Gosu::GP_2_RIGHT_STICK_X_AXIS;
322
+ GOSU_FFI_API const unsigned Gosu_GP_2_RIGHT_STICK_Y_AXIS = Gosu::GP_2_RIGHT_STICK_Y_AXIS;
323
+ GOSU_FFI_API const unsigned Gosu_GP_2_LEFT_TRIGGER_AXIS = Gosu::GP_2_LEFT_TRIGGER_AXIS;
324
+ GOSU_FFI_API const unsigned Gosu_GP_2_RIGHT_TRIGGER_AXIS = Gosu::GP_2_RIGHT_TRIGGER_AXIS;
325
+
326
+ GOSU_FFI_API const unsigned Gosu_GP_3_LEFT_STICK_X_AXIS = Gosu::GP_3_LEFT_STICK_X_AXIS;
327
+ GOSU_FFI_API const unsigned Gosu_GP_3_LEFT_STICK_Y_AXIS = Gosu::GP_3_LEFT_STICK_Y_AXIS;
328
+ GOSU_FFI_API const unsigned Gosu_GP_3_RIGHT_STICK_X_AXIS = Gosu::GP_3_RIGHT_STICK_X_AXIS;
329
+ GOSU_FFI_API const unsigned Gosu_GP_3_RIGHT_STICK_Y_AXIS = Gosu::GP_3_RIGHT_STICK_Y_AXIS;
330
+ GOSU_FFI_API const unsigned Gosu_GP_3_LEFT_TRIGGER_AXIS = Gosu::GP_3_LEFT_TRIGGER_AXIS;
331
+ GOSU_FFI_API const unsigned Gosu_GP_3_RIGHT_TRIGGER_AXIS = Gosu::GP_3_RIGHT_TRIGGER_AXIS;
332
+
333
+ GOSU_FFI_API const unsigned Gosu_NUM_GAMEPADS = Gosu::NUM_GAMEPADS;
334
+ GOSU_FFI_API const unsigned Gosu_NO_BUTTON = Gosu::NO_BUTTON;
data/ffi/Gosu_FFI.h ADDED
@@ -0,0 +1,34 @@
1
+ #pragma once
2
+
3
+ // https://stackoverflow.com/a/2164853
4
+
5
+ // Microsoft
6
+ #if defined(_MSC_VER)
7
+ #define GOSU_FFI_API_EXPORTS __declspec(dllexport)
8
+ #define GOSU_FFI_API_IMPORTS __declspec(dllimport)
9
+ // GCC
10
+ #elif defined(__GNUC__)
11
+ #define GOSU_FFI_API_EXPORTS __attribute__((visibility("default")))
12
+ #define GOSU_FFI_API_IMPORTS
13
+ // Do nothing and hope for the best
14
+ #else
15
+ #define GOSU_FFI_API_EXPORTS
16
+ #define GOSU_FFI_API_IMPORTS
17
+ #pragma warning Unknown dynamic link import/export semantics.
18
+ #endif
19
+
20
+ #ifdef GOSU_FFI_EXPORTS
21
+ #if defined(MRBGEM_MRUBY_GOSU_VERSION) && !defined(__cplusplus) // Compiling mruby-gosu as C only
22
+ #if defined(_MSC_VER)
23
+ #include <stdbool.h>
24
+ #endif
25
+ #define GOSU_FFI_API GOSU_FFI_API_EXPORTS
26
+ #else
27
+ // When building Gosu, also add [[maybe_unused]] to silence warnings about unused functions.
28
+ #define GOSU_FFI_API extern "C" [[maybe_unused]] GOSU_FFI_API_EXPORTS
29
+ #endif
30
+ #elif defined(__cplusplus)
31
+ #define GOSU_FFI_API extern "C" GOSU_FFI_API_IMPORTS
32
+ #else
33
+ #define GOSU_FFI_API GOSU_FFI_API_IMPORTS
34
+ #endif
@@ -0,0 +1,161 @@
1
+ #pragma once
2
+
3
+ #ifndef __cplusplus
4
+ #error This file is only for internal use within the Gosu FFI implementation.
5
+ #endif
6
+
7
+ #include "Gosu.h"
8
+ #include <Gosu/Gosu.hpp>
9
+ #include <stdexcept>
10
+
11
+ // Error handling
12
+
13
+ std::string& Gosu_internal_error();
14
+
15
+ template<typename Functor>
16
+ auto Gosu_translate_exceptions(Functor functor)
17
+ {
18
+ try {
19
+ Gosu_internal_error().clear();
20
+ return functor();
21
+ }
22
+ catch (const std::exception& e) {
23
+ Gosu_internal_error() = e.what();
24
+ using R = decltype(functor());
25
+ return R();
26
+ }
27
+ }
28
+
29
+ // C-compatible wrapper structs for Gosu classes
30
+
31
+ struct Gosu_Channel
32
+ {
33
+ Gosu::Channel channel;
34
+ };
35
+
36
+ struct Gosu_Font
37
+ {
38
+ Gosu::Font font;
39
+ };
40
+
41
+ struct Gosu_Image
42
+ {
43
+ Gosu::Image image;
44
+ };
45
+
46
+ struct Gosu_Sample
47
+ {
48
+ Gosu::Sample sample;
49
+ };
50
+
51
+ // Use inheritance where composition is not feasible
52
+
53
+ struct Gosu_Song : Gosu::Song
54
+ {
55
+ [[maybe_unused]] // silence buggy warning, this is being used in Gosu_Song.cpp.
56
+ explicit Gosu_Song(const std::string& filename)
57
+ : Gosu::Song{filename}
58
+ {
59
+ }
60
+ };
61
+
62
+ struct Gosu_TextInput : public Gosu::TextInput
63
+ {
64
+ std::string filter(std::string text) const override
65
+ {
66
+ if (filter_callback) {
67
+ filter_callback(text.c_str());
68
+ // We now expect the result to be stored using Gosu_TextInput_set_filter_result.
69
+ return filter_result;
70
+ }
71
+ return Gosu::TextInput::filter(text);
72
+ }
73
+
74
+ std::function<void(const char* text)> filter_callback;
75
+ std::string filter_result;
76
+ };
77
+
78
+ struct Gosu_Window : public Gosu::Window
79
+ {
80
+ [[maybe_unused]] // silence buggy warning, this is being used in Gosu_Window.cpp.
81
+ Gosu_Window(int width, int height, unsigned window_flags, double update_interval)
82
+ : Gosu::Window(width, height, window_flags, update_interval)
83
+ {
84
+ }
85
+
86
+ void update() override
87
+ {
88
+ if (update_callback) update_callback();
89
+ }
90
+
91
+ void draw() override
92
+ {
93
+ if (draw_callback) draw_callback();
94
+ }
95
+
96
+ void button_down(Gosu::Button btn) override
97
+ {
98
+ if (button_down_callback) button_down_callback(btn);
99
+ }
100
+
101
+ void button_up(Gosu::Button btn) override
102
+ {
103
+ if (button_up_callback) button_up_callback(btn);
104
+ }
105
+
106
+ void gamepad_connected(int id) override
107
+ {
108
+ if (gamepad_connected_callback) gamepad_connected_callback(id);
109
+ }
110
+
111
+ void gamepad_disconnected(int id) override
112
+ {
113
+ if (gamepad_disconnected_callback) gamepad_disconnected_callback(id);
114
+ }
115
+
116
+ void drop(const std::string& filename) override
117
+ {
118
+ if (drop_callback) drop_callback(filename.c_str());
119
+ }
120
+
121
+ bool needs_redraw() const override
122
+ {
123
+ if (needs_redraw_callback) return needs_redraw_callback();
124
+ return Window::needs_redraw();
125
+ }
126
+
127
+ bool needs_cursor() const override
128
+ {
129
+ if (needs_cursor_callback) return needs_cursor_callback();
130
+ return Window::needs_cursor();
131
+ }
132
+
133
+ void close() override
134
+ {
135
+ if (close_callback != nullptr) return close_callback();
136
+ Gosu::Window::close();
137
+ }
138
+
139
+ void gain_focus() override
140
+ {
141
+ if (gain_focus_callback) gain_focus_callback();
142
+ }
143
+
144
+ void lose_focus() override
145
+ {
146
+ if (lose_focus_callback) lose_focus_callback();
147
+ }
148
+
149
+ std::function<void()> update_callback;
150
+ std::function<void()> draw_callback;
151
+ std::function<void(unsigned id)> button_down_callback;
152
+ std::function<void(unsigned id)> button_up_callback;
153
+ std::function<void(int index)> gamepad_connected_callback;
154
+ std::function<void(int index)> gamepad_disconnected_callback;
155
+ std::function<void(const char* filename)> drop_callback;
156
+ std::function<bool()> needs_redraw_callback;
157
+ std::function<bool()> needs_cursor_callback;
158
+ std::function<void()> close_callback;
159
+ std::function<void()> gain_focus_callback;
160
+ std::function<void()> lose_focus_callback;
161
+ };
data/ffi/Gosu_Font.cpp ADDED
@@ -0,0 +1,92 @@
1
+ #include "Gosu_FFI_internal.h"
2
+
3
+ GOSU_FFI_API Gosu_Font* Gosu_Font_create(int height, const char* name, unsigned flags, unsigned image_flags)
4
+ {
5
+ return Gosu_translate_exceptions([=] {
6
+ return new Gosu_Font{Gosu::Font{height, name, flags, image_flags}};
7
+ });
8
+ }
9
+
10
+ GOSU_FFI_API void Gosu_Font_destroy(Gosu_Font* font)
11
+ {
12
+ delete font;
13
+ }
14
+
15
+ GOSU_FFI_API const char* Gosu_Font_name(Gosu_Font* font)
16
+ {
17
+ static thread_local std::string name;
18
+
19
+ return Gosu_translate_exceptions([=] {
20
+ name = font->font.name();
21
+ return name.c_str();
22
+ });
23
+ }
24
+
25
+ GOSU_FFI_API int Gosu_Font_height(Gosu_Font* font)
26
+ {
27
+ return Gosu_translate_exceptions([=] {
28
+ return font->font.height();
29
+ });
30
+ }
31
+
32
+ GOSU_FFI_API double Gosu_Font_text_width(Gosu_Font* font, const char* text)
33
+ {
34
+ return Gosu_translate_exceptions([=] {
35
+ return font->font.text_width(text);
36
+ });
37
+ }
38
+
39
+ GOSU_FFI_API double Gosu_Font_markup_width(Gosu_Font* font, const char* markup)
40
+ {
41
+ return Gosu_translate_exceptions([=] {
42
+ return font->font.markup_width(markup);
43
+ });
44
+ }
45
+
46
+ GOSU_FFI_API void Gosu_Font_draw_text(Gosu_Font* font, const char* text, double x, double y,
47
+ double z, double scale_x, double scale_y, unsigned c,
48
+ unsigned mode)
49
+ {
50
+ Gosu_translate_exceptions([=] {
51
+ font->font.draw_text(text, x, y, z, scale_x, scale_y, c,
52
+ static_cast<Gosu::BlendMode>(mode));
53
+ });
54
+ }
55
+
56
+ GOSU_FFI_API void Gosu_Font_draw_markup(Gosu_Font* font, const char* markup, double x, double y,
57
+ double z, double scale_x, double scale_y, unsigned c,
58
+ unsigned mode)
59
+ {
60
+ Gosu_translate_exceptions([=] {
61
+ font->font.draw_markup(markup, x, y, z, scale_x, scale_y, c,
62
+ static_cast<Gosu::BlendMode>(mode));
63
+ });
64
+ }
65
+
66
+ GOSU_FFI_API void Gosu_Font_draw_text_rel(Gosu_Font* font, const char* text, double x, double y,
67
+ double z, double rel_x, double rel_y, double scale_x,
68
+ double scale_y, unsigned c, unsigned mode)
69
+ {
70
+ Gosu_translate_exceptions([=] {
71
+ font->font.draw_text_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, c,
72
+ static_cast<Gosu::BlendMode>(mode));
73
+ });
74
+ }
75
+
76
+ GOSU_FFI_API void Gosu_Font_draw_markup_rel(Gosu_Font* font, const char* markup, double x, double y,
77
+ double z, double rel_x, double rel_y, double scale_x,
78
+ double scale_y, unsigned c, unsigned mode)
79
+ {
80
+ Gosu_translate_exceptions([=] {
81
+ font->font.draw_markup_rel(markup, x, y, z, rel_x, rel_y, scale_x, scale_y, c,
82
+ static_cast<Gosu::BlendMode>(mode));
83
+ });
84
+ }
85
+
86
+ GOSU_FFI_API void Gosu_Font_set_image(Gosu_Font* font, const char* codepoint, unsigned font_flags,
87
+ Gosu_Image* image)
88
+ {
89
+ Gosu_translate_exceptions([=] {
90
+ font->font.set_image(codepoint, font_flags, image->image);
91
+ });
92
+ }
data/ffi/Gosu_Font.h ADDED
@@ -0,0 +1,32 @@
1
+ #pragma once
2
+
3
+ #include "Gosu_FFI.h"
4
+ #include "Gosu_Image.h"
5
+
6
+ typedef struct Gosu_Font Gosu_Font;
7
+
8
+ GOSU_FFI_API Gosu_Font* Gosu_Font_create(int height, const char* name, unsigned flags, unsigned image_flags);
9
+ GOSU_FFI_API void Gosu_Font_destroy(Gosu_Font* font);
10
+
11
+ GOSU_FFI_API const char* Gosu_Font_name(Gosu_Font* font);
12
+ GOSU_FFI_API int Gosu_Font_height(Gosu_Font* font);
13
+
14
+ GOSU_FFI_API double Gosu_Font_text_width(Gosu_Font* font, const char* text);
15
+ GOSU_FFI_API double Gosu_Font_markup_width(Gosu_Font* font, const char* markup);
16
+
17
+ GOSU_FFI_API void Gosu_Font_draw_text(Gosu_Font* font, const char* text, double x, double y,
18
+ double z, double scale_x, double scale_y, unsigned c,
19
+ unsigned mode);
20
+ GOSU_FFI_API void Gosu_Font_draw_markup(Gosu_Font* font, const char* markup, double x, double y,
21
+ double z, double scale_x, double scale_y, unsigned c,
22
+ unsigned mode);
23
+
24
+ GOSU_FFI_API void Gosu_Font_draw_text_rel(Gosu_Font* font, const char* text, double x, double y,
25
+ double z, double rel_x, double rel_y, double scale_x,
26
+ double scale_y, unsigned c, unsigned mode);
27
+ GOSU_FFI_API void Gosu_Font_draw_markup_rel(Gosu_Font* font, const char* markup, double x, double y,
28
+ double z, double rel_x, double rel_y, double scale_x,
29
+ double scale_y, unsigned c, unsigned mode);
30
+
31
+ GOSU_FFI_API void Gosu_Font_set_image(Gosu_Font* font, const char* codepoint, unsigned font_flags,
32
+ Gosu_Image* image);