gosu 0.14.6.pre1 → 1.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/COPYING +1 -1
  4. data/dependencies/SDL/include/SDL.h +138 -0
  5. data/dependencies/SDL/include/SDL_assert.h +293 -0
  6. data/dependencies/SDL/include/SDL_atomic.h +295 -0
  7. data/dependencies/SDL/include/SDL_audio.h +859 -0
  8. data/dependencies/SDL/include/SDL_bits.h +121 -0
  9. data/dependencies/SDL/include/SDL_blendmode.h +123 -0
  10. data/dependencies/SDL/include/SDL_clipboard.h +71 -0
  11. data/dependencies/SDL/include/SDL_config.h +55 -0
  12. data/dependencies/SDL/include/SDL_config_android.h +182 -0
  13. data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
  14. data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
  15. data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
  16. data/dependencies/SDL/include/SDL_config_os2.h +188 -0
  17. data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
  18. data/dependencies/SDL/include/SDL_config_psp.h +165 -0
  19. data/dependencies/SDL/include/SDL_config_windows.h +288 -0
  20. data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
  21. data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
  22. data/dependencies/SDL/include/SDL_copying.h +20 -0
  23. data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
  24. data/dependencies/SDL/include/SDL_egl.h +1676 -0
  25. data/dependencies/SDL/include/SDL_endian.h +263 -0
  26. data/dependencies/SDL/include/SDL_error.h +112 -0
  27. data/dependencies/SDL/include/SDL_events.h +827 -0
  28. data/dependencies/SDL/include/SDL_filesystem.h +136 -0
  29. data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
  30. data/dependencies/SDL/include/SDL_gesture.h +87 -0
  31. data/dependencies/SDL/include/SDL_haptic.h +1247 -0
  32. data/dependencies/SDL/include/SDL_hints.h +1578 -0
  33. data/dependencies/SDL/include/SDL_joystick.h +499 -0
  34. data/dependencies/SDL/include/SDL_keyboard.h +217 -0
  35. data/dependencies/SDL/include/SDL_keycode.h +351 -0
  36. data/dependencies/SDL/include/SDL_loadso.h +81 -0
  37. data/dependencies/SDL/include/SDL_locale.h +101 -0
  38. data/dependencies/SDL/include/SDL_log.h +211 -0
  39. data/dependencies/SDL/include/SDL_main.h +180 -0
  40. data/dependencies/SDL/include/SDL_messagebox.h +146 -0
  41. data/dependencies/SDL/include/SDL_metal.h +117 -0
  42. data/dependencies/SDL/include/SDL_misc.h +75 -0
  43. data/dependencies/SDL/include/SDL_mouse.h +302 -0
  44. data/dependencies/SDL/include/SDL_mutex.h +251 -0
  45. data/dependencies/SDL/include/SDL_name.h +33 -0
  46. data/dependencies/SDL/include/SDL_opengl.h +2183 -0
  47. data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
  48. data/dependencies/SDL/include/SDL_opengles.h +39 -0
  49. data/dependencies/SDL/include/SDL_opengles2.h +52 -0
  50. data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
  51. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
  52. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
  53. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
  54. data/dependencies/SDL/include/SDL_pixels.h +479 -0
  55. data/dependencies/SDL/include/SDL_platform.h +198 -0
  56. data/dependencies/SDL/include/SDL_power.h +75 -0
  57. data/dependencies/SDL/include/SDL_quit.h +58 -0
  58. data/dependencies/SDL/include/SDL_rect.h +174 -0
  59. data/dependencies/SDL/include/SDL_render.h +1158 -0
  60. data/dependencies/SDL/include/SDL_revision.h +2 -0
  61. data/dependencies/SDL/include/SDL_rwops.h +283 -0
  62. data/dependencies/SDL/include/SDL_scancode.h +413 -0
  63. data/dependencies/SDL/include/SDL_sensor.h +267 -0
  64. data/dependencies/SDL/include/SDL_shape.h +144 -0
  65. data/dependencies/SDL/include/SDL_stdinc.h +647 -0
  66. data/dependencies/SDL/include/SDL_surface.h +563 -0
  67. data/dependencies/SDL/include/SDL_system.h +325 -0
  68. data/dependencies/SDL/include/SDL_syswm.h +354 -0
  69. data/dependencies/SDL/include/SDL_test.h +69 -0
  70. data/dependencies/SDL/include/SDL_test_assert.h +105 -0
  71. data/dependencies/SDL/include/SDL_test_common.h +218 -0
  72. data/dependencies/SDL/include/SDL_test_compare.h +69 -0
  73. data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
  74. data/dependencies/SDL/include/SDL_test_font.h +81 -0
  75. data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
  76. data/dependencies/SDL/include/SDL_test_harness.h +134 -0
  77. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  78. data/dependencies/SDL/include/SDL_test_log.h +67 -0
  79. data/dependencies/SDL/include/SDL_test_md5.h +129 -0
  80. data/dependencies/SDL/include/SDL_test_memory.h +63 -0
  81. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  82. data/dependencies/SDL/include/SDL_thread.h +366 -0
  83. data/dependencies/SDL/include/SDL_timer.h +115 -0
  84. data/dependencies/SDL/include/SDL_touch.h +102 -0
  85. data/dependencies/SDL/include/SDL_types.h +29 -0
  86. data/dependencies/SDL/include/SDL_version.h +162 -0
  87. data/dependencies/SDL/include/SDL_video.h +1282 -0
  88. data/dependencies/SDL/include/SDL_vulkan.h +276 -0
  89. data/dependencies/SDL/include/begin_code.h +166 -0
  90. data/dependencies/SDL/include/close_code.h +40 -0
  91. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  92. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  93. data/dependencies/SDL_sound/SDL_sound.c +795 -0
  94. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  95. data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
  96. data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
  97. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
  98. data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
  99. data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
  100. data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
  101. data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
  102. data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
  103. data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
  104. data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
  105. data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
  106. data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
  107. data/dependencies/SDL_sound/dr_flac.h +5906 -0
  108. data/dependencies/SDL_sound/dr_mp3.h +2832 -0
  109. data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
  110. data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
  111. data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
  112. data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
  113. data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
  114. data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
  115. data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
  116. data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
  117. data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
  118. data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
  119. data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
  120. data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
  121. data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
  122. data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
  123. data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
  124. data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
  125. data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
  126. data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
  127. data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
  128. data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
  129. data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
  130. data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
  131. data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
  132. data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
  133. data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
  134. data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
  135. data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
  136. data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
  137. data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
  138. data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
  139. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
  140. data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
  141. data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
  142. data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
  143. data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
  144. data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
  145. data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +128 -23
  146. data/dependencies/al_soft/AL/al.h +655 -0
  147. data/dependencies/al_soft/AL/alc.h +270 -0
  148. data/dependencies/al_soft/AL/alext.h +585 -0
  149. data/dependencies/al_soft/AL/efx-creative.h +3 -0
  150. data/dependencies/al_soft/AL/efx-presets.h +402 -0
  151. data/dependencies/al_soft/AL/efx.h +762 -0
  152. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  153. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  154. data/{src → dependencies/stb}/stb_image.h +476 -176
  155. data/{src → dependencies/stb}/stb_image_write.h +253 -131
  156. data/{src → dependencies/stb}/stb_truetype.h +262 -104
  157. data/{src → dependencies/utf8proc}/utf8proc.c +47 -29
  158. data/{src → dependencies/utf8proc}/utf8proc.h +46 -24
  159. data/{src → dependencies/utf8proc}/utf8proc_data.h +10043 -9609
  160. data/ext/gosu/extconf.rb +53 -39
  161. data/{Gosu → include/Gosu}/Audio.hpp +6 -8
  162. data/include/Gosu/Bitmap.hpp +100 -0
  163. data/{Gosu → include/Gosu}/Buttons.hpp +104 -44
  164. data/include/Gosu/Channel.h +25 -0
  165. data/include/Gosu/Color.h +38 -0
  166. data/{Gosu → include/Gosu}/Color.hpp +0 -0
  167. data/{Gosu → include/Gosu}/Directories.hpp +0 -0
  168. data/include/Gosu/Font.h +36 -0
  169. data/{Gosu → include/Gosu}/Font.hpp +0 -0
  170. data/{Gosu → include/Gosu}/Fwd.hpp +0 -5
  171. data/include/Gosu/Gosu.h +82 -0
  172. data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
  173. data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
  174. data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
  175. data/{Gosu → include/Gosu}/IO.hpp +0 -0
  176. data/include/Gosu/Image.h +54 -0
  177. data/{Gosu → include/Gosu}/Image.hpp +7 -6
  178. data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
  179. data/{Gosu → include/Gosu}/Input.hpp +39 -51
  180. data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
  181. data/{Gosu → include/Gosu}/Math.hpp +0 -0
  182. data/{Gosu → include/Gosu}/Platform.hpp +0 -0
  183. data/include/Gosu/Sample.h +19 -0
  184. data/include/Gosu/Song.h +24 -0
  185. data/{Gosu → include/Gosu}/Text.hpp +0 -0
  186. data/include/Gosu/TextInput.h +30 -0
  187. data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
  188. data/{Gosu → include/Gosu}/Timing.hpp +0 -0
  189. data/{Gosu → include/Gosu}/Utility.hpp +15 -4
  190. data/{Gosu → include/Gosu}/Version.hpp +3 -3
  191. data/include/Gosu/Window.h +63 -0
  192. data/{Gosu → include/Gosu}/Window.hpp +23 -25
  193. data/lib/OpenAL32.dll +0 -0
  194. data/lib/SDL2.dll +0 -0
  195. data/lib/gosu.rb +0 -3
  196. data/lib/gosu/compat.rb +9 -4
  197. data/lib/gosu/patches.rb +8 -11
  198. data/lib/gosu/swig_patches.rb +13 -6
  199. data/lib64/OpenAL32.dll +0 -0
  200. data/lib64/SDL2.dll +0 -0
  201. data/rdoc/gosu.rb +114 -21
  202. data/src/Audio.cpp +50 -224
  203. data/src/AudioFile.hpp +20 -37
  204. data/src/AudioFileAudioToolbox.cpp +237 -0
  205. data/src/AudioFileSDLSound.cpp +147 -0
  206. data/src/AudioImpl.cpp +3 -12
  207. data/src/AudioImpl.hpp +3 -1
  208. data/src/Bitmap.cpp +85 -83
  209. data/src/BitmapIO.cpp +52 -58
  210. data/src/ChannelWrapper.cpp +50 -0
  211. data/src/ColorWrapper.cpp +126 -0
  212. data/src/Constants.cpp +338 -0
  213. data/src/Font.cpp +4 -1
  214. data/src/FontWrapper.cpp +74 -0
  215. data/src/GosuWrapper.cpp +251 -0
  216. data/src/Graphics.cpp +11 -5
  217. data/src/GraphicsImpl.hpp +0 -1
  218. data/src/Image.cpp +13 -16
  219. data/src/ImageWrapper.cpp +168 -0
  220. data/src/Input.cpp +412 -164
  221. data/src/LargeImageData.cpp +2 -1
  222. data/src/MarkupParser.cpp +13 -4
  223. data/src/RubyGosu.cxx +502 -219
  224. data/src/RubyGosu.h +4 -2
  225. data/src/SampleWrapper.cpp +30 -0
  226. data/src/SongWrapper.cpp +52 -0
  227. data/src/TexChunk.cpp +29 -19
  228. data/src/Text.cpp +2 -0
  229. data/src/TextBuilder.cpp +6 -4
  230. data/src/TextInputWrapper.cpp +101 -0
  231. data/src/Texture.cpp +1 -1
  232. data/src/TrueTypeFont.cpp +2 -1
  233. data/src/Utility.cpp +11 -7
  234. data/src/Window.cpp +30 -39
  235. data/src/WindowWrapper.cpp +317 -0
  236. metadata +212 -42
  237. data/Gosu/AutoLink.hpp +0 -14
  238. data/Gosu/Bitmap.hpp +0 -113
  239. data/src/AudioToolboxFile.hpp +0 -210
  240. data/src/OggFile.hpp +0 -92
  241. data/src/SndFile.hpp +0 -174
  242. data/src/WinMain.cpp +0 -64
