ruby2d 0.10.0 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (387) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/SDL2/SDL.h +108 -14
  3. data/assets/include/SDL2/SDL_assert.h +81 -50
  4. data/assets/include/SDL2/SDL_atomic.h +135 -35
  5. data/assets/include/SDL2/SDL_audio.h +960 -355
  6. data/assets/include/SDL2/SDL_bits.h +11 -6
  7. data/assets/include/SDL2/SDL_blendmode.h +91 -14
  8. data/assets/include/SDL2/SDL_clipboard.h +30 -7
  9. data/assets/include/SDL2/SDL_config.h +3 -1
  10. data/assets/include/SDL2/SDL_config_android.h +11 -1
  11. data/assets/include/SDL2/SDL_config_emscripten.h +216 -0
  12. data/assets/include/SDL2/SDL_config_iphoneos.h +9 -1
  13. data/assets/include/SDL2/SDL_config_macosx.h +16 -2
  14. data/assets/include/SDL2/SDL_config_minimal.h +4 -1
  15. data/assets/include/SDL2/SDL_config_os2.h +37 -20
  16. data/assets/include/SDL2/SDL_config_pandora.h +6 -1
  17. data/assets/include/SDL2/SDL_config_psp.h +8 -8
  18. data/assets/include/SDL2/SDL_config_windows.h +39 -22
  19. data/assets/include/SDL2/SDL_config_winrt.h +23 -8
  20. data/assets/include/SDL2/SDL_config_wiz.h +6 -1
  21. data/assets/include/SDL2/SDL_copying.h +1 -1
  22. data/assets/include/SDL2/SDL_cpuinfo.h +331 -71
  23. data/assets/include/SDL2/SDL_egl.h +906 -280
  24. data/assets/include/SDL2/SDL_endian.h +101 -47
  25. data/assets/include/SDL2/SDL_error.h +70 -19
  26. data/assets/include/SDL2/SDL_events.h +387 -79
  27. data/assets/include/SDL2/SDL_filesystem.h +73 -64
  28. data/assets/include/SDL2/SDL_gamecontroller.h +585 -125
  29. data/assets/include/SDL2/SDL_gesture.h +36 -6
  30. data/assets/include/SDL2/SDL_haptic.h +304 -210
  31. data/assets/include/SDL2/SDL_hidapi.h +451 -0
  32. data/assets/include/SDL2/SDL_hints.h +1286 -897
  33. data/assets/include/SDL2/SDL_joystick.h +577 -130
  34. data/assets/include/SDL2/SDL_keyboard.h +162 -63
  35. data/assets/include/SDL2/SDL_keycode.h +7 -5
  36. data/assets/include/SDL2/SDL_loadso.h +42 -8
  37. data/assets/include/SDL2/SDL_locale.h +34 -32
  38. data/assets/include/SDL2/SDL_log.h +212 -19
  39. data/assets/include/SDL2/SDL_main.h +72 -17
  40. data/assets/include/SDL2/SDL_messagebox.h +70 -23
  41. data/assets/include/SDL2/SDL_metal.h +27 -32
  42. data/assets/include/SDL2/SDL_misc.h +19 -15
  43. data/assets/include/SDL2/SDL_mouse.h +262 -110
  44. data/assets/include/SDL2/SDL_mutex.h +286 -66
  45. data/assets/include/SDL2/SDL_name.h +1 -1
  46. data/assets/include/SDL2/SDL_opengl.h +1 -1
  47. data/assets/include/SDL2/SDL_opengles.h +1 -1
  48. data/assets/include/SDL2/SDL_opengles2.h +2 -2
  49. data/assets/include/SDL2/SDL_pixels.h +199 -34
  50. data/assets/include/SDL2/SDL_platform.h +39 -2
  51. data/assets/include/SDL2/SDL_power.h +23 -10
  52. data/assets/include/SDL2/SDL_quit.h +1 -1
  53. data/assets/include/SDL2/SDL_rect.h +78 -28
  54. data/assets/include/SDL2/SDL_render.h +1204 -472
  55. data/assets/include/SDL2/SDL_revision.h +2 -2
  56. data/assets/include/SDL2/SDL_rwops.h +605 -33
  57. data/assets/include/SDL2/SDL_scancode.h +1 -1
  58. data/assets/include/SDL2/SDL_sensor.h +76 -42
  59. data/assets/include/SDL2/SDL_shape.h +38 -27
  60. data/assets/include/SDL2/SDL_stdinc.h +96 -24
  61. data/assets/include/SDL2/SDL_surface.h +571 -139
  62. data/assets/include/SDL2/SDL_system.h +339 -101
  63. data/assets/include/SDL2/SDL_syswm.h +50 -20
  64. data/assets/include/SDL2/SDL_test.h +1 -1
  65. data/assets/include/SDL2/SDL_test_assert.h +2 -2
  66. data/assets/include/SDL2/SDL_test_common.h +23 -6
  67. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  68. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  69. data/assets/include/SDL2/SDL_test_font.h +3 -3
  70. data/assets/include/SDL2/SDL_test_fuzzer.h +28 -26
  71. data/assets/include/SDL2/SDL_test_harness.h +6 -6
  72. data/assets/include/SDL2/SDL_test_images.h +1 -1
  73. data/assets/include/SDL2/SDL_test_log.h +1 -1
  74. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  75. data/assets/include/SDL2/SDL_test_memory.h +1 -1
  76. data/assets/include/SDL2/SDL_test_random.h +2 -2
  77. data/assets/include/SDL2/SDL_thread.h +226 -128
  78. data/assets/include/SDL2/SDL_timer.h +129 -22
  79. data/assets/include/SDL2/SDL_touch.h +48 -8
  80. data/assets/include/SDL2/SDL_ttf.h +102 -9
  81. data/assets/include/SDL2/SDL_types.h +1 -1
  82. data/assets/include/SDL2/SDL_version.h +72 -46
  83. data/assets/include/SDL2/SDL_video.h +1266 -460
  84. data/assets/include/SDL2/SDL_vulkan.h +100 -161
  85. data/assets/include/SDL2/begin_code.h +22 -1
  86. data/assets/include/SDL2/close_code.h +1 -1
  87. data/assets/include/mrbconf.h +234 -0
  88. data/assets/include/mruby/array.h +317 -0
  89. data/assets/include/mruby/boxing_nan.h +130 -0
  90. data/assets/include/mruby/boxing_no.h +58 -0
  91. data/assets/include/mruby/boxing_word.h +205 -0
  92. data/assets/include/mruby/class.h +108 -0
  93. data/assets/include/mruby/common.h +92 -0
  94. data/assets/include/mruby/compile.h +210 -0
  95. data/assets/include/mruby/data.h +76 -0
  96. data/assets/include/mruby/debug.h +66 -0
  97. data/assets/include/mruby/dump.h +158 -0
  98. data/assets/include/mruby/endian.h +44 -0
  99. data/assets/include/mruby/error.h +137 -0
  100. data/assets/include/mruby/gc.h +92 -0
  101. data/assets/include/mruby/hash.h +242 -0
  102. data/assets/include/mruby/irep.h +147 -0
  103. data/assets/include/mruby/istruct.h +50 -0
  104. data/assets/include/mruby/khash.h +284 -0
  105. data/assets/include/mruby/numeric.h +169 -0
  106. data/assets/include/mruby/object.h +43 -0
  107. data/assets/include/mruby/opcode.h +43 -0
  108. data/assets/include/mruby/ops.h +122 -0
  109. data/assets/include/mruby/presym/disable.h +70 -0
  110. data/assets/include/mruby/presym/enable.h +37 -0
  111. data/assets/include/mruby/presym/scanning.h +73 -0
  112. data/assets/include/mruby/presym.h +40 -0
  113. data/assets/include/mruby/proc.h +209 -0
  114. data/assets/include/mruby/range.h +79 -0
  115. data/assets/include/mruby/re.h +16 -0
  116. data/assets/include/mruby/string.h +469 -0
  117. data/assets/include/mruby/throw.h +66 -0
  118. data/assets/include/mruby/value.h +400 -0
  119. data/assets/include/mruby/variable.h +140 -0
  120. data/assets/include/mruby/version.h +143 -0
  121. data/assets/include/mruby.h +1444 -0
  122. data/assets/macos/universal/bin/mrbc +0 -0
  123. data/assets/macos/universal/lib/libFLAC.a +0 -0
  124. data/assets/macos/universal/lib/libSDL2.a +0 -0
  125. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  126. data/assets/macos/{lib → universal/lib}/libSDL2_mixer.a +0 -0
  127. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  128. data/assets/macos/universal/lib/libfreetype.a +0 -0
  129. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  130. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  131. data/assets/macos/universal/lib/libjpeg.a +0 -0
  132. data/assets/macos/universal/lib/libmodplug.a +0 -0
  133. data/assets/macos/{lib → universal/lib}/libmpg123.a +0 -0
  134. data/assets/{mingw/lib/libSDL2.a → macos/universal/lib/libmruby.a} +0 -0
  135. data/assets/macos/{lib → universal/lib}/libogg.a +0 -0
  136. data/assets/macos/universal/lib/libpng16.a +0 -0
  137. data/assets/macos/universal/lib/libtiff.a +0 -0
  138. data/assets/macos/universal/lib/libvorbis.a +0 -0
  139. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  140. data/assets/macos/universal/lib/libwebp.a +0 -0
  141. data/assets/test_media/README.md +3 -0
  142. data/assets/test_media/bitstream_vera/COPYRIGHT.txt +124 -0
  143. data/assets/test_media/bitstream_vera/vera.ttf +0 -0
  144. data/assets/test_media/boom.png +0 -0
  145. data/assets/test_media/coin.png +0 -0
  146. data/assets/test_media/colors.png +0 -0
  147. data/assets/test_media/controller.png +0 -0
  148. data/assets/test_media/dial.wav +0 -0
  149. data/assets/test_media/hero.png +0 -0
  150. data/assets/test_media/image.bmp +0 -0
  151. data/assets/test_media/image.jpg +0 -0
  152. data/assets/test_media/image.png +0 -0
  153. data/assets/test_media/music.flac +0 -0
  154. data/assets/test_media/music.mp3 +0 -0
  155. data/assets/test_media/music.ogg +0 -0
  156. data/assets/test_media/music.wav +0 -0
  157. data/assets/test_media/originals/boom.pxm +0 -0
  158. data/assets/test_media/originals/coin.pxm +0 -0
  159. data/assets/test_media/originals/controller.sketch +0 -0
  160. data/assets/test_media/originals/hero.pxm +0 -0
  161. data/assets/test_media/originals/image.pxm +0 -0
  162. data/assets/test_media/originals/music.caf +0 -0
  163. data/assets/test_media/originals/texture_atlas.pxm +0 -0
  164. data/assets/test_media/rondo_alla_turka.ogg +0 -0
  165. data/assets/test_media/sound.flac +0 -0
  166. data/assets/test_media/sound.mp3 +0 -0
  167. data/assets/test_media/sound.ogg +0 -0
  168. data/assets/test_media/sound.wav +0 -0
  169. data/assets/test_media/sprite_sheet.png +0 -0
  170. data/assets/test_media/texture_atlas.png +0 -0
  171. data/assets/wasm/build_config.rb +13 -0
  172. data/assets/wasm/libmruby.a +0 -0
  173. data/assets/wasm/template.html +17 -0
  174. data/assets/windows/glew/README.md +10 -0
  175. data/assets/windows/glew/glew.h +23686 -0
  176. data/assets/{mingw/lib → windows/glew}/libglew32.a +0 -0
  177. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  178. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  179. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  180. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  181. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  182. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  183. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  184. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  185. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  186. data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
  187. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  188. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  189. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  190. data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
  191. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  192. data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
  193. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  194. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  195. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  196. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  197. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  198. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  199. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  200. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  201. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  202. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  203. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  204. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  205. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  206. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  207. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  208. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  209. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  210. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  211. data/assets/{ios → xcode/ios}/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  212. data/assets/{ios → xcode/ios}/Assets.xcassets/Contents.json +0 -0
  213. data/assets/{ios → xcode/ios}/Base.lproj/LaunchScreen.storyboard +0 -0
  214. data/assets/{ios → xcode/ios}/Info.plist +0 -0
  215. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mrbconf.h +0 -0
  216. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/array.h +0 -0
  217. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  218. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  219. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  220. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/class.h +0 -0
  221. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/common.h +0 -0
  222. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/compile.h +0 -0
  223. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/data.h +0 -0
  224. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/debug.h +0 -0
  225. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/dump.h +0 -0
  226. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/error.h +0 -0
  227. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/gc.h +0 -0
  228. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/hash.h +0 -0
  229. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/irep.h +0 -0
  230. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  231. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/khash.h +0 -0
  232. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  233. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/object.h +0 -0
  234. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  235. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/ops.h +0 -0
  236. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/proc.h +0 -0
  237. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/range.h +0 -0
  238. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/re.h +0 -0
  239. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/string.h +0 -0
  240. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/throw.h +0 -0
  241. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/value.h +0 -0
  242. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/variable.h +0 -0
  243. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/version.h +0 -0
  244. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby.h +0 -0
  245. data/assets/{ios → xcode/ios}/MRuby.framework/Info.plist +0 -0
  246. data/assets/{ios → xcode/ios}/MRuby.framework/MRuby +0 -0
  247. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.pbxproj +0 -0
  248. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  249. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  250. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  251. data/assets/{ios → xcode/ios}/main.c +0 -0
  252. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  253. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -0
  254. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -0
  255. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  256. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -0
  257. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  258. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  259. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  260. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -0
  261. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -0
  262. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  263. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -0
  264. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  265. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  266. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -0
  267. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -0
  268. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -0
  269. data/assets/{tvos → xcode/tvos}/Assets.xcassets/Contents.json +0 -0
  270. data/assets/{tvos → xcode/tvos}/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -0
  271. data/assets/{tvos → xcode/tvos}/Info.plist +0 -0
  272. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mrbconf.h +0 -0
  273. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/array.h +0 -0
  274. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  275. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  276. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  277. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/class.h +0 -0
  278. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/common.h +0 -0
  279. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/compile.h +0 -0
  280. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/data.h +0 -0
  281. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/debug.h +0 -0
  282. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/dump.h +0 -0
  283. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/error.h +0 -0
  284. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/gc.h +0 -0
  285. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/hash.h +0 -0
  286. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/irep.h +0 -0
  287. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  288. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/khash.h +0 -0
  289. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  290. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/object.h +0 -0
  291. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  292. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/ops.h +0 -0
  293. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/proc.h +0 -0
  294. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/range.h +0 -0
  295. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/re.h +0 -0
  296. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/string.h +0 -0
  297. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/throw.h +0 -0
  298. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/value.h +0 -0
  299. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/variable.h +0 -0
  300. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/version.h +0 -0
  301. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby.h +0 -0
  302. data/assets/{tvos → xcode/tvos}/MRuby.framework/Info.plist +0 -0
  303. data/assets/{tvos → xcode/tvos}/MRuby.framework/MRuby +0 -0
  304. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.pbxproj +0 -0
  305. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  306. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  307. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  308. data/assets/{tvos → xcode/tvos}/main.c +0 -0
  309. data/bin/ruby2d +3 -4
  310. data/ext/ruby2d/extconf.rb +68 -46
  311. data/ext/ruby2d/font.c +35 -0
  312. data/ext/ruby2d/gl.c +9 -58
  313. data/ext/ruby2d/gl2.c +8 -83
  314. data/ext/ruby2d/gl3.c +57 -116
  315. data/ext/ruby2d/gles.c +130 -151
  316. data/ext/ruby2d/image.c +16 -96
  317. data/ext/ruby2d/ruby2d.c +265 -298
  318. data/ext/ruby2d/ruby2d.h +69 -159
  319. data/ext/ruby2d/sound.c +1 -1
  320. data/ext/ruby2d/text.c +20 -114
  321. data/ext/ruby2d/window.c +257 -219
  322. data/lib/ruby2d/circle.rb +3 -1
  323. data/lib/ruby2d/cli/build.rb +239 -59
  324. data/lib/ruby2d/cli/colorize.rb +5 -4
  325. data/lib/ruby2d/cli/platform.rb +17 -0
  326. data/lib/ruby2d/font.rb +26 -1
  327. data/lib/ruby2d/image.rb +22 -17
  328. data/lib/ruby2d/line.rb +3 -1
  329. data/lib/ruby2d/quad.rb +3 -1
  330. data/lib/ruby2d/rectangle.rb +1 -1
  331. data/lib/ruby2d/renderable.rb +0 -12
  332. data/lib/ruby2d/sound.rb +25 -0
  333. data/lib/ruby2d/sprite.rb +44 -89
  334. data/lib/ruby2d/square.rb +1 -1
  335. data/lib/ruby2d/text.rb +40 -20
  336. data/lib/ruby2d/texture.rb +28 -0
  337. data/lib/ruby2d/tileset.rb +47 -28
  338. data/lib/ruby2d/triangle.rb +3 -1
  339. data/lib/ruby2d/version.rb +1 -1
  340. data/lib/ruby2d/vertices.rb +89 -0
  341. data/lib/ruby2d/window.rb +13 -3
  342. data/lib/ruby2d.rb +16 -20
  343. metadata +249 -153
  344. data/assets/README.md +0 -22
  345. data/assets/Rakefile +0 -85
  346. data/assets/macos/lib/libFLAC.a +0 -0
  347. data/assets/macos/lib/libSDL2.a +0 -0
  348. data/assets/macos/lib/libSDL2_image.a +0 -0
  349. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  350. data/assets/macos/lib/libfreetype.a +0 -0
  351. data/assets/macos/lib/libjpeg.a +0 -0
  352. data/assets/macos/lib/libpng16.a +0 -0
  353. data/assets/macos/lib/libtiff.a +0 -0
  354. data/assets/macos/lib/libvorbis.a +0 -0
  355. data/assets/macos/lib/libvorbisfile.a +0 -0
  356. data/assets/macos/lib/libwebp.a +0 -0
  357. data/assets/mingw/bin/SDL2.dll +0 -0
  358. data/assets/mingw/bin/SDL2_image.dll +0 -0
  359. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  360. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  361. data/assets/mingw/bin/glew32.dll +0 -0
  362. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  363. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  364. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  365. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  366. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  367. data/assets/mingw/bin/libogg-0.dll +0 -0
  368. data/assets/mingw/bin/libopus-0.dll +0 -0
  369. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  370. data/assets/mingw/bin/libpng16-16.dll +0 -0
  371. data/assets/mingw/bin/libtiff-5.dll +0 -0
  372. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  373. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  374. data/assets/mingw/bin/libwebp-7.dll +0 -0
  375. data/assets/mingw/bin/zlib1.dll +0 -0
  376. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  377. data/assets/mingw/lib/libSDL2_image.a +0 -0
  378. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  379. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  380. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  381. data/assets/mingw/lib/libSDL2_test.a +0 -0
  382. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  383. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  384. data/assets/mingw/lib/libSDL2main.a +0 -0
  385. data/assets/mingw/lib/libglew32.dll.a +0 -0
  386. data/ext/ruby2d/sprite.c +0 -147
  387. data/ext/ruby2d/tileset.c +0 -30
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -50,7 +50,7 @@ extern "C" {
50
50
  #define SDL_PRESSED 1
51
51
 
52
52
  /**
53
- * \brief The types of events that can be delivered.
53
+ * The types of events that can be delivered.
54
54
  */
55
55
  typedef enum
56
56
  {
@@ -160,6 +160,9 @@ typedef enum
160
160
  SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
161
161
  SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
162
162
 
163
+ /* Internal events */
164
+ SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
165
+
163
166
  /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
164
167
  * and should be allocated with SDL_RegisterEvents()
165
168
  */
@@ -298,6 +301,8 @@ typedef struct SDL_MouseWheelEvent
298
301
  Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
299
302
  Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
300
303
  Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
304
+ float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */
305
+ float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */
301
306
  } SDL_MouseWheelEvent;
302
307
 
303
308
  /**
@@ -620,28 +625,49 @@ typedef union SDL_Event
620
625
  SDL_DollarGestureEvent dgesture; /**< Gesture event data */
621
626
  SDL_DropEvent drop; /**< Drag and drop event data */
622
627
 
623
- /* This is necessary for ABI compatibility between Visual C++ and GCC
624
- Visual C++ will respect the push pack pragma and use 52 bytes for
625
- this structure, and GCC will use the alignment of the largest datatype
626
- within the union, which is 8 bytes.
628
+ /* This is necessary for ABI compatibility between Visual C++ and GCC.
629
+ Visual C++ will respect the push pack pragma and use 52 bytes (size of
630
+ SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit
631
+ architectures) for this union, and GCC will use the alignment of the
632
+ largest datatype within the union, which is 8 bytes on 64-bit
633
+ architectures.
627
634
 
628
635
  So... we'll add padding to force the size to be 56 bytes for both.
636
+
637
+ On architectures where pointers are 16 bytes, this needs rounding up to
638
+ the next multiple of 16, 64, and on architectures where pointers are
639
+ even larger the size of SDL_UserEvent will dominate as being 3 pointers.
629
640
  */
630
- Uint8 padding[56];
641
+ Uint8 padding[sizeof(void *) <= 8 ? 56 : sizeof(void *) == 16 ? 64 : 3 * sizeof(void *)];
631
642
  } SDL_Event;
632
643
 
633
644
  /* Make sure we haven't broken binary compatibility */
634
- SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56);
645
+ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding));
635
646
 
636
647
 
637
648
  /* Function prototypes */
638
649
 
639
650
  /**
640
- * Pumps the event loop, gathering events from the input devices.
651
+ * Pump the event loop, gathering events from the input devices.
652
+ *
653
+ * This function updates the event queue and internal input device state.
641
654
  *
642
- * This function updates the event queue and internal input device state.
655
+ * **WARNING**: This should only be run in the thread that initialized the
656
+ * video subsystem, and for extra safety, you should consider only doing those
657
+ * things on the main thread in any case.
643
658
  *
644
- * This should only be run in the thread that sets the video mode.
659
+ * SDL_PumpEvents() gathers all the pending input information from devices and
660
+ * places it in the event queue. Without calls to SDL_PumpEvents() no events
661
+ * would ever be placed on the queue. Often the need for calls to
662
+ * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
663
+ * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
664
+ * polling or waiting for events (e.g. you are filtering them), then you must
665
+ * call SDL_PumpEvents() to force an event queue update.
666
+ *
667
+ * \since This function is available since SDL 2.0.0.
668
+ *
669
+ * \sa SDL_PollEvent
670
+ * \sa SDL_WaitEvent
645
671
  */