@@ -3,6 +3,7 @@
3
3
  #include <Gosu/Graphics.hpp>
4
4
  #include <Gosu/Math.hpp>
5
5
  #include <cmath>
6
+ #include <stdexcept>
6
7
  using namespace std;
7
8
 
8
9
  Gosu::LargeImageData::LargeImageData(const Bitmap& source, int tile_width, int tile_height,
@@ -184,7 +185,7 @@ Gosu::Bitmap Gosu::LargeImageData::to_bitmap() const
184
185
  int x = 0;
185
186
  for (int tx = 0; tx < tiles_x; ++tx) {
186
187
  ImageData& tile = *tiles[ty * tiles_x + tx];
187
- bitmap.insert(tile.to_bitmap(), x, y);
188
+ bitmap.insert(x, y, tile.to_bitmap());
188
189
  x += tile.width();
189
190
  }
190
191
  y += tiles[ty * tiles_x]->height();
@@ -1,6 +1,7 @@
1
1
  #include "MarkupParser.hpp"
2
2
  #include <Gosu/Utility.hpp>
3
- #include "utf8proc.h"
3
+
4
+ #include <utf8proc.h>
4
5
 
5
6
  #include <cstring>
6
7
  using namespace std;
@@ -119,17 +120,25 @@ bool Gosu::MarkupParser::parse_markup()
119
120
 
120
121
  bool Gosu::MarkupParser::parse_escape_entity()
121
122
  {
123
+ auto translate_to = [this](char ch) {
124
+ if (word_state == ADDING_WHITESPACE) {
125
+ flush_to_consumer();
126
+ word_state = ADDING_WORD;
127
+ }
128
+ add_composed_substring(u32string(1, ch));
129
+ };
130
+
122
131
  // These are not entities (images) but escapes for markup characters.
123
132
  if (match_and_skip("&lt;")) {
124
- add_composed_substring(u32string(1, '<'));
133
+ translate_to('<');
125
134
  return true;
126
135
  }
127
136
  if (match_and_skip("&gt;")) {
128
- add_composed_substring(u32string(1, '>'));
137
+ translate_to('>');
129
138
  return true;
130
139
  }
131
140
  if (match_and_skip("&amp;")) {
132
- add_composed_substring(u32string(1, '&'));
141
+ translate_to('&');
133
142
  return true;
134
143
  }
135
144
 
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.12
3
+ * Version 4.1.0
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -332,6 +332,7 @@ template <typename T> T SwigValueInit() {
332
332
  /* Flags for pointer conversions */
333
333
  #define SWIG_POINTER_DISOWN 0x1
334
334
  #define SWIG_CAST_NEW_MEMORY 0x2
335
+ #define SWIG_POINTER_NO_NULL 0x4
335
336
 
336
337
  /* Flags for new pointer objects */
337
338
  #define SWIG_POINTER_OWN 0x1
@@ -970,42 +971,53 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
970
971
  #ifndef RSTRUCT_PTR
971
972
  # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
972
973
  #endif
974
+ #ifndef RTYPEDDATA_P
975
+ # define RTYPEDDATA_P(x) (TYPE(x) != T_DATA)
976
+ #endif
973
977
 
974
978
 
975
979
 
976
980
  /*
977
- * Need to be very careful about how these macros are defined, especially
978
- * when compiling C++ code or C code with an ANSI C compiler.
981
+ * The following macros are used for providing the correct type of a
982
+ * function pointer to the Ruby C API.
983
+ * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being
984
+ * defined) these macros act transparently due to Ruby's moving away from
985
+ * ANYARGS and instead employing strict function signatures.
986
+ *
987
+ * Note: In case of C (not C++) the macros are transparent even before
988
+ * Ruby 2.7 due to the fact that the Ruby C API used function declarators
989
+ * with empty parentheses, which allows for an unspecified number of
990
+ * arguments.
991
+ *
992
+ * PROTECTFUNC(f) is used for the function pointer argument of the Ruby
993
+ * C API function rb_protect().
979
994
  *
980
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
981
- * a Ruby method so that it can be passed as an argument to API functions
982
- * like rb_define_method() and rb_define_singleton_method().
995
+ * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API
996
+ * functions like rb_define_method() and rb_define_singleton_method().
983
997
  *
984
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
985
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
986
- * can be passed as an argument to API functions like Data_Wrap_Struct()
998
+ * VOIDFUNC(f) is used to typecast a C function that implements either
999
+ * the "mark" or "free" stuff for a Ruby Data object, so that it can be
1000
+ * passed as an argument to Ruby C API functions like Data_Wrap_Struct()
987
1001
  * and Data_Make_Struct().
1002
+ *
1003
+ * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer
1004
+ * argument(s) of Ruby C API functions like rb_define_virtual_variable().
1005
+ *
1006
+ * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer
1007
+ * argument(s) of Ruby C API functions like st_foreach().
988
1008
  */
989
-
990
- #ifdef __cplusplus
991
- # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
992
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
993
- # define VALUEFUNC(f) ((VALUE (*)()) f)
994
- # define VOIDFUNC(f) ((void (*)()) f)
995
- # else
996
- # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
997
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
998
- # define VALUEFUNC(f) ((VALUE (*)()) f)
999
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
1000
- # else /* These definitions should work for Ruby 1.7+ */
1001
- # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
1002
- # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
1003
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
1004
- # endif
1005
- # endif
1009
+ #if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL)
1010
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
1011
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
1012
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
1013
+ # define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
1014
+ # define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
1006
1015
  #else
1016
+ # define PROTECTFUNC(f) (f)
1007
1017
  # define VALUEFUNC(f) (f)
1008
1018
  # define VOIDFUNC(f) (f)
1019
+ # define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f)
1020
+ # define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f)
1009
1021
  #endif
1010
1022
 
1011
1023
  /* Don't use for expressions have side effect */
@@ -1193,7 +1205,7 @@ void Ruby_Format_OverloadedError(
1193
1205
  /* -----------------------------------------------------------------------------
1194
1206
  * rubytracking.swg
1195
1207
  *
1196
- * This file contains support for tracking mappings from
1208
+ * This file contains support for tracking mappings from
1197
1209
  * Ruby objects to C++ objects. This functionality is needed
1198
1210
  * to implement mark functions for Ruby's mark and sweep
1199
1211
  * garbage collector.
@@ -1220,11 +1232,11 @@ extern "C" {
1220
1232
  #endif
1221
1233
 
1222
1234
  /* Global hash table to store Trackings from C/C++
1223
- structs to Ruby Objects.
1235
+ structs to Ruby Objects.
1224
1236
  */
1225
1237
  static st_table* swig_ruby_trackings = NULL;
1226
1238
 
1227
- static VALUE swig_ruby_trackings_count(ANYARGS) {
1239
+ static VALUE swig_ruby_trackings_count(ID id, VALUE *var) {
1228
1240
  return SWIG2NUM(swig_ruby_trackings->num_entries);
1229
1241
  }
1230
1242
 
@@ -1234,7 +1246,7 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1234
1246
  /* Create a hash table to store Trackings from C++
1235
1247
  objects to Ruby objects. */
1236
1248
 
1237
- /* Try to see if some other .so has already created a
1249
+ /* Try to see if some other .so has already created a
1238
1250
  tracking hash table, which we keep hidden in an instance var
1239
1251
  in the SWIG module.
1240
1252
  This is done to allow multiple DSOs to share the same
@@ -1261,7 +1273,9 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1261
1273
  swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
1262
1274
  }
1263
1275
 
1264
- rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
1276
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT",
1277
+ VALUEFUNC(swig_ruby_trackings_count),
1278
+ SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
1265
1279
  }
1266
1280
 
1267
1281
  /* Add a Tracking from a C/C++ struct to a Ruby object */
@@ -1293,13 +1307,14 @@ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1293
1307
 
1294
1308
  /* This is a helper method that unlinks a Ruby object from its
1295
1309
  underlying C++ object. This is needed if the lifetime of the
1296
- Ruby object is longer than the C++ object */
1310
+ Ruby object is longer than the C++ object. */
1297
1311
  SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1298
1312
  VALUE object = SWIG_RubyInstanceFor(ptr);
1299
1313
 
1300
1314
  if (object != Qnil) {
1301
- if (TYPE(object) != T_DATA)
1302
- abort();
1315
+ // object might have the T_ZOMBIE type, but that's just
1316
+ // because the GC has flagged it as such for a deferred
1317
+ // destruction. Until then, it's still a T_DATA object.
1303
1318
  DATA_PTR(object) = 0;
1304
1319
  }
1305
1320
  }
@@ -1309,13 +1324,15 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1309
1324
  to the passed callback function. */
1310
1325
 
1311
1326
  /* Proxy method to abstract the internal trackings datatype */
1312
- static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
1313
- (*meth)(ptr, obj);
1327
+ static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) {
1328
+ ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj);
1314
1329
  return ST_CONTINUE;
1315
1330
  }
1316
1331
 
1317
1332
  SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
1318
- st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
1333
+ st_foreach(swig_ruby_trackings,
1334
+ SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback),
1335
+ (st_data_t)meth);
1319
1336
  }
1320
1337
 
1321
1338
  #ifdef __cplusplus
@@ -1532,10 +1549,11 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1532
1549
  swig_class *sklass;
1533
1550
  VALUE klass;
1534
1551
  VALUE obj;
1535
-
1552
+
1536
1553
  if (!ptr)
1537
1554
  return Qnil;
1538
-
1555
+
1556
+ assert(type);
1539
1557
  if (type->clientdata) {
1540
1558
  sklass = (swig_class *) type->clientdata;
1541
1559
 
@@ -1543,7 +1561,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1543
1561
  track = sklass->trackObjects;
1544
1562
  if (track) {
1545
1563
  obj = SWIG_RubyInstanceFor(ptr);
1546
-
1564
+
1547
1565
  /* Check the object's type and make sure it has the correct type.
1548
1566
  It might not in cases where methods do things like
1549
1567
  downcast methods. */
@@ -1575,7 +1593,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1575
1593
  obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1576
1594
  }
1577
1595
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1578
-
1596
+
1579
1597
  return obj;
1580
1598
  }
1581
1599
 
@@ -1595,6 +1613,8 @@ SWIGRUNTIMEINLINE char *
1595
1613
  SWIG_Ruby_MangleStr(VALUE obj)
1596
1614
  {
1597
1615
  VALUE stype = rb_iv_get(obj, "@__swigtype__");
1616
+ if (NIL_P(stype))
1617
+ return NULL;
1598
1618
  return StringValuePtr(stype);
1599
1619
  }