646
672
  extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
647
673
 
@@ -654,22 +680,42 @@ typedef enum
654
680
  } SDL_eventaction;
655
681
 
656
682
  /**
657
- * Checks the event queue for messages and optionally returns them.
683
+ * Check the event queue for messages and optionally return them.
684
+ *
685
+ * `action` may be any of the following:
658
686
  *
659
- * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
660
- * the back of the event queue.
687
+ * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the
688
+ * event queue.
689
+ * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue,
690
+ * within the specified minimum and maximum type, will be returned to the
691
+ * caller and will _not_ be removed from the queue.
692
+ * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue,
693
+ * within the specified minimum and maximum type, will be returned to the
694
+ * caller and will be removed from the queue.
661
695
  *
662
- * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
663
- * of the event queue, within the specified minimum and maximum type,
664
- * will be returned and will not be removed from the queue.
696
+ * You may have to call SDL_PumpEvents() before calling this function.
697
+ * Otherwise, the events may not be ready to be filtered when you call
698
+ * SDL_PeepEvents().
665
699
  *
666
- * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
667
- * of the event queue, within the specified minimum and maximum type,
668
- * will be returned and will be removed from the queue.
700
+ * This function is thread-safe.
669
701
  *
670
- * \return The number of events actually stored, or -1 if there was an error.
702
+ * \param events destination buffer for the retrieved events
703
+ * \param numevents if action is SDL_ADDEVENT, the number of events to add
704
+ * back to the event queue; if action is SDL_PEEKEVENT or
705
+ * SDL_GETEVENT, the maximum number of events to retrieve
706
+ * \param action action to take; see [[#action|Remarks]] for details
707
+ * \param minType minimum value of the event type to be considered;
708
+ * SDL_FIRSTEVENT is a safe choice
709
+ * \param maxType maximum value of the event type to be considered;
710
+ * SDL_LASTEVENT is a safe choice
711
+ * \returns the number of events actually stored or a negative error code on
712
+ * failure; call SDL_GetError() for more information.
671
713
  *
672
- * This function is thread-safe.
714
+ * \since This function is available since SDL 2.0.0.
715
+ *
716
+ * \sa SDL_PollEvent
717
+ * \sa SDL_PumpEvents
718
+ * \sa SDL_PushEvent
673
719
  */