1600
1620
 
@@ -1607,7 +1627,7 @@ typedef struct {
1607
1627
  SWIGRUNTIME swig_ruby_owntype
1608
1628
  SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
1609
1629
  swig_ruby_owntype oldown = {0, 0};
1610
- if (obj) {
1630
+ if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) {
1611
1631
  oldown.datafree = RDATA(obj)->dfree;
1612
1632
  RDATA(obj)->dfree = own.datafree;
1613
1633
  }
@@ -1626,9 +1646,9 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
1626
1646
  if (NIL_P(obj)) {
1627
1647
  if (ptr)
1628
1648
  *ptr = 0;
1629
- return SWIG_OK;
1649
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
1630
1650
  } else {
1631
- if (TYPE(obj) != T_DATA) {
1651
+ if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) {
1632
1652
  return SWIG_ERROR;
1633
1653
  }
1634
1654
  Data_Get_Struct(obj, void, vptr);
@@ -1723,7 +1743,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1723
1743
  return rb_str_new2(result);
1724
1744
  }
1725
1745
 
1726
- /* Convert a packed value value */
1746
+ /* Convert a packed pointer value */
1727
1747
  SWIGRUNTIME int
1728
1748
  SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1729
1749
  swig_cast_info *tc;
@@ -1995,43 +2015,6 @@ namespace Swig {
1995
2015
  }
1996
2016
  };
1997
2017
 
1998
- /* unknown exception handler */
1999
- class UnknownExceptionHandler {
2000
- #ifdef SWIG_DIRECTOR_UEH
2001
- static void handler() {
2002
- try {
2003
- throw;
2004
- } catch (DirectorException& e) {
2005
- std::cerr << "SWIG Director exception caught:" << std::endl
2006
- << e.what() << std::endl;
2007
- } catch (std::exception& e) {
2008
- std::cerr << "std::exception caught: "<< e.what() << std::endl;
2009
- } catch (...) {
2010
- std::cerr << "Unknown exception caught." << std::endl;
2011
- }
2012
- std::cerr << std::endl
2013
- << "Ruby interpreter traceback:" << std::endl;
2014
- std::cerr << std::endl;
2015
- std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
2016
- << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
2017
- << std::endl
2018
- << "Exception is being re-thrown, program will like abort/terminate." << std::endl;
2019
- throw;
2020
- }
2021
-
2022
- public:
2023
- std::unexpected_handler old;
2024
- UnknownExceptionHandler(std::unexpected_handler nh = handler) {
2025
- old = std::set_unexpected(nh);
2026
- }
2027
-
2028
- ~UnknownExceptionHandler() {
2029
- std::set_unexpected(old);
2030
- }
2031
- #endif
2032
- };
2033
-
2034
-
2035
2018
  /* Type mismatch in the return value from a Ruby method call */