674
720
  extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
675
721
  SDL_eventaction action,
@@ -677,113 +723,354 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
677
723
  /* @} */
678
724
 
679
725
  /**
680
- * Checks to see if certain event types are in the event queue.
726
+ * Check for the existence of a certain event type in the event queue.
727
+ *
728
+ * If you need to check for a range of event types, use SDL_HasEvents()
729
+ * instead.
730
+ *
731
+ * \param type the type of event to be queried; see SDL_EventType for details
732
+ * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
733
+ * events matching `type` are not present.
734
+ *
735
+ * \since This function is available since SDL 2.0.0.
736
+ *
737
+ * \sa SDL_HasEvents
681
738
  */
682
739
  extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
740
+
741
+
742
+ /**
743
+ * Check for the existence of certain event types in the event queue.
744
+ *
745
+ * If you need to check for a single event type, use SDL_HasEvent() instead.
746
+ *
747
+ * \param minType the low end of event type to be queried, inclusive; see
748
+ * SDL_EventType for details
749
+ * \param maxType the high end of event type to be queried, inclusive; see
750
+ * SDL_EventType for details
751
+ * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
752
+ * present, or SDL_FALSE if not.
753
+ *
754
+ * \since This function is available since SDL 2.0.0.
755
+ *
756
+ * \sa SDL_HasEvents
757
+ */
683
758
  extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
684
759
 
685
760
  /**
686
- * This function clears events from the event queue
687
- * This function only affects currently queued events. If you want to make
688
- * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
689
- * on the main thread immediately before the flush call.
761
+ * Clear events of a specific type from the event queue.
762
+ *
763
+ * This will unconditionally remove any events from the queue that match
764
+ * `type`. If you need to remove a range of event types, use SDL_FlushEvents()
765
+ * instead.
766
+ *
767
+ * It's also normal to just ignore events you don't care about in your event
768
+ * loop without calling this function.
769
+ *
770
+ * This function only affects currently queued events. If you want to make
771
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
772
+ * on the main thread immediately before the flush call.
773
+ *
774
+ * \param type the type of event to be cleared; see SDL_EventType for details
775
+ *
776
+ * \since This function is available since SDL 2.0.0.
777
+ *
778
+ * \sa SDL_FlushEvents
690
779
  */
691
780
  extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
781
+
782
+ /**
783
+ * Clear events of a range of types from the event queue.
784
+ *
785
+ * This will unconditionally remove any events from the queue that are in the
786
+ * range of `minType` to `maxType`, inclusive. If you need to remove a single
787
+ * event type, use SDL_FlushEvent() instead.
788
+ *
789
+ * It's also normal to just ignore events you don't care about in your event
790
+ * loop without calling this function.
791
+ *
792
+ * This function only affects currently queued events. If you want to make
793
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
794
+ * on the main thread immediately before the flush call.
795
+ *
796
+ * \param minType the low end of event type to be cleared, inclusive; see
797
+ * SDL_EventType for details
798
+ * \param maxType the high end of event type to be cleared, inclusive; see
799
+ * SDL_EventType for details
800
+ *
801
+ * \since This function is available since SDL 2.0.0.
802
+ *
803
+ * \sa SDL_FlushEvent
804
+ */
692
805
  extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