2036
2019
  class DirectorTypeMismatchException : public DirectorException {
2037
2020
  public:
@@ -2191,22 +2174,21 @@ namespace Swig {
2191
2174
 
2192
2175
  /* -------- TYPES TABLE (BEGIN) -------- */
2193
2176
 
2194
- #define SWIGTYPE_p_Gosu__Button swig_types[0]
2195
- #define SWIGTYPE_p_Gosu__Channel swig_types[1]
2196
- #define SWIGTYPE_p_Gosu__Color swig_types[2]
2197
- #define SWIGTYPE_p_Gosu__Font swig_types[3]
2198
- #define SWIGTYPE_p_Gosu__GLTexInfo swig_types[4]
2199
- #define SWIGTYPE_p_Gosu__Image swig_types[5]
2200
- #define SWIGTYPE_p_Gosu__Sample swig_types[6]
2201
- #define SWIGTYPE_p_Gosu__Song swig_types[7]
2202
- #define SWIGTYPE_p_Gosu__TextInput swig_types[8]
2203
- #define SWIGTYPE_p_Gosu__Window swig_types[9]
2204
- #define SWIGTYPE_p_char swig_types[10]
2205
- #define SWIGTYPE_p_double swig_types[11]
2206
- #define SWIGTYPE_p_std__arrayT_double_16_t swig_types[12]
2207
- #define SWIGTYPE_p_std__string swig_types[13]
2208
- static swig_type_info *swig_types[15];
2209
- static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
2177
+ #define SWIGTYPE_p_Gosu__Channel swig_types[0]
2178
+ #define SWIGTYPE_p_Gosu__Color swig_types[1]
2179
+ #define SWIGTYPE_p_Gosu__Font swig_types[2]
2180
+ #define SWIGTYPE_p_Gosu__GLTexInfo swig_types[3]
2181
+ #define SWIGTYPE_p_Gosu__Image swig_types[4]
2182
+ #define SWIGTYPE_p_Gosu__Sample swig_types[5]
2183
+ #define SWIGTYPE_p_Gosu__Song swig_types[6]
2184
+ #define SWIGTYPE_p_Gosu__TextInput swig_types[7]
2185
+ #define SWIGTYPE_p_Gosu__Window swig_types[8]
2186
+ #define SWIGTYPE_p_char swig_types[9]
2187
+ #define SWIGTYPE_p_double swig_types[10]
2188
+ #define SWIGTYPE_p_std__arrayT_double_16_t swig_types[11]
2189
+ #define SWIGTYPE_p_std__string swig_types[12]
2190
+ static swig_type_info *swig_types[14];
2191
+ static swig_module_info swig_module = {swig_types, 13, 0, 0, 0, 0};
2210
2192
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2211
2193
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2212
2194
 
@@ -2221,7 +2203,7 @@ static VALUE mGosu;
2221
2203
  #define SWIG_RUBY_THREAD_END_BLOCK
2222
2204
 
2223
2205
 
2224
- #define SWIGVERSION 0x030012
2206
+ #define SWIGVERSION 0x040100
2225
2207
  #define SWIG_VERSION SWIGVERSION
2226
2208
 
2227
2209
 
@@ -2284,20 +2266,21 @@ namespace Gosu
2284
2266
  rb_funcall(block, rb_intern("call"), 0);
2285
2267
  }
2286
2268
 
2287
- void load_bitmap(Bitmap& bitmap, VALUE val)
2269
+ void load_bitmap(Gosu::Bitmap& bitmap, VALUE val)
2288
2270
  {
2289
2271
  // Try to treat as filename first.
2290
2272
  if (rb_respond_to(val, rb_intern("to_str"))) {
2291
2273
  VALUE to_str = rb_funcall(val, rb_intern("to_str"), 0);
2292
2274
  const char* filename = StringValuePtr(to_str);
2293
- load_image_file(bitmap, filename);
2275
+ bitmap = Gosu::load_image_file(filename);
2294
2276
  return;
2295
2277
  }
2296
2278
 
2297
2279
  // Otherwise, try to call .to_blob on it (works with RMagick, TexPlay etc).
2298
2280
  VALUE conversion = rb_str_new2("to_blob { self.format = 'RGBA'; self.depth = 8 }");
2299
2281
  VALUE blob = rb_obj_instance_eval(1, &conversion, val);
2300
- rb_check_safe_obj(blob);
2282
+ Check_Type(blob, T_STRING);
2283
+
2301
2284
  int width = NUM2ULONG(rb_funcall(val, rb_intern("columns"), 0));
2302
2285
  int height = NUM2ULONG(rb_funcall(val, rb_intern("rows"), 0));
2303
2286
 
@@ -2345,6 +2328,23 @@ namespace Gosu
2345
2328
  {
2346
2329
  return Gosu::Input::down(btn);
2347
2330
  }
2331
+
2332
+ VALUE button_name(Gosu::Button btn)
2333
+ {
2334
+ std::string result = Gosu::Input::button_name(btn);
2335
+ return result.empty() ? Qnil : rb_str_new2(result.c_str());
2336
+ }
2337
+
2338
+ VALUE gamepad_name(int index)
2339
+ {
2340
+ std::string result = Gosu::Input::gamepad_name(index);
2341
+ return result.empty() ? Qnil : rb_str_new2(result.c_str());
2342
+ }
2343
+
2344
+ double axis(Gosu::Button btn)
2345
+ {
2346
+ return Gosu::Input::axis(btn);
2347
+ }
2348
2348
  }
2349
2349
 
2350
2350
  // Global graphics functions
@@ -2513,15 +2513,16 @@ SWIG_From_unsigned_SS_long (unsigned long value)
2513
2513
 
2514
2514
 
2515
2515
  SWIGINTERN VALUE
2516
- SWIG_ruby_failed(void)
2516
+ SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
2517
2517
  {
2518
2518
  return Qnil;
2519
2519
  }
2520
2520
 
2521
2521
 
2522
- /*@SWIG:/usr/local/Cellar/swig/3.0.12/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2523
- SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
2522
+ /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2523
+ SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg)
2524
2524
  {
2525
+ VALUE *args = (VALUE *)arg;
2525
2526
  VALUE obj = args[0];
2526
2527
  VALUE type = TYPE(obj);
2527
2528
  double *res = (double *)(args[1]);
@@ -2539,7 +2540,7 @@ SWIG_AsVal_double (VALUE obj, double *val)
2539
2540
  VALUE a[2];
2540
2541
  a[0] = obj;
2541
2542
  a[1] = (VALUE)(&v);
2542
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2543
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2543
2544
  if (val) *val = v;
2544
2545
  return SWIG_OK;
2545
2546
  }
@@ -2561,9 +2562,10 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2561
2562
  #include <string>
2562
2563
 
2563
2564
 
2564
- /*@SWIG:/usr/local/Cellar/swig/3.0.12/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2565
- SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2565
+ /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2566
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg)
2566
2567
  {
2568
+ VALUE *args = (VALUE *)arg;
2567
2569
  VALUE obj = args[0];
2568
2570
  VALUE type = TYPE(obj);
2569
2571
  unsigned long *res = (unsigned long *)(args[1]);
@@ -2581,7 +2583,7 @@ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
2581
2583
  VALUE a[2];
2582
2584
  a[0] = obj;
2583
2585
  a[1] = (VALUE)(&v);
2584
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2586
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2585
2587
  if (val) *val = v;
2586
2588
  return SWIG_OK;
2587
2589
  }
@@ -2628,6 +2630,9 @@ SWIGINTERN Gosu::Color Gosu_Color_argb__SWIG_1(Gosu::Color::Channel a,Gosu::Colo
2628
2630
  SWIGINTERN Gosu::Color Gosu_Color_argb__SWIG_2(std::uint32_t argb){
2629
2631
  return Gosu::Color(argb);
2630
2632
  }
2633
+ SWIGINTERN std::uint32_t Gosu_Color_to_i(Gosu::Color const *self){
2634
+ return self->argb();
2635
+ }
2631
2636
  SWIGINTERN Gosu::Color Gosu_Color_dup(Gosu::Color const *self){
2632
2637
  return *self;
2633
2638
  }
@@ -2763,9 +2768,10 @@ SWIG_AsPtr_std_string (VALUE obj, std::string **val)
2763
2768
  }
2764
2769
 
2765
2770
 
2766
- /*@SWIG:/usr/local/Cellar/swig/3.0.12/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2767
- SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2771
+ /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2772
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg)
2768
2773
  {
2774
+ VALUE *args = (VALUE *)arg;
2769
2775
  VALUE obj = args[0];
2770
2776
  VALUE type = TYPE(obj);
2771
2777
  long *res = (long *)(args[1]);
@@ -2783,7 +2789,7 @@ SWIG_AsVal_long (VALUE obj, long* val)
2783
2789
  VALUE a[2];
2784
2790
  a[0] = obj;
2785
2791
  a[1] = (VALUE)(&v);
2786
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2792
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2787
2793
  if (val) *val = v;
2788
2794
  return SWIG_OK;
2789
2795
  }
@@ -2862,8 +2868,8 @@ SWIGINTERN Gosu::Image *new_Gosu_Image(VALUE source,VALUE options=0){
2862
2868
  Gosu::Bitmap bmp;
2863
2869
  Gosu::load_bitmap(bmp, source);
2864
2870
 
2865
- unsigned src_x = 0, src_y = 0;
2866
- unsigned src_width = bmp.width(), src_height = bmp.height();
2871
+ int src_x = 0, src_y = 0;
2872
+ int src_width = bmp.width(), src_height = bmp.height();
2867
2873
  unsigned flags = 0;
2868
2874
 
2869
2875
  if (options) {
@@ -3060,10 +3066,10 @@ SWIGINTERN VALUE Gosu_Image_to_blob(Gosu::Image const *self){
3060
3066
  auto size = bmp.width() * bmp.height() * sizeof(Gosu::Color);
3061
3067
  return rb_str_new(reinterpret_cast<const char*>(bmp.data()), size);
3062
3068
  }
3063
- SWIGINTERN unsigned int Gosu_Image_columns(Gosu::Image const *self){
3069
+ SWIGINTERN int Gosu_Image_columns(Gosu::Image const *self){
3064
3070
  return self->width();
3065
3071
  }
3066
- SWIGINTERN unsigned int Gosu_Image_rows(Gosu::Image const *self){
3072
+ SWIGINTERN int Gosu_Image_rows(Gosu::Image const *self){
3067
3073
  return self->height();
3068
3074
  }
3069
3075
  SWIGINTERN void Gosu_Image_save(Gosu::Image const *self,std::string const &filename){
@@ -3195,10 +3201,10 @@ SwigDirector_TextInput::~SwigDirector_TextInput() {
3195
3201
  }
3196
3202
 
3197
3203
  std::string SwigDirector_TextInput::filter(std::string text) const {
3198
- std::string c_result ;
3199
3204
  VALUE obj0 = Qnil ;
3200
3205
  VALUE SWIGUNUSED result;
3201
3206
 
3207
+ std::string c_result;
3202
3208
  obj0 = SWIG_From_std_string(static_cast< std::string >(text));
3203
3209
  result = rb_funcall(swig_get_self(), rb_intern("filter"), 1,obj0);
3204
3210
  std::string *swig_optr = 0;
@@ -3212,7 +3218,7 @@ std::string SwigDirector_TextInput::filter(std::string text) const {
3212
3218
  }
3213
3219
 
3214
3220
 
3215
- SwigDirector_Window::SwigDirector_Window(VALUE self, unsigned int width, unsigned int height, bool fullscreen, double update_interval, bool resizable): Gosu::Window(width, height, fullscreen, update_interval, resizable), Swig::Director(self) {
3221
+ SwigDirector_Window::SwigDirector_Window(VALUE self,unsigned int width,unsigned int height,bool fullscreen,double update_interval,bool resizable): Gosu::Window(width, height, fullscreen, update_interval, resizable), Swig::Director(self) {
3216
3222
 
3217
3223
  }
3218
3224
 
@@ -3224,15 +3230,15 @@ SwigDirector_Window::~SwigDirector_Window() {
3224
3230
  void SwigDirector_Window::show() {
3225
3231
  VALUE SWIGUNUSED result;
3226
3232
 
3227
- result = rb_funcall(swig_get_self(), rb_intern("show"), 0, NULL);
3233
+ result = rb_funcall(swig_get_self(), rb_intern("show"), 0, Qnil);
3228
3234
  }
3229
3235
 
3230
3236
 
3231
3237
  bool SwigDirector_Window::tick() {
3232
- bool c_result ;
3238
+ bool c_result = SwigValueInit< bool >() ;
3233
3239
  VALUE SWIGUNUSED result;
3234
3240
 
3235
- result = rb_funcall(swig_get_self(), rb_intern("tick"), 0, NULL);
3241
+ result = rb_funcall(swig_get_self(), rb_intern("tick"), 0, Qnil);
3236
3242
  bool swig_val;
3237
3243
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
3238
3244
  if (!SWIG_IsOK(swig_res)) {
@@ -3246,29 +3252,29 @@ bool SwigDirector_Window::tick() {
3246
3252
  void SwigDirector_Window::close() {
3247
3253
  VALUE SWIGUNUSED result;
3248
3254
 
3249
- result = rb_funcall(swig_get_self(), rb_intern("close"), 0, NULL);
3255
+ result = rb_funcall(swig_get_self(), rb_intern("close"), 0, Qnil);
3250
3256
  }
3251
3257
 
3252
3258
 
3253
3259
  void SwigDirector_Window::update() {
3254
3260
  VALUE SWIGUNUSED result;
3255
3261
 
3256
- result = rb_funcall(swig_get_self(), rb_intern("protected_update"), 0, NULL);
3262
+ result = rb_funcall(swig_get_self(), rb_intern("protected_update"), 0, Qnil);
3257
3263
  }
3258
3264
 
3259
3265
 
3260
3266
  void SwigDirector_Window::draw() {
3261
3267
  VALUE SWIGUNUSED result;
3262
3268
 
3263
- result = rb_funcall(swig_get_self(), rb_intern("protected_draw_2"), 0, NULL);
3269
+ result = rb_funcall(swig_get_self(), rb_intern("protected_draw_2"), 0, Qnil);
3264
3270
  }
3265
3271
 
3266
3272
 
3267
3273
  bool SwigDirector_Window::needs_redraw() const {
3268
- bool c_result ;
3274
+ bool c_result = SwigValueInit< bool >() ;
3269
3275
  VALUE SWIGUNUSED result;
3270
3276
 
3271
- result = rb_funcall(swig_get_self(), rb_intern("protected_needs_redraw?"), 0, NULL);
3277
+ result = rb_funcall(swig_get_self(), rb_intern("protected_needs_redraw?"), 0, Qnil);
3272
3278
  bool swig_val;
3273
3279
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
3274
3280
  if (!SWIG_IsOK(swig_res)) {
@@ -3280,10 +3286,10 @@ bool SwigDirector_Window::needs_redraw() const {
3280
3286
 
3281
3287
 
3282
3288
  bool SwigDirector_Window::needs_cursor() const {
3283
- bool c_result ;
3289
+ bool c_result = SwigValueInit< bool >() ;
3284
3290
  VALUE SWIGUNUSED result;
3285
3291
 
3286
- result = rb_funcall(swig_get_self(), rb_intern("protected_needs_cursor?"), 0, NULL);
3292
+ result = rb_funcall(swig_get_self(), rb_intern("protected_needs_cursor?"), 0, Qnil);
3287
3293
  bool swig_val;
3288
3294
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
3289
3295
  if (!SWIG_IsOK(swig_res)) {
@@ -3297,14 +3303,14 @@ bool SwigDirector_Window::needs_cursor() const {
3297
3303
  void SwigDirector_Window::lose_focus() {
3298
3304
  VALUE SWIGUNUSED result;
3299
3305
 
3300
- result = rb_funcall(swig_get_self(), rb_intern("protected_lose_focus"), 0, NULL);
3306
+ result = rb_funcall(swig_get_self(), rb_intern("protected_lose_focus"), 0, Qnil);
3301
3307
  }
3302
3308
 
3303
3309
 
3304
3310
  void SwigDirector_Window::release_memory() {
3305
3311
  VALUE SWIGUNUSED result;
3306
3312
 
3307
- result = rb_funcall(swig_get_self(), rb_intern("release_memory"), 0, NULL);
3313
+ result = rb_funcall(swig_get_self(), rb_intern("release_memory"), 0, Qnil);
3308
3314
  }
3309
3315
 
3310
3316
 
@@ -3313,7 +3319,7 @@ void SwigDirector_Window::button_down(Gosu::Button arg0) {
3313
3319
  VALUE SWIGUNUSED result;
3314
3320
 
3315
3321
  {
3316
- obj0 = arg0 == Gosu::NO_BUTTON ? Qnil : LONG2NUM((&arg0)->id());
3322
+ obj0 = arg0 == Gosu::NO_BUTTON ? Qnil : LONG2NUM(arg0);
3317
3323
  }
3318
3324
  result = rb_funcall(swig_get_self(), rb_intern("protected_button_down"), 1,obj0);
3319
3325
  }
@@ -3324,18 +3330,36 @@ void SwigDirector_Window::button_up(Gosu::Button arg0) {
3324
3330
  VALUE SWIGUNUSED result;
3325
3331
 
3326
3332
  {
3327
- obj0 = arg0 == Gosu::NO_BUTTON ? Qnil : LONG2NUM((&arg0)->id());
3333
+ obj0 = arg0 == Gosu::NO_BUTTON ? Qnil : LONG2NUM(arg0);
3328
3334
  }
3329
3335
  result = rb_funcall(swig_get_self(), rb_intern("protected_button_up"), 1,obj0);
3330
3336
  }
3331
3337
 
3332
3338
 
3339
+ void SwigDirector_Window::gamepad_connected(int index) {
3340
+ VALUE obj0 = Qnil ;
3341
+ VALUE SWIGUNUSED result;
3342
+
3343
+ obj0 = SWIG_From_int(static_cast< int >(index));
3344
+ result = rb_funcall(swig_get_self(), rb_intern("protected_gamepad_connected"), 1,obj0);
3345
+ }
3346
+
3347
+
3348
+ void SwigDirector_Window::gamepad_disconnected(int index) {
3349
+ VALUE obj0 = Qnil ;
3350
+ VALUE SWIGUNUSED result;
3351
+
3352
+ obj0 = SWIG_From_int(static_cast< int >(index));
3353
+ result = rb_funcall(swig_get_self(), rb_intern("protected_gamepad_disconnected"), 1,obj0);
3354
+ }
3355
+
3356
+
3333
3357
  void SwigDirector_Window::drop(std::string const &filename) {
3334
3358
  VALUE obj0 = Qnil ;
3335
3359
  VALUE SWIGUNUSED result;
3336
3360
 
3337
3361
  obj0 = SWIG_From_std_string(static_cast< std::string >(filename));
3338
- result = rb_funcall(swig_get_self(), rb_intern("drop"), 1,obj0);
3362
+ result = rb_funcall(swig_get_self(), rb_intern("protected_drop"), 1,obj0);
3339
3363
  }
3340
3364
 
3341
3365
 
@@ -3802,25 +3826,6 @@ fail:
3802
3826
  }
3803
3827
 
3804
3828
 
3805
- SWIGINTERN VALUE
3806
- _wrap__release_all_openal_resources(int argc, VALUE *argv, VALUE self) {
3807
- if ((argc < 0) || (argc > 0)) {
3808
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3809
- }
3810
- {
3811
- try {
3812
- Gosu::al_shutdown();
3813
- }
3814
- catch (const std::exception& e) {
3815
- SWIG_exception(SWIG_RuntimeError, e.what());
3816
- }
3817
- }
3818
- return Qnil;
3819
- fail:
3820
- return Qnil;
3821
- }
3822
-
3823
-
3824
3829
  static swig_class SwigClassColor;
3825
3830
 
3826
3831
  SWIGINTERN VALUE
@@ -5016,6 +5021,44 @@ fail:
5016
5021
  }
5017
5022
 
5018
5023
 
5024
+ /*
5025
+ Document-method: Gosu::Color.to_i
5026
+
5027
+ call-seq:
5028
+ to_i -> std::uint32_t
5029
+
5030
+ Convert Color to an Integer.
5031
+ */
5032
+ SWIGINTERN VALUE
5033
+ _wrap_Color_to_i(int argc, VALUE *argv, VALUE self) {
5034
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
5035
+ void *argp1 = 0 ;
5036
+ int res1 = 0 ;
5037
+ std::uint32_t result;
5038
+ VALUE vresult = Qnil;
5039
+
5040
+ if ((argc < 0) || (argc > 0)) {
5041
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
5042
+ }
5043
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
5044
+ if (!SWIG_IsOK(res1)) {
5045
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","to_i", 1, self ));
5046
+ }
5047
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
5048
+ {
5049
+ try {
5050
+ result = Gosu_Color_to_i((Gosu::Color const *)arg1);
5051
+ }
5052
+ catch (const std::exception& e) {
5053
+ SWIG_exception(SWIG_RuntimeError, e.what());
5054
+ }
5055
+ }
5056
+ vresult = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(result));
5057
+ return vresult;
5058
+ fail:
5059
+ return Qnil;
5060
+ }
5061
+
5019
5062
 