693
806
 
694
807
  /**
695
- * \brief Polls for currently pending events.
808
+ * Poll for currently pending events.
809
+ *
810
+ * If `event` is not NULL, the next event is removed from the queue and stored
811
+ * in the SDL_Event structure pointed to by `event`. The 1 returned refers to
812
+ * this event, immediately stored in the SDL Event structure -- not an event
813
+ * to follow.
696
814
  *
697
- * \return 1 if there are any pending events, or 0 if there are none available.
815
+ * If `event` is NULL, it simply returns 1 if there is an event in the queue,
816
+ * but will not remove it from the queue.
698
817
  *
699
- * \param event If not NULL, the next event is removed from the queue and
700
- * stored in that area.
818
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
819
+ * this function in the thread that set the video mode.
820
+ *
821
+ * SDL_PollEvent() is the favored way of receiving system events since it can
822
+ * be done from the main loop and does not suspend the main loop while waiting
823
+ * on an event to be posted.
824
+ *
825
+ * The common practice is to fully process the event queue once every frame,
826
+ * usually as a first step before updating the game's state:
827
+ *
828
+ * ```c
829
+ * while (game_is_still_running) {
830
+ * SDL_Event event;
831
+ * while (SDL_PollEvent(&event)) { // poll until all events are handled!
832
+ * // decide what to do with this event.
833
+ * }
834
+ *
835
+ * // update game state, draw the current frame
836
+ * }
837
+ * ```
838
+ *
839
+ * \param event the SDL_Event structure to be filled with the next event from
840
+ * the queue, or NULL
841
+ * \returns 1 if there is a pending event or 0 if there are none available.
842
+ *
843
+ * \since This function is available since SDL 2.0.0.
844
+ *
845
+ * \sa SDL_GetEventFilter
846
+ * \sa SDL_PeepEvents
847
+ * \sa SDL_PushEvent
848
+ * \sa SDL_SetEventFilter
849
+ * \sa SDL_WaitEvent
850
+ * \sa SDL_WaitEventTimeout
701
851
  */
702
852
  extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
703
853
 
704
854
  /**
705
- * \brief Waits indefinitely for the next available event.
855
+ * Wait indefinitely for the next available event.
856
+ *
857
+ * If `event` is not NULL, the next event is removed from the queue and stored
858
+ * in the SDL_Event structure pointed to by `event`.
859
+ *
860
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
861
+ * this function in the thread that initialized the video subsystem.
706
862
  *
707
- * \return 1, or 0 if there was an error while waiting for events.
863
+ * \param event the SDL_Event structure to be filled in with the next event
864
+ * from the queue, or NULL
865
+ * \returns 1 on success or 0 if there was an error while waiting for events;
866
+ * call SDL_GetError() for more information.
708
867
  *
709
- * \param event If not NULL, the next event is removed from the queue and
710
- * stored in that area.
868
+ * \since This function is available since SDL 2.0.0.
869
+ *
870
+ * \sa SDL_PollEvent
871
+ * \sa SDL_PumpEvents
872
+ * \sa SDL_WaitEventTimeout
711
873
  */
712
874
  extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
713
875
 
714
876
  /**
715
- * \brief Waits until the specified timeout (in milliseconds) for the next
716
- * available event.
877
+ * Wait until the specified timeout (in milliseconds) for the next available
878
+ * event.
879
+ *
880
+ * If `event` is not NULL, the next event is removed from the queue and stored
881
+ * in the SDL_Event structure pointed to by `event`.
717
882
  *
718
- * \return 1, or 0 if there was an error while waiting for events.
883
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
884
+ * this function in the thread that initialized the video subsystem.
719
885
  *
720
- * \param event If not NULL, the next event is removed from the queue and
721
- * stored in that area.
722
- * \param timeout The timeout (in milliseconds) to wait for next event.
886
+ * \param event the SDL_Event structure to be filled in with the next event
887
+ * from the queue, or NULL
888
+ * \param timeout the maximum number of milliseconds to wait for the next
889
+ * available event
890
+ * \returns 1 on success or 0 if there was an error while waiting for events;
891
+ * call SDL_GetError() for more information. This also returns 0 if
892
+ * the timeout elapsed without an event arriving.
893
+ *
894
+ * \since This function is available since SDL 2.0.0.
895
+ *
896
+ * \sa SDL_PollEvent
897
+ * \sa SDL_PumpEvents
898
+ * \sa SDL_WaitEvent
723
899
  */
724
900
  extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
725
901
  int timeout);
726
902
 
727
903
  /**
728
- * \brief Add an event to the event queue.
904
+ * Add an event to the event queue.
905
+ *
906
+ * The event queue can actually be used as a two way communication channel.
907
+ * Not only can events be read from the queue, but the user can also push
908
+ * their own events onto it. `event` is a pointer to the event structure you
909
+ * wish to push onto the queue. The event is copied into the queue, and the
910
+ * caller may dispose of the memory pointed to after SDL_PushEvent() returns.
911
+ *
912
+ * Note: Pushing device input events onto the queue doesn't modify the state
913
+ * of the device within SDL.
914
+ *
915
+ * This function is thread-safe, and can be called from other threads safely.
916
+ *
917
+ * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
918
+ * the event filter but events added with SDL_PeepEvents() do not.
729
919
  *
730
- * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
731
- * was full or there was some other error.
920
+ * For pushing application-specific events, please use SDL_RegisterEvents() to
921
+ * get an event type that does not conflict with other code that also wants
922
+ * its own custom event types.
923
+ *
924
+ * \param event the SDL_Event to be added to the queue
925
+ * \returns 1 on success, 0 if the event was filtered, or a negative error
926
+ * code on failure; call SDL_GetError() for more information. A
927
+ * common reason for error is the event queue being full.
928
+ *
929
+ * \since This function is available since SDL 2.0.0.
930
+ *
931
+ * \sa SDL_PeepEvents
932
+ * \sa SDL_PollEvent
933
+ * \sa SDL_RegisterEvents
732
934
  */
733
935
  extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
734
936
 
937
+ /**
938
+ * A function pointer used for callbacks that watch the event queue.
939
+ *
940
+ * \param userdata what was passed as `userdata` to SDL_SetEventFilter()
941
+ * or SDL_AddEventWatch, etc
942
+ * \param event the event that triggered the callback
943
+ * \returns 1 to permit event to be added to the queue, and 0 to disallow
944
+ * it. When used with SDL_AddEventWatch, the return value is ignored.
945
+ *
946
+ * \sa SDL_SetEventFilter
947
+ * \sa SDL_AddEventWatch
948
+ */
735
949
  typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
736
950
 
737
951
  /**
738
- * Sets up a filter to process all events before they change internal state and
739
- * are posted to the internal event queue.
952
+ * Set up a filter to process all events before they change internal state and
953
+ * are posted to the internal event queue.
954
+ *
955
+ * If the filter function returns 1 when called, then the event will be added
956
+ * to the internal queue. If it returns 0, then the event will be dropped from
957
+ * the queue, but the internal state will still be updated. This allows
958
+ * selective filtering of dynamically arriving events.
959
+ *
960
+ * **WARNING**: Be very careful of what you do in the event filter function,
961
+ * as it may run in a different thread!
962
+ *
963
+ * On platforms that support it, if the quit event is generated by an
964
+ * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
965
+ * application at the next event poll.
966
+ *
967
+ * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
968
+ * event filter is only called when the window manager desires to close the
969
+ * application window. If the event filter returns 1, then the window will be
970
+ * closed, otherwise the window will remain open if possible.
971
+ *
972
+ * Note: Disabled events never make it to the event filter function; see
973
+ * SDL_EventState().
740
974
  *
741
- * The filter is prototyped as:
742
- * \code
743
- * int SDL_EventFilter(void *userdata, SDL_Event * event);
744
- * \endcode
975
+ * Note: If you just want to inspect events without filtering, you should use
976
+ * SDL_AddEventWatch() instead.
745
977
  *
746
- * If the filter returns 1, then the event will be added to the internal queue.
747
- * If it returns 0, then the event will be dropped from the queue, but the
748
- * internal state will still be updated. This allows selective filtering of
749
- * dynamically arriving events.
978
+ * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
979
+ * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
980
+ * not.
750
981
  *
751
- * \warning Be very careful of what you do in the event filter function, as
752
- * it may run in a different thread!
982
+ * \param filter An SDL_EventFilter function to call when an event happens
983
+ * \param userdata a pointer that is passed to `filter`
753
984
  *
754
- * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
755
- * event filter is only called when the window manager desires to close the
756
- * application window. If the event filter returns 1, then the window will
757
- * be closed, otherwise the window will remain open if possible.
985
+ * \since This function is available since SDL 2.0.0.
758
986
  *
759
- * If the quit event is generated by an interrupt signal, it will bypass the
760
- * internal queue and be delivered to the application at the next event poll.
987
+ * \sa SDL_AddEventWatch
988
+ * \sa SDL_EventState
989
+ * \sa SDL_GetEventFilter
990
+ * \sa SDL_PeepEvents
991
+ * \sa SDL_PushEvent
761
992
  */
762
993
  extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
763
994
  void *userdata);
764
995
 
765
996
  /**
766
- * Return the current event filter - can be used to "chain" filters.
767
- * If there is no event filter set, this function returns SDL_FALSE.
997
+ * Query the current event filter.
998
+ *
999
+ * This function can be used to "chain" filters, by saving the existing filter
1000
+ * before replacing it with a function that will call that saved filter.
1001
+ *
1002
+ * \param filter the current callback function will be stored here
1003
+ * \param userdata the pointer that is passed to the current event filter will
1004
+ * be stored here
1005
+ * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
1006
+ *
1007
+ * \since This function is available since SDL 2.0.0.
1008
+ *
1009
+ * \sa SDL_SetEventFilter
768
1010
  */