5020
5063
  /*
5021
5064
  Document-method: Gosu::Color.dup
@@ -5056,7 +5099,6 @@ fail:
5056
5099
  }
5057
5100
 
5058
5101
 
5059
-
5060
5102
  /*
5061
5103
  Document-method: Gosu::Color.inspect
5062
5104
 
@@ -5096,7 +5138,6 @@ fail:
5096
5138
  }
5097
5139
 
5098
5140
 
5099
-
5100
5141
  /*
5101
5142
  Document-method: Gosu::Color.==
5102
5143
 
@@ -5699,7 +5740,7 @@ SWIGINTERN VALUE _wrap_new_Font(int nargs, VALUE *args, VALUE self) {
5699
5740
  if (argc == 3) {
5700
5741
  int _v;
5701
5742
  void *vptr = 0;
5702
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, 0);
5743
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, SWIG_POINTER_NO_NULL);
5703
5744
  _v = SWIG_CheckState(res);
5704
5745
  if (_v) {
5705
5746
  int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
@@ -6170,7 +6211,7 @@ _wrap_Image_draw(int argc, VALUE *argv, VALUE self) {
6170
6211
  Gosu::Image *arg1 = (Gosu::Image *) 0 ;
6171
6212
  double arg2 ;
6172
6213
  double arg3 ;
6173
- Gosu::ZPos arg4 ;
6214
+ Gosu::ZPos arg4 = (Gosu::ZPos) 0 ;
6174
6215
  double arg5 = (double) 1 ;
6175
6216
  double arg6 = (double) 1 ;
6176
6217
  Gosu::Color arg7 = (Gosu::Color) Gosu::Color::WHITE ;
@@ -6188,8 +6229,8 @@ _wrap_Image_draw(int argc, VALUE *argv, VALUE self) {
6188
6229
  double val6 ;
6189
6230
  int ecode6 = 0 ;
6190
6231
 
6191
- if ((argc < 3) || (argc > 7)) {
6192
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
6232
+ if ((argc < 2) || (argc > 7)) {
6233
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
6193
6234
  }
6194
6235
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Image, 0 | 0 );
6195
6236
  if (!SWIG_IsOK(res1)) {
@@ -6206,11 +6247,13 @@ _wrap_Image_draw(int argc, VALUE *argv, VALUE self) {
6206
6247
  SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw", 3, argv[1] ));
6207
6248
  }
6208
6249
  arg3 = static_cast< double >(val3);
6209
- ecode4 = SWIG_AsVal_double(argv[2], &val4);
6210
- if (!SWIG_IsOK(ecode4)) {
6211
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Gosu::ZPos","draw", 4, argv[2] ));
6212
- }
6213
- arg4 = static_cast< Gosu::ZPos >(val4);
6250
+ if (argc > 2) {
6251
+ ecode4 = SWIG_AsVal_double(argv[2], &val4);
6252
+ if (!SWIG_IsOK(ecode4)) {
6253
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Gosu::ZPos","draw", 4, argv[2] ));
6254
+ }
6255
+ arg4 = static_cast< Gosu::ZPos >(val4);
6256
+ }
6214
6257
  if (argc > 3) {
6215
6258
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
6216
6259
  if (!SWIG_IsOK(ecode5)) {
@@ -6447,8 +6490,8 @@ _wrap_Image_draw_rot(int argc, VALUE *argv, VALUE self) {
6447
6490
  Gosu::Image *arg1 = (Gosu::Image *) 0 ;
6448
6491
  double arg2 ;
6449
6492
  double arg3 ;
6450
- Gosu::ZPos arg4 ;
6451
- double arg5 ;
6493
+ Gosu::ZPos arg4 = (Gosu::ZPos) 0 ;
6494
+ double arg5 = (double) 0 ;
6452
6495
  double arg6 = (double) 0.5 ;
6453
6496
  double arg7 = (double) 0.5 ;
6454
6497
  double arg8 = (double) 1 ;
@@ -6474,8 +6517,8 @@ _wrap_Image_draw_rot(int argc, VALUE *argv, VALUE self) {
6474
6517
  double val9 ;
6475
6518
  int ecode9 = 0 ;
6476
6519
 
6477
- if ((argc < 4) || (argc > 10)) {
6478
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
6520
+ if ((argc < 2) || (argc > 10)) {
6521
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
6479
6522
  }
6480
6523
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Image, 0 | 0 );
6481
6524
  if (!SWIG_IsOK(res1)) {
@@ -6492,16 +6535,20 @@ _wrap_Image_draw_rot(int argc, VALUE *argv, VALUE self) {
6492
6535
  SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw_rot", 3, argv[1] ));
6493
6536
  }
6494
6537
  arg3 = static_cast< double >(val3);
6495
- ecode4 = SWIG_AsVal_double(argv[2], &val4);
6496
- if (!SWIG_IsOK(ecode4)) {
6497
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_rot", 4, argv[2] ));
6498
- }
6499
- arg4 = static_cast< Gosu::ZPos >(val4);
6500
- ecode5 = SWIG_AsVal_double(argv[3], &val5);
6501
- if (!SWIG_IsOK(ecode5)) {
6502
- SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","draw_rot", 5, argv[3] ));
6503
- }
6504
- arg5 = static_cast< double >(val5);
6538
+ if (argc > 2) {
6539
+ ecode4 = SWIG_AsVal_double(argv[2], &val4);
6540
+ if (!SWIG_IsOK(ecode4)) {
6541
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_rot", 4, argv[2] ));
6542
+ }
6543
+ arg4 = static_cast< Gosu::ZPos >(val4);
6544
+ }
6545
+ if (argc > 3) {
6546
+ ecode5 = SWIG_AsVal_double(argv[3], &val5);
6547
+ if (!SWIG_IsOK(ecode5)) {
6548
+ SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","draw_rot", 5, argv[3] ));
6549
+ }
6550
+ arg5 = static_cast< double >(val5);
6551
+ }
6505
6552
  if (argc > 4) {
6506
6553
  ecode6 = SWIG_AsVal_double(argv[4], &val6);
6507
6554
  if (!SWIG_IsOK(ecode6)) {
@@ -7125,7 +7172,7 @@ SWIGINTERN VALUE _wrap_Image_load_tiles(int nargs, VALUE *args, VALUE self) {
7125
7172
  if (argc == 5) {
7126
7173
  int _v;
7127
7174
  void *vptr = 0;
7128
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, 0);
7175
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, SWIG_POINTER_NO_NULL);
7129
7176
  _v = SWIG_CheckState(res);
7130
7177
  if (_v) {
7131
7178
  _v = (argv[1] != 0);
@@ -7198,7 +7245,7 @@ _wrap_Image_columns(int argc, VALUE *argv, VALUE self) {
7198
7245
  Gosu::Image *arg1 = (Gosu::Image *) 0 ;
7199
7246
  void *argp1 = 0 ;
7200
7247
  int res1 = 0 ;
7201
- unsigned int result;
7248
+ int result;
7202
7249
  VALUE vresult = Qnil;
7203
7250
 
7204
7251
  if ((argc < 0) || (argc > 0)) {
@@ -7211,13 +7258,13 @@ _wrap_Image_columns(int argc, VALUE *argv, VALUE self) {
7211
7258
  arg1 = reinterpret_cast< Gosu::Image * >(argp1);
7212
7259
  {
7213
7260
  try {
7214
- result = (unsigned int)Gosu_Image_columns((Gosu::Image const *)arg1);
7261
+ result = (int)Gosu_Image_columns((Gosu::Image const *)arg1);
7215
7262
  }
7216
7263
  catch (const std::exception& e) {
7217
7264
  SWIG_exception(SWIG_RuntimeError, e.what());
7218
7265
  }
7219
7266
  }
7220
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
7267
+ vresult = SWIG_From_int(static_cast< int >(result));
7221
7268
  return vresult;
7222
7269
  fail:
7223
7270
  return Qnil;
@@ -7229,7 +7276,7 @@ _wrap_Image_rows(int argc, VALUE *argv, VALUE self) {
7229
7276
  Gosu::Image *arg1 = (Gosu::Image *) 0 ;
7230
7277
  void *argp1 = 0 ;
7231
7278
  int res1 = 0 ;
7232
- unsigned int result;
7279
+ int result;
7233
7280
  VALUE vresult = Qnil;
7234
7281
 
7235
7282
  if ((argc < 0) || (argc > 0)) {
@@ -7242,13 +7289,13 @@ _wrap_Image_rows(int argc, VALUE *argv, VALUE self) {
7242
7289
  arg1 = reinterpret_cast< Gosu::Image * >(argp1);
7243
7290
  {
7244
7291
  try {
7245
- result = (unsigned int)Gosu_Image_rows((Gosu::Image const *)arg1);
7292
+ result = (int)Gosu_Image_rows((Gosu::Image const *)arg1);
7246
7293
  }
7247
7294
  catch (const std::exception& e) {
7248
7295
  SWIG_exception(SWIG_RuntimeError, e.what());
7249
7296
  }
7250
7297
  }
7251
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
7298
+ vresult = SWIG_From_int(static_cast< int >(result));
7252
7299
  return vresult;
7253
7300
  fail:
7254
7301
  return Qnil;
@@ -7298,7 +7345,6 @@ fail:
7298
7345
  }
7299
7346
 
7300
7347
 
7301
-
7302
7348
  /*
7303
7349
  Document-method: Gosu::Image.insert
7304
7350
 
@@ -7353,7 +7399,6 @@ fail:
7353
7399
  }
7354
7400
 
7355
7401
 
7356
-
7357
7402
  /*
7358
7403
  Document-method: Gosu::Image.inspect
7359
7404
 
@@ -9508,6 +9553,104 @@ fail:
9508
9553
  }
9509
9554
 
9510
9555
 
9556
+ SWIGINTERN VALUE
9557
+ _wrap_Window_gamepad_connected(int argc, VALUE *argv, VALUE self) {
9558
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
9559
+ int arg2 ;
9560
+ void *argp1 = 0 ;
9561
+ int res1 = 0 ;
9562
+ int val2 ;
9563
+ int ecode2 = 0 ;
9564
+ Swig::Director *director = 0;
9565
+ bool upcall = false;
9566
+
9567
+ if ((argc < 1) || (argc > 1)) {
9568
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
9569
+ }
9570
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9571
+ if (!SWIG_IsOK(res1)) {
9572
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","gamepad_connected", 1, self ));
9573
+ }
9574
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9575
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
9576
+ if (!SWIG_IsOK(ecode2)) {
9577
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","gamepad_connected", 2, argv[0] ));
9578
+ }
9579
+ arg2 = static_cast< int >(val2);
9580
+ director = dynamic_cast<Swig::Director *>(arg1);
9581
+ upcall = (director && (director->swig_get_self() == self));
9582
+ try {
9583
+ {
9584
+ try {
9585
+ if (upcall) {
9586
+ (arg1)->Gosu::Window::gamepad_connected(arg2);
9587
+ } else {
9588
+ (arg1)->gamepad_connected(arg2);
9589
+ }
9590
+ }
9591
+ catch (const std::exception& e) {
9592
+ SWIG_exception(SWIG_RuntimeError, e.what());
9593
+ }
9594
+ }
9595
+ } catch (Swig::DirectorException& e) {
9596
+ rb_exc_raise(e.getError());
9597
+ SWIG_fail;
9598
+ }
9599
+ return Qnil;
9600
+ fail:
9601
+ return Qnil;
9602
+ }
9603
+
9604
+
9605
+ SWIGINTERN VALUE
9606
+ _wrap_Window_gamepad_disconnected(int argc, VALUE *argv, VALUE self) {
9607
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
9608
+ int arg2 ;
9609
+ void *argp1 = 0 ;
9610
+ int res1 = 0 ;
9611
+ int val2 ;
9612
+ int ecode2 = 0 ;
9613
+ Swig::Director *director = 0;
9614
+ bool upcall = false;
9615
+
9616
+ if ((argc < 1) || (argc > 1)) {
9617
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
9618
+ }
9619
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9620
+ if (!SWIG_IsOK(res1)) {
9621
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","gamepad_disconnected", 1, self ));
9622
+ }
9623
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9624
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
9625
+ if (!SWIG_IsOK(ecode2)) {
9626
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","gamepad_disconnected", 2, argv[0] ));
9627
+ }
9628
+ arg2 = static_cast< int >(val2);
9629
+ director = dynamic_cast<Swig::Director *>(arg1);
9630
+ upcall = (director && (director->swig_get_self() == self));
9631
+ try {
9632
+ {
9633
+ try {
9634
+ if (upcall) {
9635
+ (arg1)->Gosu::Window::gamepad_disconnected(arg2);
9636
+ } else {
9637
+ (arg1)->gamepad_disconnected(arg2);
9638
+ }
9639
+ }
9640
+ catch (const std::exception& e) {
9641
+ SWIG_exception(SWIG_RuntimeError, e.what());
9642
+ }
9643
+ }
9644
+ } catch (Swig::DirectorException& e) {
9645
+ rb_exc_raise(e.getError());
9646
+ SWIG_fail;
9647
+ }
9648
+ return Qnil;
9649
+ fail:
9650
+ return Qnil;
9651
+ }
9652
+
9653
+
9511
9654
  SWIGINTERN VALUE
9512
9655
  _wrap_Window_drop(int argc, VALUE *argv, VALUE self) {
9513
9656
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -10128,14 +10271,14 @@ _wrap_char_to_button_id(int argc, VALUE *argv, VALUE self) {
10128
10271
  }
10129
10272
  {
10130
10273
  try {
10131
- result = Gosu::char_to_button_id(arg1);
10274
+ result = (Gosu::Button)Gosu::char_to_button_id(arg1);
10132
10275
  }
10133
10276
  catch (const std::exception& e) {
10134
10277
  SWIG_exception(SWIG_RuntimeError, e.what());
10135
10278
  }
10136
10279
  }
10137
10280
  {
10138
- vresult = result == Gosu::NO_BUTTON ? Qnil : LONG2NUM((&result)->id());
10281
+ vresult = result == Gosu::NO_BUTTON ? Qnil : LONG2NUM(result);
10139
10282
  }
10140
10283
  return vresult;
10141
10284
  fail:
@@ -10197,6 +10340,91 @@ fail:
10197
10340
  }
10198
10341
 
10199
10342
 
10343
+ SWIGINTERN VALUE
10344
+ _wrap_button_name(int argc, VALUE *argv, VALUE self) {
10345
+ Gosu::Button arg1 ;
10346
+ VALUE result;
10347
+ VALUE vresult = Qnil;
10348
+
10349
+ if ((argc < 1) || (argc > 1)) {
10350
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
10351
+ }
10352
+ {
10353
+ arg1 = NIL_P(argv[0]) ? Gosu::NO_BUTTON : Gosu::Button(NUM2LONG(argv[0]));
10354
+ }
10355
+ {
10356
+ try {
10357
+ result = (VALUE)Gosu::button_name(arg1);
10358
+ }
10359
+ catch (const std::exception& e) {
10360
+ SWIG_exception(SWIG_RuntimeError, e.what());
10361
+ }
10362
+ }
10363
+ vresult = result;
10364
+ return vresult;
10365
+ fail:
10366
+ return Qnil;
10367
+ }
10368
+
10369
+
10370
+ SWIGINTERN VALUE
10371
+ _wrap_gamepad_name(int argc, VALUE *argv, VALUE self) {
10372
+ int arg1 ;
10373
+ int val1 ;
10374
+ int ecode1 = 0 ;
10375
+ VALUE result;
10376
+ VALUE vresult = Qnil;
10377
+
10378
+ if ((argc < 1) || (argc > 1)) {
10379
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
10380
+ }
10381
+ ecode1 = SWIG_AsVal_int(argv[0], &val1);
10382
+ if (!SWIG_IsOK(ecode1)) {
10383
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","Gosu::gamepad_name", 1, argv[0] ));
10384
+ }
10385
+ arg1 = static_cast< int >(val1);
10386
+ {
10387
+ try {
10388
+ result = (VALUE)Gosu::gamepad_name(arg1);
10389
+ }
10390
+ catch (const std::exception& e) {
10391
+ SWIG_exception(SWIG_RuntimeError, e.what());
10392
+ }
10393
+ }
10394
+ vresult = result;
10395
+ return vresult;
10396
+ fail:
10397
+ return Qnil;
10398
+ }
10399
+
10400
+
10401
+ SWIGINTERN VALUE
10402
+ _wrap_axis(int argc, VALUE *argv, VALUE self) {
10403
+ Gosu::Button arg1 ;
10404
+ double result;
10405
+ VALUE vresult = Qnil;
10406
+
10407
+ if ((argc < 1) || (argc > 1)) {
10408
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
10409
+ }
10410
+ {
10411
+ arg1 = NIL_P(argv[0]) ? Gosu::NO_BUTTON : Gosu::Button(NUM2LONG(argv[0]));
10412
+ }
10413
+ {
10414
+ try {
10415
+ result = (double)Gosu::axis(arg1);
10416
+ }
10417
+ catch (const std::exception& e) {
10418
+ SWIG_exception(SWIG_RuntimeError, e.what());
10419
+ }
10420
+ }
10421
+ vresult = SWIG_From_double(static_cast< double >(result));
10422
+ return vresult;
10423
+ fail:
10424
+ return Qnil;
10425
+ }
10426
+
10427
+
10200
10428
  SWIGINTERN VALUE
10201
10429
  _wrap_draw_line(int argc, VALUE *argv, VALUE self) {
10202
10430
  double arg1 ;
@@ -11422,7 +11650,6 @@ fail:
11422
11650
 
11423
11651
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
11424
11652
 
11425
- static swig_type_info _swigt__p_Gosu__Button = {"_p_Gosu__Button", "Gosu::Button *", 0, 0, (void*)0, 0};
11426
11653
  static swig_type_info _swigt__p_Gosu__Channel = {"_p_Gosu__Channel", "Gosu::Channel *", 0, 0, (void*)0, 0};
11427
11654
  static swig_type_info _swigt__p_Gosu__Color = {"_p_Gosu__Color", "Gosu::Color *", 0, 0, (void*)0, 0};
11428
11655
  static swig_type_info _swigt__p_Gosu__Font = {"_p_Gosu__Font", "Gosu::Font *", 0, 0, (void*)0, 0};
@@ -11438,7 +11665,6 @@ static swig_type_info _swigt__p_std__arrayT_double_16_t = {"_p_std__arrayT_doubl
11438
11665
  static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
11439
11666
 
11440
11667
  static swig_type_info *swig_type_initial[] = {
11441
- &_swigt__p_Gosu__Button,
11442
11668
  &_swigt__p_Gosu__Channel,
11443
11669
  &_swigt__p_Gosu__Color,
11444
11670
  &_swigt__p_Gosu__Font,
@@ -11454,7 +11680,6 @@ static swig_type_info *swig_type_initial[] = {
11454
11680
  &_swigt__p_std__string,
11455
11681
  };
11456
11682
 
11457
- static swig_cast_info _swigc__p_Gosu__Button[] = { {&_swigt__p_Gosu__Button, 0, 0, 0},{0, 0, 0, 0}};
11458
11683
  static swig_cast_info _swigc__p_Gosu__Channel[] = { {&_swigt__p_Gosu__Channel, 0, 0, 0},{0, 0, 0, 0}};
11459
11684
  static swig_cast_info _swigc__p_Gosu__Color[] = { {&_swigt__p_Gosu__Color, 0, 0, 0},{0, 0, 0, 0}};
11460
11685
  static swig_cast_info _swigc__p_Gosu__Font[] = { {&_swigt__p_Gosu__Font, 0, 0, 0},{0, 0, 0, 0}};
@@ -11470,7 +11695,6 @@ static swig_cast_info _swigc__p_std__arrayT_double_16_t[] = { {&_swigt__p_std__
11470
11695
  static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
11471
11696
 
11472
11697
  static swig_cast_info *swig_cast_initial[] = {
11473
- _swigc__p_Gosu__Button,
11474
11698
  _swigc__p_Gosu__Channel,
11475
11699
  _swigc__p_Gosu__Color,
11476
11700
  _swigc__p_Gosu__Font,
@@ -11589,7 +11813,7 @@ SWIG_InitializeModule(void *clientdata) {
11589
11813
 
11590
11814
  /* Now work on filling in swig_module.types */
11591
11815
  #ifdef SWIGRUNTIME_DEBUG
11592
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
11816
+ printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
11593
11817
  #endif
11594
11818
  for (i = 0; i < swig_module.size; ++i) {
11595
11819
  swig_type_info *type = 0;
@@ -11597,7 +11821,7 @@ SWIG_InitializeModule(void *clientdata) {
11597
11821
  swig_cast_info *cast;
11598
11822
 
11599
11823
  #ifdef SWIGRUNTIME_DEBUG
11600
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
11824
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
11601
11825
  #endif
11602
11826
 
11603
11827
  /* if there is another module already loaded */
@@ -11673,7 +11897,7 @@ SWIG_InitializeModule(void *clientdata) {
11673
11897
  for (i = 0; i < swig_module.size; ++i) {
11674
11898
  int j = 0;
11675
11899
  swig_cast_info *cast = swig_module.cast_initial[i];
11676
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
11900
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
11677
11901
  while (cast->type) {
11678
11902
  printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
11679
11903
  cast++;
@@ -11740,9 +11964,9 @@ SWIGEXPORT void Init_gosu(void) {
11740
11964
  SWIG_RubyInitializeTrackings();
11741
11965
  rb_define_const(mGosu, "VERSION", SWIG_From_std_string(static_cast< std::string >(Gosu::VERSION)));
11742
11966
  rb_define_const(mGosu, "LICENSES", SWIG_From_std_string(static_cast< std::string >(Gosu::LICENSES)));
11743
- rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(0)));
11744
- rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(14)));
11745
- rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(5)));
11967
+ rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(1)));
11968
+ rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(0)));
11969
+ rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(0)));
11746
11970
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
11747
11971
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
11748
11972
  rb_define_module_function(mGosu, "degrees_to_radians", VALUEFUNC(_wrap_degrees_to_radians), -1);