769
1011
  extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
770
1012
  void **userdata);
771
1013
 
772
1014
  /**
773
- * Add a function which is called when an event is added to the queue.
1015
+ * Add a callback to be triggered when an event is added to the event queue.
1016
+ *
1017
+ * `filter` will be called when an event happens, and its return value is
1018
+ * ignored.
1019
+ *
1020
+ * **WARNING**: Be very careful of what you do in the event filter function,
1021
+ * as it may run in a different thread!
1022
+ *
1023
+ * If the quit event is generated by a signal (e.g. SIGINT), it will bypass
1024
+ * the internal queue and be delivered to the watch callback immediately, and
1025
+ * arrive at the next event poll.
1026
+ *
1027
+ * Note: the callback is called for events posted by the user through
1028
+ * SDL_PushEvent(), but not for disabled events, nor for events by a filter
1029
+ * callback set with SDL_SetEventFilter(), nor for events posted by the user
1030
+ * through SDL_PeepEvents().
1031
+ *
1032
+ * \param filter an SDL_EventFilter function to call when an event happens.
1033
+ * \param userdata a pointer that is passed to `filter`
1034
+ *
1035
+ * \since This function is available since SDL 2.0.0.
1036
+ *
1037
+ * \sa SDL_DelEventWatch
1038
+ * \sa SDL_SetEventFilter
774
1039
  */
775
1040
  extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
776
1041
  void *userdata);
777
1042
 
778
1043
  /**
779
- * Remove an event watch function added with SDL_AddEventWatch()
1044
+ * Remove an event watch callback added with SDL_AddEventWatch().
1045
+ *
1046
+ * This function takes the same input as SDL_AddEventWatch() to identify and
1047
+ * delete the corresponding callback.
1048
+ *
1049
+ * \param filter the function originally passed to SDL_AddEventWatch()
1050
+ * \param userdata the pointer originally passed to SDL_AddEventWatch()
1051
+ *
1052
+ * \since This function is available since SDL 2.0.0.
1053
+ *
1054
+ * \sa SDL_AddEventWatch
780
1055
  */
781
1056
  extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
782
1057
  void *userdata);
783
1058
 
784
1059
  /**
785
- * Run the filter function on the current event queue, removing any
786
- * events for which the filter returns 0.
1060
+ * Run a specific filter function on the current event queue, removing any
1061
+ * events for which the filter returns 0.
1062
+ *
1063
+ * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
1064
+ * this function does not change the filter permanently, it only uses the
1065
+ * supplied filter until this function returns.
1066
+ *
1067
+ * \param filter the SDL_EventFilter function to call when an event happens
1068
+ * \param userdata a pointer that is passed to `filter`
1069
+ *
1070
+ * \since This function is available since SDL 2.0.0.
1071
+ *
1072
+ * \sa SDL_GetEventFilter
1073
+ * \sa SDL_SetEventFilter
787
1074
  */
788
1075
  extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
789
1076
  void *userdata);
@@ -795,24 +1082,45 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
795
1082
  #define SDL_ENABLE 1
796
1083
 
797
1084
  /**
798
- * This function allows you to set the state of processing certain events.
799
- * - If \c state is set to ::SDL_IGNORE, that event will be automatically
800
- * dropped from the event queue and will not be filtered.
801
- * - If \c state is set to ::SDL_ENABLE, that event will be processed
802
- * normally.
803
- * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
804
- * current processing state of the specified event.
1085
+ * Set the state of processing events by type.
1086
+ *
1087
+ * `state` may be any of the following:
1088
+ *
1089
+ * - `SDL_QUERY`: returns the current processing state of the specified event
1090
+ * - `SDL_IGNORE` (aka `SDL_DISABLE`): the event will automatically be dropped
1091
+ * from the event queue and will not be filtered
1092
+ * - `SDL_ENABLE`: the event will be processed normally
1093
+ *
1094
+ * \param type the type of event; see SDL_EventType for details
1095
+ * \param state how to process the event
1096
+ * \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state
1097
+ * of the event before this function makes any changes to it.
1098
+ *
1099
+ * \since This function is available since SDL 2.0.0.
1100
+ *
1101
+ * \sa SDL_GetEventState
805
1102
  */
806
1103
  extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
807
1104
  /* @} */
808
1105
  #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
809
1106
 
810
1107
  /**
811
- * This function allocates a set of user-defined events, and returns
812
- * the beginning event number for that set of events.
1108
+ * Allocate a set of user-defined events, and return the beginning event
1109
+ * number for that set of events.
1110
+ *
1111
+ * Calling this function with `numevents` <= 0 is an error and will return
1112
+ * (Uint32)-1.
1113
+ *
1114
+ * Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or
1115
+ * 0xFFFFFFFF), but is clearer to write.
1116
+ *
1117
+ * \param numevents the number of events to be allocated
1118
+ * \returns the beginning event number, or (Uint32)-1 if there are not enough
1119
+ * user-defined events left.
1120
+ *
1121
+ * \since This function is available since SDL 2.0.0.
813
1122
  *
814
- * If there aren't enough user-defined events left, this function
815
- * returns (Uint32)-1
1123
+ * \sa SDL_PushEvent
816
1124
  */
817
1125
  extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
818
1126