@@ -11757,7 +11981,6 @@ SWIGEXPORT void Init_gosu(void) {
11757
11981
  rb_define_const(mGosu, "MAX_TEXTURE_SIZE", SWIG_From_unsigned_SS_int(static_cast< unsigned int >(Gosu::MAX_TEXTURE_SIZE)));
11758
11982
  rb_define_module_function(mGosu, "language", VALUEFUNC(_wrap_language), -1);
11759
11983
  rb_define_module_function(mGosu, "enable_undocumented_retrofication", VALUEFUNC(_wrap_enable_undocumented_retrofication), -1);
11760
- rb_define_module_function(mGosu, "_release_all_openal_resources", VALUEFUNC(_wrap__release_all_openal_resources), -1);
11761
11984
 
11762
11985
  SwigClassColor.klass = rb_define_class_under(mGosu, "Color", rb_cObject);
11763
11986
  SWIG_TypeClientData(SWIGTYPE_p_Gosu__Color, (void *) &SwigClassColor);
@@ -11786,6 +12009,7 @@ SWIGEXPORT void Init_gosu(void) {
11786
12009
  rb_define_singleton_method(SwigClassColor.klass, "rgb", VALUEFUNC(_wrap_Color_rgb), -1);
11787
12010
  rb_define_singleton_method(SwigClassColor.klass, "rgba", VALUEFUNC(_wrap_Color_rgba), -1);
11788
12011
  rb_define_singleton_method(SwigClassColor.klass, "argb", VALUEFUNC(_wrap_Color_argb), -1);
12012
+ rb_define_method(SwigClassColor.klass, "to_i", VALUEFUNC(_wrap_Color_to_i), -1);
11789
12013
  rb_define_method(SwigClassColor.klass, "dup", VALUEFUNC(_wrap_Color_dup), -1);
11790
12014
  rb_define_method(SwigClassColor.klass, "inspect", VALUEFUNC(_wrap_Color_inspect), -1);
11791
12015
  rb_define_method(SwigClassColor.klass, "==", VALUEFUNC(_wrap_Color___eq__), -1);
@@ -11934,6 +12158,9 @@ SWIGEXPORT void Init_gosu(void) {
11934
12158
  rb_define_const(mGosu, "KB_DOWN", SWIG_From_int(static_cast< int >(Gosu::KB_DOWN)));
11935
12159
  rb_define_const(mGosu, "KB_HOME", SWIG_From_int(static_cast< int >(Gosu::KB_HOME)));
11936
12160
  rb_define_const(mGosu, "KB_END", SWIG_From_int(static_cast< int >(Gosu::KB_END)));
12161
+ rb_define_const(mGosu, "KB_PRINT_SCREEN", SWIG_From_int(static_cast< int >(Gosu::KB_PRINT_SCREEN)));
12162
+ rb_define_const(mGosu, "KB_SCROLL_LOCK", SWIG_From_int(static_cast< int >(Gosu::KB_SCROLL_LOCK)));
12163
+ rb_define_const(mGosu, "KB_PAUSE", SWIG_From_int(static_cast< int >(Gosu::KB_PAUSE)));
11937
12164
  rb_define_const(mGosu, "KB_INSERT", SWIG_From_int(static_cast< int >(Gosu::KB_INSERT)));
11938
12165
  rb_define_const(mGosu, "KB_DELETE", SWIG_From_int(static_cast< int >(Gosu::KB_DELETE)));
11939
12166
  rb_define_const(mGosu, "KB_PAGE_UP", SWIG_From_int(static_cast< int >(Gosu::KB_PAGE_UP)));
@@ -11950,6 +12177,7 @@ SWIGEXPORT void Init_gosu(void) {
11950
12177
  rb_define_const(mGosu, "KB_COMMA", SWIG_From_int(static_cast< int >(Gosu::KB_COMMA)));
11951
12178
  rb_define_const(mGosu, "KB_PERIOD", SWIG_From_int(static_cast< int >(Gosu::KB_PERIOD)));
11952
12179
  rb_define_const(mGosu, "KB_SLASH", SWIG_From_int(static_cast< int >(Gosu::KB_SLASH)));
12180
+ rb_define_const(mGosu, "KB_CAPS_LOCK", SWIG_From_int(static_cast< int >(Gosu::KB_CAPS_LOCK)));
11953
12181
  rb_define_const(mGosu, "KB_A", SWIG_From_int(static_cast< int >(Gosu::KB_A)));
11954
12182
  rb_define_const(mGosu, "KB_B", SWIG_From_int(static_cast< int >(Gosu::KB_B)));
11955
12183
  rb_define_const(mGosu, "KB_C", SWIG_From_int(static_cast< int >(Gosu::KB_C)));
@@ -12005,10 +12233,10 @@ SWIGEXPORT void Init_gosu(void) {
12005
12233
  rb_define_const(mGosu, "MS_OTHER_5", SWIG_From_int(static_cast< int >(Gosu::MS_OTHER_5)));
12006
12234
  rb_define_const(mGosu, "MS_OTHER_6", SWIG_From_int(static_cast< int >(Gosu::MS_OTHER_6)));
12007
12235
  rb_define_const(mGosu, "MS_OTHER_7", SWIG_From_int(static_cast< int >(Gosu::MS_OTHER_7)));
12008
- rb_define_const(mGosu, "GP_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_LEFT)));
12009
- rb_define_const(mGosu, "GP_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_RIGHT)));
12010
- rb_define_const(mGosu, "GP_UP", SWIG_From_int(static_cast< int >(Gosu::GP_UP)));
12011
- rb_define_const(mGosu, "GP_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_DOWN)));
12236
+ rb_define_const(mGosu, "GP_DPAD_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_DPAD_LEFT)));
12237
+ rb_define_const(mGosu, "GP_DPAD_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_DPAD_RIGHT)));
12238
+ rb_define_const(mGosu, "GP_DPAD_UP", SWIG_From_int(static_cast< int >(Gosu::GP_DPAD_UP)));
12239
+ rb_define_const(mGosu, "GP_DPAD_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_DPAD_DOWN)));
12012
12240
  rb_define_const(mGosu, "GP_BUTTON_0", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_0)));
12013
12241
  rb_define_const(mGosu, "GP_BUTTON_1", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_1)));
12014
12242
  rb_define_const(mGosu, "GP_BUTTON_2", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_2)));
@@ -12025,10 +12253,10 @@ SWIGEXPORT void Init_gosu(void) {
12025
12253
  rb_define_const(mGosu, "GP_BUTTON_13", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_13)));
12026
12254
  rb_define_const(mGosu, "GP_BUTTON_14", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_14)));
12027
12255
  rb_define_const(mGosu, "GP_BUTTON_15", SWIG_From_int(static_cast< int >(Gosu::GP_BUTTON_15)));
12028
- rb_define_const(mGosu, "GP_0_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_0_LEFT)));
12029
- rb_define_const(mGosu, "GP_0_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_0_RIGHT)));
12030
- rb_define_const(mGosu, "GP_0_UP", SWIG_From_int(static_cast< int >(Gosu::GP_0_UP)));
12031
- rb_define_const(mGosu, "GP_0_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_0_DOWN)));
12256
+ rb_define_const(mGosu, "GP_0_DPAD_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_0_DPAD_LEFT)));
12257
+ rb_define_const(mGosu, "GP_0_DPAD_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_0_DPAD_RIGHT)));
12258
+ rb_define_const(mGosu, "GP_0_DPAD_UP", SWIG_From_int(static_cast< int >(Gosu::GP_0_DPAD_UP)));
12259
+ rb_define_const(mGosu, "GP_0_DPAD_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_0_DPAD_DOWN)));
12032
12260
  rb_define_const(mGosu, "GP_0_BUTTON_0", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_0)));
12033
12261
  rb_define_const(mGosu, "GP_0_BUTTON_1", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_1)));
12034
12262
  rb_define_const(mGosu, "GP_0_BUTTON_2", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_2)));
@@ -12045,10 +12273,10 @@ SWIGEXPORT void Init_gosu(void) {
12045
12273
  rb_define_const(mGosu, "GP_0_BUTTON_13", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_13)));
12046
12274
  rb_define_const(mGosu, "GP_0_BUTTON_14", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_14)));
12047
12275
  rb_define_const(mGosu, "GP_0_BUTTON_15", SWIG_From_int(static_cast< int >(Gosu::GP_0_BUTTON_15)));
12048
- rb_define_const(mGosu, "GP_1_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_1_LEFT)));
12049
- rb_define_const(mGosu, "GP_1_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_1_RIGHT)));
12050
- rb_define_const(mGosu, "GP_1_UP", SWIG_From_int(static_cast< int >(Gosu::GP_1_UP)));
12051
- rb_define_const(mGosu, "GP_1_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_1_DOWN)));
12276
+ rb_define_const(mGosu, "GP_1_DPAD_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_1_DPAD_LEFT)));
12277
+ rb_define_const(mGosu, "GP_1_DPAD_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_1_DPAD_RIGHT)));
12278
+ rb_define_const(mGosu, "GP_1_DPAD_UP", SWIG_From_int(static_cast< int >(Gosu::GP_1_DPAD_UP)));
12279
+ rb_define_const(mGosu, "GP_1_DPAD_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_1_DPAD_DOWN)));
12052
12280
  rb_define_const(mGosu, "GP_1_BUTTON_0", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_0)));
12053
12281
  rb_define_const(mGosu, "GP_1_BUTTON_1", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_1)));
12054
12282
  rb_define_const(mGosu, "GP_1_BUTTON_2", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_2)));
@@ -12065,10 +12293,10 @@ SWIGEXPORT void Init_gosu(void) {
12065
12293
  rb_define_const(mGosu, "GP_1_BUTTON_13", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_13)));
12066
12294
  rb_define_const(mGosu, "GP_1_BUTTON_14", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_14)));
12067
12295
  rb_define_const(mGosu, "GP_1_BUTTON_15", SWIG_From_int(static_cast< int >(Gosu::GP_1_BUTTON_15)));
12068
- rb_define_const(mGosu, "GP_2_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_2_LEFT)));
12069
- rb_define_const(mGosu, "GP_2_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_2_RIGHT)));
12070
- rb_define_const(mGosu, "GP_2_UP", SWIG_From_int(static_cast< int >(Gosu::GP_2_UP)));
12071
- rb_define_const(mGosu, "GP_2_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_2_DOWN)));
12296
+ rb_define_const(mGosu, "GP_2_DPAD_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_2_DPAD_LEFT)));
12297
+ rb_define_const(mGosu, "GP_2_DPAD_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_2_DPAD_RIGHT)));
12298
+ rb_define_const(mGosu, "GP_2_DPAD_UP", SWIG_From_int(static_cast< int >(Gosu::GP_2_DPAD_UP)));
12299
+ rb_define_const(mGosu, "GP_2_DPAD_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_2_DPAD_DOWN)));
12072
12300
  rb_define_const(mGosu, "GP_2_BUTTON_0", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_0)));
12073
12301
  rb_define_const(mGosu, "GP_2_BUTTON_1", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_1)));
12074
12302
  rb_define_const(mGosu, "GP_2_BUTTON_2", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_2)));
@@ -12085,10 +12313,10 @@ SWIGEXPORT void Init_gosu(void) {
12085
12313
  rb_define_const(mGosu, "GP_2_BUTTON_13", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_13)));
12086
12314
  rb_define_const(mGosu, "GP_2_BUTTON_14", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_14)));
12087
12315
  rb_define_const(mGosu, "GP_2_BUTTON_15", SWIG_From_int(static_cast< int >(Gosu::GP_2_BUTTON_15)));
12088
- rb_define_const(mGosu, "GP_3_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_3_LEFT)));
12089
- rb_define_const(mGosu, "GP_3_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_3_RIGHT)));
12090
- rb_define_const(mGosu, "GP_3_UP", SWIG_From_int(static_cast< int >(Gosu::GP_3_UP)));
12091
- rb_define_const(mGosu, "GP_3_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_3_DOWN)));
12316
+ rb_define_const(mGosu, "GP_3_DPAD_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_3_DPAD_LEFT)));
12317
+ rb_define_const(mGosu, "GP_3_DPAD_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_3_DPAD_RIGHT)));
12318
+ rb_define_const(mGosu, "GP_3_DPAD_UP", SWIG_From_int(static_cast< int >(Gosu::GP_3_DPAD_UP)));
12319
+ rb_define_const(mGosu, "GP_3_DPAD_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_3_DPAD_DOWN)));
12092
12320
  rb_define_const(mGosu, "GP_3_BUTTON_0", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_0)));
12093
12321
  rb_define_const(mGosu, "GP_3_BUTTON_1", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_1)));
12094
12322
  rb_define_const(mGosu, "GP_3_BUTTON_2", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_2)));
@@ -12105,6 +12333,56 @@ SWIGEXPORT void Init_gosu(void) {
12105
12333
  rb_define_const(mGosu, "GP_3_BUTTON_13", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_13)));
12106
12334
  rb_define_const(mGosu, "GP_3_BUTTON_14", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_14)));
12107
12335
  rb_define_const(mGosu, "GP_3_BUTTON_15", SWIG_From_int(static_cast< int >(Gosu::GP_3_BUTTON_15)));
12336
+ rb_define_const(mGosu, "GP_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_LEFT)));
12337
+ rb_define_const(mGosu, "GP_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_RIGHT)));
12338
+ rb_define_const(mGosu, "GP_UP", SWIG_From_int(static_cast< int >(Gosu::GP_UP)));
12339
+ rb_define_const(mGosu, "GP_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_DOWN)));
12340
+ rb_define_const(mGosu, "GP_0_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_0_LEFT)));
12341
+ rb_define_const(mGosu, "GP_0_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_0_RIGHT)));
12342
+ rb_define_const(mGosu, "GP_0_UP", SWIG_From_int(static_cast< int >(Gosu::GP_0_UP)));
12343
+ rb_define_const(mGosu, "GP_0_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_0_DOWN)));
12344
+ rb_define_const(mGosu, "GP_1_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_1_LEFT)));
12345
+ rb_define_const(mGosu, "GP_1_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_1_RIGHT)));
12346
+ rb_define_const(mGosu, "GP_1_UP", SWIG_From_int(static_cast< int >(Gosu::GP_1_UP)));
12347
+ rb_define_const(mGosu, "GP_1_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_1_DOWN)));
12348
+ rb_define_const(mGosu, "GP_2_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_2_LEFT)));
12349
+ rb_define_const(mGosu, "GP_2_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_2_RIGHT)));
12350
+ rb_define_const(mGosu, "GP_2_UP", SWIG_From_int(static_cast< int >(Gosu::GP_2_UP)));
12351
+ rb_define_const(mGosu, "GP_2_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_2_DOWN)));
12352
+ rb_define_const(mGosu, "GP_3_LEFT", SWIG_From_int(static_cast< int >(Gosu::GP_3_LEFT)));
12353
+ rb_define_const(mGosu, "GP_3_RIGHT", SWIG_From_int(static_cast< int >(Gosu::GP_3_RIGHT)));
12354
+ rb_define_const(mGosu, "GP_3_UP", SWIG_From_int(static_cast< int >(Gosu::GP_3_UP)));
12355
+ rb_define_const(mGosu, "GP_3_DOWN", SWIG_From_int(static_cast< int >(Gosu::GP_3_DOWN)));
12356
+ rb_define_const(mGosu, "GP_LEFT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_LEFT_STICK_X_AXIS)));
12357
+ rb_define_const(mGosu, "GP_LEFT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_LEFT_STICK_Y_AXIS)));
12358
+ rb_define_const(mGosu, "GP_RIGHT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_RIGHT_STICK_X_AXIS)));
12359
+ rb_define_const(mGosu, "GP_RIGHT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_RIGHT_STICK_Y_AXIS)));
12360
+ rb_define_const(mGosu, "GP_LEFT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_LEFT_TRIGGER_AXIS)));
12361
+ rb_define_const(mGosu, "GP_RIGHT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_RIGHT_TRIGGER_AXIS)));
12362
+ rb_define_const(mGosu, "GP_0_LEFT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_LEFT_STICK_X_AXIS)));
12363
+ rb_define_const(mGosu, "GP_0_LEFT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_LEFT_STICK_Y_AXIS)));
12364
+ rb_define_const(mGosu, "GP_0_RIGHT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_RIGHT_STICK_X_AXIS)));
12365
+ rb_define_const(mGosu, "GP_0_RIGHT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_RIGHT_STICK_Y_AXIS)));
12366
+ rb_define_const(mGosu, "GP_0_LEFT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_LEFT_TRIGGER_AXIS)));
12367
+ rb_define_const(mGosu, "GP_0_RIGHT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_0_RIGHT_TRIGGER_AXIS)));
12368
+ rb_define_const(mGosu, "GP_1_LEFT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_LEFT_STICK_X_AXIS)));
12369
+ rb_define_const(mGosu, "GP_1_LEFT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_LEFT_STICK_Y_AXIS)));
12370
+ rb_define_const(mGosu, "GP_1_RIGHT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_RIGHT_STICK_X_AXIS)));
12371
+ rb_define_const(mGosu, "GP_1_RIGHT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_RIGHT_STICK_Y_AXIS)));
12372
+ rb_define_const(mGosu, "GP_1_LEFT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_LEFT_TRIGGER_AXIS)));
12373
+ rb_define_const(mGosu, "GP_1_RIGHT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_1_RIGHT_TRIGGER_AXIS)));
12374
+ rb_define_const(mGosu, "GP_2_LEFT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_LEFT_STICK_X_AXIS)));
12375
+ rb_define_const(mGosu, "GP_2_LEFT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_LEFT_STICK_Y_AXIS)));
12376
+ rb_define_const(mGosu, "GP_2_RIGHT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_RIGHT_STICK_X_AXIS)));
12377
+ rb_define_const(mGosu, "GP_2_RIGHT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_RIGHT_STICK_Y_AXIS)));
12378
+ rb_define_const(mGosu, "GP_2_LEFT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_LEFT_TRIGGER_AXIS)));
12379
+ rb_define_const(mGosu, "GP_2_RIGHT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_2_RIGHT_TRIGGER_AXIS)));
12380
+ rb_define_const(mGosu, "GP_3_LEFT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_LEFT_STICK_X_AXIS)));
12381
+ rb_define_const(mGosu, "GP_3_LEFT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_LEFT_STICK_Y_AXIS)));
12382
+ rb_define_const(mGosu, "GP_3_RIGHT_STICK_X_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_RIGHT_STICK_X_AXIS)));
12383
+ rb_define_const(mGosu, "GP_3_RIGHT_STICK_Y_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_RIGHT_STICK_Y_AXIS)));
12384
+ rb_define_const(mGosu, "GP_3_LEFT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_LEFT_TRIGGER_AXIS)));
12385
+ rb_define_const(mGosu, "GP_3_RIGHT_TRIGGER_AXIS", SWIG_From_int(static_cast< int >(Gosu::GP_3_RIGHT_TRIGGER_AXIS)));
12108
12386
 
12109
12387
  // Call srand() so that Gosu::random() is actually random in Ruby scripts
12110
12388
  std::srand(static_cast<unsigned>(std::time(0)));
@@ -12154,6 +12432,8 @@ SWIGEXPORT void Init_gosu(void) {
12154
12432
  rb_define_method(SwigClassWindow.klass, "release_memory", VALUEFUNC(_wrap_Window_release_memory), -1);
12155
12433
  rb_define_method(SwigClassWindow.klass, "button_down", VALUEFUNC(_wrap_Window_button_down), -1);
12156
12434
  rb_define_method(SwigClassWindow.klass, "button_up", VALUEFUNC(_wrap_Window_button_up), -1);
12435
+ rb_define_method(SwigClassWindow.klass, "gamepad_connected", VALUEFUNC(_wrap_Window_gamepad_connected), -1);
12436
+ rb_define_method(SwigClassWindow.klass, "gamepad_disconnected", VALUEFUNC(_wrap_Window_gamepad_disconnected), -1);
12157
12437
  rb_define_method(SwigClassWindow.klass, "drop", VALUEFUNC(_wrap_Window_drop), -1);
12158
12438
  rb_define_method(SwigClassWindow.klass, "width=", VALUEFUNC(_wrap_Window_widthe___), -1);
12159
12439
  rb_define_method(SwigClassWindow.klass, "height=", VALUEFUNC(_wrap_Window_heighte___), -1);
@@ -12176,6 +12456,9 @@ SWIGEXPORT void Init_gosu(void) {
12176
12456
  rb_define_module_function(mGosu, "char_to_button_id", VALUEFUNC(_wrap_char_to_button_id), -1);
12177
12457
  rb_define_module_function(mGosu, "button_id_to_char", VALUEFUNC(_wrap_button_id_to_char), -1);
12178
12458
  rb_define_module_function(mGosu, "button_down?", VALUEFUNC(_wrap_button_downq___), -1);
12459
+ rb_define_module_function(mGosu, "button_name", VALUEFUNC(_wrap_button_name), -1);
12460
+ rb_define_module_function(mGosu, "gamepad_name", VALUEFUNC(_wrap_gamepad_name), -1);
12461
+ rb_define_module_function(mGosu, "axis", VALUEFUNC(_wrap_axis), -1);
12179
12462
  rb_define_module_function(mGosu, "draw_line", VALUEFUNC(_wrap_draw_line), -1);
12180
12463
  rb_define_module_function(mGosu, "draw_triangle", VALUEFUNC(_wrap_draw_triangle), -1);
12181
12464
  rb_define_module_function(mGosu, "draw_quad", VALUEFUNC(_wrap_draw_quad), -1);