ruby2d 0.12.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (619) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +7 -0
  3. data/README.md +141 -0
  4. data/USAGE.md +2435 -0
  5. data/assets/Rakefile +637 -0
  6. data/assets/build_support/CMakeLists.txt +94 -0
  7. data/assets/build_support/mruby/build_config.rb +34 -0
  8. data/assets/build_support/mruby/build_config_wasm.rb +30 -0
  9. data/assets/build_support/sdl_test.c +174 -0
  10. data/assets/deps.yaml +16 -0
  11. data/assets/platform/include/SDL3/SDL.h +91 -0
  12. data/assets/platform/include/SDL3/SDL_assert.h +705 -0
  13. data/assets/platform/include/SDL3/SDL_asyncio.h +550 -0
  14. data/assets/platform/include/SDL3/SDL_atomic.h +692 -0
  15. data/assets/platform/include/SDL3/SDL_audio.h +2370 -0
  16. data/assets/platform/include/SDL3/SDL_begin_code.h +553 -0
  17. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_bits.h +47 -27
  18. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_blendmode.h +59 -55
  19. data/assets/platform/include/SDL3/SDL_camera.h +535 -0
  20. data/assets/platform/include/SDL3/SDL_clipboard.h +331 -0
  21. data/assets/{include/SDL2/close_code.h → platform/include/SDL3/SDL_close_code.h} +9 -8
  22. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_copying.h +3 -1
  23. data/assets/platform/include/SDL3/SDL_cpuinfo.h +374 -0
  24. data/assets/platform/include/SDL3/SDL_dialog.h +343 -0
  25. data/assets/platform/include/SDL3/SDL_dlopennote.h +234 -0
  26. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_egl.h +11 -8
  27. data/assets/platform/include/SDL3/SDL_endian.h +645 -0
  28. data/assets/platform/include/SDL3/SDL_error.h +226 -0
  29. data/assets/platform/include/SDL3/SDL_events.h +1645 -0
  30. data/assets/platform/include/SDL3/SDL_filesystem.h +537 -0
  31. data/assets/platform/include/SDL3/SDL_gamepad.h +1656 -0
  32. data/assets/platform/include/SDL3/SDL_gpu.h +4608 -0
  33. data/assets/platform/include/SDL3/SDL_guid.h +106 -0
  34. data/assets/platform/include/SDL3/SDL_haptic.h +1461 -0
  35. data/assets/platform/include/SDL3/SDL_hidapi.h +571 -0
  36. data/assets/platform/include/SDL3/SDL_hints.h +5001 -0
  37. data/assets/platform/include/SDL3/SDL_init.h +507 -0
  38. data/assets/platform/include/SDL3/SDL_intrin.h +410 -0
  39. data/assets/platform/include/SDL3/SDL_iostream.h +1379 -0
  40. data/assets/platform/include/SDL3/SDL_joystick.h +1385 -0
  41. data/assets/platform/include/SDL3/SDL_keyboard.h +608 -0
  42. data/assets/platform/include/SDL3/SDL_keycode.h +347 -0
  43. data/assets/platform/include/SDL3/SDL_loadso.h +145 -0
  44. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_locale.h +40 -24
  45. data/assets/platform/include/SDL3/SDL_log.h +541 -0
  46. data/assets/platform/include/SDL3/SDL_main.h +704 -0
  47. data/assets/platform/include/SDL3/SDL_main_impl.h +151 -0
  48. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_messagebox.h +85 -48
  49. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_metal.h +29 -29
  50. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_misc.h +13 -12
  51. data/assets/platform/include/SDL3/SDL_mouse.h +813 -0
  52. data/assets/platform/include/SDL3/SDL_mutex.h +1117 -0
  53. data/assets/platform/include/SDL3/SDL_oldnames.h +1339 -0
  54. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengl.h +1247 -278
  55. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengl_glext.h +5 -1
  56. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles.h +6 -7
  57. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2.h +10 -11
  58. data/assets/platform/include/SDL3/SDL_pen.h +198 -0
  59. data/assets/platform/include/SDL3/SDL_pixels.h +1441 -0
  60. data/assets/{include/SDL2/SDL_test_log.h → platform/include/SDL3/SDL_platform.h} +25 -26
  61. data/assets/platform/include/SDL3/SDL_platform_defines.h +497 -0
  62. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_power.h +40 -20
  63. data/assets/platform/include/SDL3/SDL_process.h +441 -0
  64. data/assets/platform/include/SDL3/SDL_properties.h +572 -0
  65. data/assets/platform/include/SDL3/SDL_rect.h +528 -0
  66. data/assets/platform/include/SDL3/SDL_render.h +3028 -0
  67. data/assets/platform/include/SDL3/SDL_revision.h +59 -0
  68. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_scancode.h +59 -68
  69. data/assets/platform/include/SDL3/SDL_sensor.h +321 -0
  70. data/assets/platform/include/SDL3/SDL_stdinc.h +6186 -0
  71. data/assets/platform/include/SDL3/SDL_storage.h +686 -0
  72. data/assets/platform/include/SDL3/SDL_surface.h +1769 -0
  73. data/assets/platform/include/SDL3/SDL_system.h +840 -0
  74. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test.h +16 -22
  75. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_assert.h +27 -34
  76. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_common.h +109 -52
  77. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_compare.h +22 -14
  78. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_crc32.h +27 -30
  79. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_font.h +50 -49
  80. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_fuzzer.h +64 -79
  81. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_harness.h +47 -30
  82. data/assets/platform/include/SDL3/SDL_test_log.h +83 -0
  83. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_md5.h +21 -28
  84. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_memory.h +19 -16
  85. data/assets/platform/include/SDL3/SDL_thread.h +602 -0
  86. data/assets/platform/include/SDL3/SDL_time.h +249 -0
  87. data/assets/platform/include/SDL3/SDL_timer.h +454 -0
  88. data/assets/platform/include/SDL3/SDL_touch.h +184 -0
  89. data/assets/platform/include/SDL3/SDL_tray.h +544 -0
  90. data/assets/platform/include/SDL3/SDL_version.h +198 -0
  91. data/assets/platform/include/SDL3/SDL_video.h +3497 -0
  92. data/assets/platform/include/SDL3/SDL_vulkan.h +287 -0
  93. data/assets/platform/include/SDL3_image/SDL_image.h +3328 -0
  94. data/assets/platform/include/SDL3_mixer/SDL_mixer.h +3369 -0
  95. data/assets/platform/include/SDL3_ttf/SDL_textengine.h +181 -0
  96. data/assets/platform/include/SDL3_ttf/SDL_ttf.h +2833 -0
  97. data/assets/{include → platform/include}/mrbconf.h +42 -31
  98. data/assets/{include → platform/include}/mruby/array.h +3 -4
  99. data/assets/{include → platform/include}/mruby/boxing_nan.h +10 -0
  100. data/assets/platform/include/mruby/boxing_no.h +59 -0
  101. data/assets/{include → platform/include}/mruby/boxing_word.h +72 -26
  102. data/assets/platform/include/mruby/class.h +157 -0
  103. data/assets/{include → platform/include}/mruby/common.h +30 -1
  104. data/assets/{include → platform/include}/mruby/compile.h +52 -74
  105. data/assets/{include → platform/include}/mruby/data.h +2 -2
  106. data/assets/{include → platform/include}/mruby/debug.h +12 -5
  107. data/assets/{include → platform/include}/mruby/dump.h +7 -9
  108. data/assets/{include → platform/include}/mruby/endian.h +1 -1
  109. data/assets/platform/include/mruby/error.h +173 -0
  110. data/assets/platform/include/mruby/gc.h +79 -0
  111. data/assets/{include → platform/include}/mruby/hash.h +1 -7
  112. data/assets/platform/include/mruby/internal.h +282 -0
  113. data/assets/platform/include/mruby/irep.h +143 -0
  114. data/assets/{include → platform/include}/mruby/istruct.h +1 -1
  115. data/assets/platform/include/mruby/khash.h +455 -0
  116. data/assets/platform/include/mruby/mempool.h +19 -0
  117. data/assets/{include → platform/include}/mruby/numeric.h +7 -10
  118. data/assets/platform/include/mruby/object.h +51 -0
  119. data/assets/{include → platform/include}/mruby/opcode.h +5 -5
  120. data/assets/{include → platform/include}/mruby/ops.h +19 -6
  121. data/assets/platform/include/mruby/presym/id.h +1447 -0
  122. data/assets/{include → platform/include}/mruby/presym/scanning.h +10 -7
  123. data/assets/platform/include/mruby/presym/table.h +2893 -0
  124. data/assets/platform/include/mruby/presym.h +65 -0
  125. data/assets/platform/include/mruby/proc.h +184 -0
  126. data/assets/{include → platform/include}/mruby/range.h +0 -2
  127. data/assets/{include → platform/include}/mruby/string.h +33 -53
  128. data/assets/platform/include/mruby/throw.h +81 -0
  129. data/assets/{include → platform/include}/mruby/value.h +64 -29
  130. data/assets/{include → platform/include}/mruby/variable.h +6 -23
  131. data/assets/{include → platform/include}/mruby/version.h +7 -7
  132. data/assets/{include → platform/include}/mruby.h +238 -116
  133. data/assets/platform/macos-arm64/bin/mrbc +0 -0
  134. data/assets/platform/macos-arm64/lib/libSDL3.a +0 -0
  135. data/assets/platform/macos-arm64/lib/libSDL3_image.a +0 -0
  136. data/assets/platform/macos-arm64/lib/libSDL3_mixer.a +0 -0
  137. data/assets/platform/macos-arm64/lib/libSDL3_ttf.a +0 -0
  138. data/assets/platform/macos-arm64/lib/libmruby.a +0 -0
  139. data/assets/platform/wasm/lib/libFLAC.a +0 -0
  140. data/assets/platform/wasm/lib/libSDL3.a +0 -0
  141. data/assets/platform/wasm/lib/libSDL3_image.a +0 -0
  142. data/assets/platform/wasm/lib/libSDL3_mixer.a +0 -0
  143. data/assets/platform/wasm/lib/libSDL3_ttf.a +0 -0
  144. data/assets/platform/wasm/lib/libfreetype.a +0 -0
  145. data/assets/platform/wasm/lib/libharfbuzz.a +0 -0
  146. data/assets/platform/wasm/lib/libmruby.a +0 -0
  147. data/assets/platform/wasm/lib/libogg.a +0 -0
  148. data/assets/platform/wasm/lib/libplutosvg.a +0 -0
  149. data/assets/platform/wasm/lib/libplutovg.a +0 -0
  150. data/assets/platform/wasm/lib/libpng.a +0 -0
  151. data/assets/platform/wasm/lib/libpng16.a +0 -0
  152. data/assets/platform/wasm/lib/libvorbis.a +0 -0
  153. data/assets/platform/wasm/lib/libvorbisfile.a +0 -0
  154. data/assets/platform/wasm/lib/libzlibstatic.a +0 -0
  155. data/assets/platform/windows-arm64-mingw-ucrt/bin/mrbc.exe +0 -0
  156. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3.a +0 -0
  157. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_image.a +0 -0
  158. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_mixer.a +0 -0
  159. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_ttf.a +0 -0
  160. data/assets/platform/windows-arm64-mingw-ucrt/lib/libmruby.a +0 -0
  161. data/assets/platform/windows-x86_64-mingw-ucrt/bin/mrbc.exe +0 -0
  162. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3.a +0 -0
  163. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_image.a +0 -0
  164. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_mixer.a +0 -0
  165. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_ttf.a +0 -0
  166. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libmruby.a +0 -0
  167. data/assets/resources/fonts/outfit/OFL.txt +93 -0
  168. data/assets/resources/fonts/outfit/outfit.ttf +0 -0
  169. data/assets/resources/fonts/roboto_mono/OFL.txt +91 -0
  170. data/assets/resources/fonts/roboto_mono/roboto_mono.ttf +0 -0
  171. data/assets/resources/icons/icon.icns +0 -0
  172. data/assets/resources/icons/icon.png +0 -0
  173. data/assets/resources/spritesheets/License.txt +28 -0
  174. data/assets/resources/spritesheets/spritesheet-backgrounds.png +0 -0
  175. data/assets/resources/spritesheets/spritesheet-backgrounds.xml +16 -0
  176. data/assets/resources/spritesheets/spritesheet-characters.png +0 -0
  177. data/assets/resources/spritesheets/spritesheet-characters.xml +47 -0
  178. data/assets/resources/spritesheets/spritesheet-enemies.png +0 -0
  179. data/assets/resources/spritesheets/spritesheet-enemies.xml +62 -0
  180. data/assets/resources/spritesheets/spritesheet-tiles.png +0 -0
  181. data/assets/resources/spritesheets/spritesheet-tiles.xml +316 -0
  182. data/assets/{wasm → resources/web}/template.html +1 -1
  183. data/assets/target.rb +131 -0
  184. data/bin/ruby2d +281 -82
  185. data/examples/astar.rb +269 -0
  186. data/examples/asteroids.rb +403 -0
  187. data/examples/bezier_editor.rb +96 -0
  188. data/examples/boids.rb +191 -0
  189. data/examples/bouncing_balls.rb +119 -0
  190. data/examples/breakout.rb +186 -0
  191. data/examples/constellations.rb +100 -0
  192. data/examples/dashboard.rb +133 -0
  193. data/examples/double_pendulum.rb +254 -0
  194. data/examples/falling_sand.rb +291 -0
  195. data/examples/fireworks.rb +110 -0
  196. data/examples/fluid_dynamics.rb +340 -0
  197. data/examples/fourier_epicycles.rb +142 -0
  198. data/examples/fractal_tree.rb +326 -0
  199. data/examples/game_of_life.rb +148 -0
  200. data/examples/gamepads.rb +333 -0
  201. data/examples/hill_driver.rb +613 -0
  202. data/examples/logo_animation.rb +251 -0
  203. data/examples/lorenz_attractor.rb +115 -0
  204. data/examples/mandelbrot.rb +207 -0
  205. data/examples/marching_squares.rb +200 -0
  206. data/examples/maze.rb +323 -0
  207. data/examples/nbody.rb +338 -0
  208. data/examples/outrun.rb +391 -0
  209. data/examples/pixel_paint.rb +313 -0
  210. data/examples/platformer.rb +335 -0
  211. data/examples/ray_casting_maze.rb +175 -0
  212. data/examples/shadow_casting.rb +151 -0
  213. data/examples/shape_recognizer.rb +908 -0
  214. data/examples/snake.rb +144 -0
  215. data/examples/sprite_sheets.rb +246 -0
  216. data/examples/swarm.rb +206 -0
  217. data/examples/tsp_annealing.rb +104 -0
  218. data/examples/ui_controls.rb +163 -0
  219. data/examples/wireframe_3d.rb +139 -0
  220. data/ext/ruby2d/audio.c +324 -0
  221. data/ext/ruby2d/canvas.c +1715 -494
  222. data/ext/ruby2d/ext.c +541 -0
  223. data/ext/ruby2d/extconf.rb +122 -145
  224. data/ext/ruby2d/font.c +566 -20
  225. data/ext/ruby2d/fps.c +92 -0
  226. data/ext/ruby2d/image.c +466 -41
  227. data/ext/ruby2d/ruby2d.c +374 -1890
  228. data/ext/ruby2d/ruby2d.h +840 -460
  229. data/ext/ruby2d/shapes.c +931 -101
  230. data/ext/ruby2d/text.c +586 -21
  231. data/ext/ruby2d/window.c +1693 -283
  232. data/lib/ruby2d/atlas_parser.rb +194 -0
  233. data/lib/ruby2d/audio.rb +73 -0
  234. data/lib/ruby2d/benchmark.rb +259 -0
  235. data/lib/ruby2d/bitmap_text.rb +155 -0
  236. data/lib/ruby2d/button.rb +402 -0
  237. data/lib/ruby2d/canvas.rb +703 -279
  238. data/lib/ruby2d/circle.rb +206 -29
  239. data/lib/ruby2d/cli/browser.rb +314 -0
  240. data/lib/ruby2d/cli/build.rb +471 -257
  241. data/lib/ruby2d/cli/colorize.rb +7 -5
  242. data/lib/ruby2d/cli/examples.rb +127 -0
  243. data/lib/ruby2d/cli/launch.rb +24 -39
  244. data/lib/ruby2d/cli/lib_files.rb +48 -0
  245. data/lib/ruby2d/cli/messages.rb +40 -0
  246. data/lib/ruby2d/cli/setup.rb +273 -0
  247. data/lib/ruby2d/cli/static_server.rb +160 -0
  248. data/lib/ruby2d/cli/usage.rb +255 -0
  249. data/lib/ruby2d/color.rb +191 -69
  250. data/lib/ruby2d/core.rb +37 -19
  251. data/lib/ruby2d/deps_help.rb +89 -0
  252. data/lib/ruby2d/dsl.rb +51 -12
  253. data/lib/ruby2d/ellipse.rb +228 -0
  254. data/lib/ruby2d/exceptions.rb +0 -2
  255. data/lib/ruby2d/font.rb +34 -74
  256. data/lib/ruby2d/gamepad.rb +323 -0
  257. data/lib/ruby2d/gem_paths.rb +19 -0
  258. data/lib/ruby2d/image.rb +155 -52
  259. data/lib/ruby2d/interactive.rb +103 -0
  260. data/lib/ruby2d/json_parser.rb +268 -0
  261. data/lib/ruby2d/line.rb +194 -85
  262. data/lib/ruby2d/mruby_compat.rb +12 -0
  263. data/lib/ruby2d/polygon.rb +297 -0
  264. data/lib/ruby2d/polyline.rb +368 -0
  265. data/lib/ruby2d/quad.rb +358 -94
  266. data/lib/ruby2d/rectangle.rb +77 -19
  267. data/lib/ruby2d/renderable.rb +411 -11
  268. data/lib/ruby2d/sprite.rb +471 -180
  269. data/lib/ruby2d/sprite_sheet.rb +64 -0
  270. data/lib/ruby2d/square.rb +29 -17
  271. data/lib/ruby2d/text.rb +196 -65
  272. data/lib/ruby2d/tileset.rb +139 -81
  273. data/lib/ruby2d/triangle.rb +324 -89
  274. data/lib/ruby2d/version.rb +1 -3
  275. data/lib/ruby2d/vertices.rb +62 -85
  276. data/lib/ruby2d/warnings.rb +29 -0
  277. data/lib/ruby2d/window/class_methods.rb +218 -0
  278. data/lib/ruby2d/window/gamepad_events.rb +141 -0
  279. data/lib/ruby2d/window/key_events.rb +74 -0
  280. data/lib/ruby2d/window/mouse_events.rb +171 -0
  281. data/lib/ruby2d/window/object_events.rb +168 -0
  282. data/lib/ruby2d/window.rb +632 -585
  283. data/lib/ruby2d.rb +14 -19
  284. metadata +275 -428
  285. data/assets/app.icns +0 -0
  286. data/assets/include/GLES2/gl2.h +0 -656
  287. data/assets/include/GLES2/gl2ext.h +0 -3949
  288. data/assets/include/GLES2/gl2ext_angle.h +0 -701
  289. data/assets/include/GLES2/gl2platform.h +0 -27
  290. data/assets/include/GLES3/gl3.h +0 -1192
  291. data/assets/include/GLES3/gl31.h +0 -1507
  292. data/assets/include/GLES3/gl32.h +0 -1808
  293. data/assets/include/GLES3/gl3platform.h +0 -27
  294. data/assets/include/KHR/khrplatform.h +0 -290
  295. data/assets/include/SDL2/SDL.h +0 -233
  296. data/assets/include/SDL2/SDL_assert.h +0 -326
  297. data/assets/include/SDL2/SDL_atomic.h +0 -415
  298. data/assets/include/SDL2/SDL_audio.h +0 -1500
  299. data/assets/include/SDL2/SDL_clipboard.h +0 -141
  300. data/assets/include/SDL2/SDL_config.h +0 -61
  301. data/assets/include/SDL2/SDL_config_android.h +0 -194
  302. data/assets/include/SDL2/SDL_config_emscripten.h +0 -218
  303. data/assets/include/SDL2/SDL_config_iphoneos.h +0 -217
  304. data/assets/include/SDL2/SDL_config_macosx.h +0 -277
  305. data/assets/include/SDL2/SDL_config_minimal.h +0 -95
  306. data/assets/include/SDL2/SDL_config_ngage.h +0 -89
  307. data/assets/include/SDL2/SDL_config_os2.h +0 -207
  308. data/assets/include/SDL2/SDL_config_pandora.h +0 -141
  309. data/assets/include/SDL2/SDL_config_windows.h +0 -331
  310. data/assets/include/SDL2/SDL_config_wingdk.h +0 -253
  311. data/assets/include/SDL2/SDL_config_winrt.h +0 -220
  312. data/assets/include/SDL2/SDL_config_xbox.h +0 -235
  313. data/assets/include/SDL2/SDL_cpuinfo.h +0 -594
  314. data/assets/include/SDL2/SDL_endian.h +0 -348
  315. data/assets/include/SDL2/SDL_error.h +0 -163
  316. data/assets/include/SDL2/SDL_events.h +0 -1166
  317. data/assets/include/SDL2/SDL_filesystem.h +0 -149
  318. data/assets/include/SDL2/SDL_gamecontroller.h +0 -1074
  319. data/assets/include/SDL2/SDL_gesture.h +0 -117
  320. data/assets/include/SDL2/SDL_guid.h +0 -100
  321. data/assets/include/SDL2/SDL_haptic.h +0 -1341
  322. data/assets/include/SDL2/SDL_hidapi.h +0 -451
  323. data/assets/include/SDL2/SDL_hints.h +0 -2569
  324. data/assets/include/SDL2/SDL_image.h +0 -2173
  325. data/assets/include/SDL2/SDL_joystick.h +0 -1066
  326. data/assets/include/SDL2/SDL_keyboard.h +0 -353
  327. data/assets/include/SDL2/SDL_keycode.h +0 -358
  328. data/assets/include/SDL2/SDL_loadso.h +0 -115
  329. data/assets/include/SDL2/SDL_log.h +0 -404
  330. data/assets/include/SDL2/SDL_main.h +0 -275
  331. data/assets/include/SDL2/SDL_mixer.h +0 -2784
  332. data/assets/include/SDL2/SDL_mouse.h +0 -465
  333. data/assets/include/SDL2/SDL_mutex.h +0 -471
  334. data/assets/include/SDL2/SDL_name.h +0 -33
  335. data/assets/include/SDL2/SDL_pixels.h +0 -644
  336. data/assets/include/SDL2/SDL_platform.h +0 -261
  337. data/assets/include/SDL2/SDL_quit.h +0 -58
  338. data/assets/include/SDL2/SDL_rect.h +0 -376
  339. data/assets/include/SDL2/SDL_render.h +0 -1919
  340. data/assets/include/SDL2/SDL_revision.h +0 -6
  341. data/assets/include/SDL2/SDL_rwops.h +0 -841
  342. data/assets/include/SDL2/SDL_sensor.h +0 -322
  343. data/assets/include/SDL2/SDL_shape.h +0 -155
  344. data/assets/include/SDL2/SDL_stdinc.h +0 -830
  345. data/assets/include/SDL2/SDL_surface.h +0 -997
  346. data/assets/include/SDL2/SDL_system.h +0 -623
  347. data/assets/include/SDL2/SDL_syswm.h +0 -386
  348. data/assets/include/SDL2/SDL_test_images.h +0 -78
  349. data/assets/include/SDL2/SDL_test_random.h +0 -115
  350. data/assets/include/SDL2/SDL_thread.h +0 -464
  351. data/assets/include/SDL2/SDL_timer.h +0 -222
  352. data/assets/include/SDL2/SDL_touch.h +0 -150
  353. data/assets/include/SDL2/SDL_ttf.h +0 -2316
  354. data/assets/include/SDL2/SDL_types.h +0 -29
  355. data/assets/include/SDL2/SDL_version.h +0 -204
  356. data/assets/include/SDL2/SDL_video.h +0 -2150
  357. data/assets/include/SDL2/SDL_vulkan.h +0 -215
  358. data/assets/include/SDL2/begin_code.h +0 -187
  359. data/assets/include/mruby/boxing_no.h +0 -58
  360. data/assets/include/mruby/class.h +0 -108
  361. data/assets/include/mruby/error.h +0 -147
  362. data/assets/include/mruby/gc.h +0 -94
  363. data/assets/include/mruby/irep.h +0 -147
  364. data/assets/include/mruby/khash.h +0 -284
  365. data/assets/include/mruby/object.h +0 -43
  366. data/assets/include/mruby/presym/disable.h +0 -70
  367. data/assets/include/mruby/presym/enable.h +0 -37
  368. data/assets/include/mruby/presym.h +0 -40
  369. data/assets/include/mruby/proc.h +0 -211
  370. data/assets/include/mruby/throw.h +0 -66
  371. data/assets/macos/universal/bin/mrbc +0 -0
  372. data/assets/macos/universal/lib/libFLAC.a +0 -0
  373. data/assets/macos/universal/lib/libSDL2.a +0 -0
  374. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  375. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  376. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  377. data/assets/macos/universal/lib/libavif.a +0 -0
  378. data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
  379. data/assets/macos/universal/lib/libbrotlidec-static.a +0 -0
  380. data/assets/macos/universal/lib/libfreetype.a +0 -0
  381. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  382. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  383. data/assets/macos/universal/lib/libhwy.a +0 -0
  384. data/assets/macos/universal/lib/libjpeg.a +0 -0
  385. data/assets/macos/universal/lib/libjxl.a +0 -0
  386. data/assets/macos/universal/lib/libmodplug.a +0 -0
  387. data/assets/macos/universal/lib/libmpg123.a +0 -0
  388. data/assets/macos/universal/lib/libmruby.a +0 -0
  389. data/assets/macos/universal/lib/libogg.a +0 -0
  390. data/assets/macos/universal/lib/libpng.a +0 -0
  391. data/assets/macos/universal/lib/libtiff.a +0 -0
  392. data/assets/macos/universal/lib/libvorbis.a +0 -0
  393. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  394. data/assets/macos/universal/lib/libwebp.a +0 -0
  395. data/assets/macos/universal/lib/libzstd.a +0 -0
  396. data/assets/test_media/README.md +0 -3
  397. data/assets/test_media/bitstream_vera/COPYRIGHT.txt +0 -124
  398. data/assets/test_media/bitstream_vera/vera.ttf +0 -0
  399. data/assets/test_media/boom.png +0 -0
  400. data/assets/test_media/coin.png +0 -0
  401. data/assets/test_media/colors.png +0 -0
  402. data/assets/test_media/controller.png +0 -0
  403. data/assets/test_media/dial.wav +0 -0
  404. data/assets/test_media/hero.png +0 -0
  405. data/assets/test_media/image.bmp +0 -0
  406. data/assets/test_media/image.jpg +0 -0
  407. data/assets/test_media/image.png +0 -0
  408. data/assets/test_media/music.flac +0 -0
  409. data/assets/test_media/music.mp3 +0 -0
  410. data/assets/test_media/music.ogg +0 -0
  411. data/assets/test_media/music.wav +0 -0
  412. data/assets/test_media/originals/boom.pxm +0 -0
  413. data/assets/test_media/originals/coin.pxm +0 -0
  414. data/assets/test_media/originals/controller.sketch +0 -0
  415. data/assets/test_media/originals/hero.pxm +0 -0
  416. data/assets/test_media/originals/image.pxm +0 -0
  417. data/assets/test_media/originals/music.caf +0 -0
  418. data/assets/test_media/originals/texture_atlas.pxm +0 -0
  419. data/assets/test_media/rondo_alla_turka.ogg +0 -0
  420. data/assets/test_media/sound.flac +0 -0
  421. data/assets/test_media/sound.mp3 +0 -0
  422. data/assets/test_media/sound.ogg +0 -0
  423. data/assets/test_media/sound.wav +0 -0
  424. data/assets/test_media/sprite_sheet.png +0 -0
  425. data/assets/test_media/texture_atlas.png +0 -0
  426. data/assets/wasm/libmruby.a +0 -0
  427. data/assets/windows/mingw-w64-ucrt-x86_64/bin/mrbc.exe +0 -0
  428. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  429. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
  430. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  431. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
  432. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  433. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
  434. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
  435. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
  436. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbz2.a +0 -0
  437. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
  438. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
  439. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  440. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libgraphite2.a +0 -0
  441. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
  442. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libhwy.a +0 -0
  443. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjbig.a +0 -0
  444. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
  445. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjxl.a +0 -0
  446. data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
  447. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
  448. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  449. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
  450. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
  451. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  452. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
  453. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng.a +0 -0
  454. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  455. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -1
  456. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  457. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
  458. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
  459. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
  460. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
  461. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  462. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a +0 -0
  463. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  464. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  465. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  466. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  467. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  468. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  469. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  470. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  471. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  472. data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
  473. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  474. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  475. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  476. data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
  477. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  478. data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
  479. data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
  480. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  481. data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
  482. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  483. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  484. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  485. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  486. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  487. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  488. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  489. data/assets/windows/mingw-w64-x86_64/lib/libpng.a +0 -0
  490. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  491. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -1
  492. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  493. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  494. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  495. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  496. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  497. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  498. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  499. data/assets/xcode/ios/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  500. data/assets/xcode/ios/Assets.xcassets/Contents.json +0 -6
  501. data/assets/xcode/ios/Base.lproj/LaunchScreen.storyboard +0 -27
  502. data/assets/xcode/ios/Info.plist +0 -43
  503. data/assets/xcode/ios/MRuby.framework/Headers/mrbconf.h +0 -143
  504. data/assets/xcode/ios/MRuby.framework/Headers/mruby/array.h +0 -280
  505. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_nan.h +0 -102
  506. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_no.h +0 -56
  507. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_word.h +0 -144
  508. data/assets/xcode/ios/MRuby.framework/Headers/mruby/class.h +0 -97
  509. data/assets/xcode/ios/MRuby.framework/Headers/mruby/common.h +0 -77
  510. data/assets/xcode/ios/MRuby.framework/Headers/mruby/compile.h +0 -195
  511. data/assets/xcode/ios/MRuby.framework/Headers/mruby/data.h +0 -75
  512. data/assets/xcode/ios/MRuby.framework/Headers/mruby/debug.h +0 -67
  513. data/assets/xcode/ios/MRuby.framework/Headers/mruby/dump.h +0 -196
  514. data/assets/xcode/ios/MRuby.framework/Headers/mruby/error.h +0 -75
  515. data/assets/xcode/ios/MRuby.framework/Headers/mruby/gc.h +0 -91
  516. data/assets/xcode/ios/MRuby.framework/Headers/mruby/hash.h +0 -215
  517. data/assets/xcode/ios/MRuby.framework/Headers/mruby/irep.h +0 -75
  518. data/assets/xcode/ios/MRuby.framework/Headers/mruby/istruct.h +0 -47
  519. data/assets/xcode/ios/MRuby.framework/Headers/mruby/khash.h +0 -274
  520. data/assets/xcode/ios/MRuby.framework/Headers/mruby/numeric.h +0 -161
  521. data/assets/xcode/ios/MRuby.framework/Headers/mruby/object.h +0 -44
  522. data/assets/xcode/ios/MRuby.framework/Headers/mruby/opcode.h +0 -69
  523. data/assets/xcode/ios/MRuby.framework/Headers/mruby/ops.h +0 -117
  524. data/assets/xcode/ios/MRuby.framework/Headers/mruby/proc.h +0 -131
  525. data/assets/xcode/ios/MRuby.framework/Headers/mruby/range.h +0 -49
  526. data/assets/xcode/ios/MRuby.framework/Headers/mruby/re.h +0 -16
  527. data/assets/xcode/ios/MRuby.framework/Headers/mruby/string.h +0 -444
  528. data/assets/xcode/ios/MRuby.framework/Headers/mruby/throw.h +0 -55
  529. data/assets/xcode/ios/MRuby.framework/Headers/mruby/value.h +0 -309
  530. data/assets/xcode/ios/MRuby.framework/Headers/mruby/variable.h +0 -136
  531. data/assets/xcode/ios/MRuby.framework/Headers/mruby/version.h +0 -110
  532. data/assets/xcode/ios/MRuby.framework/Headers/mruby.h +0 -1282
  533. data/assets/xcode/ios/MRuby.framework/Info.plist +0 -20
  534. data/assets/xcode/ios/MRuby.framework/MRuby +0 -0
  535. data/assets/xcode/ios/MyApp.xcodeproj/project.pbxproj +0 -368
  536. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  537. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  538. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -30
  539. data/assets/xcode/ios/main.c +0 -1
  540. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -16
  541. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -6
  542. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -17
  543. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -16
  544. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -6
  545. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -16
  546. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -6
  547. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -16
  548. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -6
  549. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -17
  550. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -16
  551. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -6
  552. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -16
  553. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -6
  554. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -32
  555. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -16
  556. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -16
  557. data/assets/xcode/tvos/Assets.xcassets/Contents.json +0 -6
  558. data/assets/xcode/tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -22
  559. data/assets/xcode/tvos/Info.plist +0 -30
  560. data/assets/xcode/tvos/MRuby.framework/Headers/mrbconf.h +0 -143
  561. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/array.h +0 -280
  562. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_nan.h +0 -102
  563. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_no.h +0 -56
  564. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_word.h +0 -144
  565. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/class.h +0 -97
  566. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/common.h +0 -77
  567. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/compile.h +0 -195
  568. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/data.h +0 -75
  569. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/debug.h +0 -67
  570. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/dump.h +0 -196
  571. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h +0 -75
  572. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/gc.h +0 -91
  573. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/hash.h +0 -215
  574. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/irep.h +0 -75
  575. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/istruct.h +0 -47
  576. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/khash.h +0 -274
  577. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/numeric.h +0 -161
  578. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/object.h +0 -44
  579. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/opcode.h +0 -69
  580. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/ops.h +0 -117
  581. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/proc.h +0 -131
  582. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/range.h +0 -49
  583. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/re.h +0 -16
  584. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/string.h +0 -444
  585. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/throw.h +0 -55
  586. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/value.h +0 -309
  587. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/variable.h +0 -136
  588. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/version.h +0 -110
  589. data/assets/xcode/tvos/MRuby.framework/Headers/mruby.h +0 -1282
  590. data/assets/xcode/tvos/MRuby.framework/Info.plist +0 -20
  591. data/assets/xcode/tvos/MRuby.framework/MRuby +0 -0
  592. data/assets/xcode/tvos/MyApp.xcodeproj/project.pbxproj +0 -350
  593. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  594. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  595. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -30
  596. data/assets/xcode/tvos/main.c +0 -1
  597. data/ext/ruby2d/common.c +0 -185
  598. data/ext/ruby2d/controllers.c +0 -110
  599. data/ext/ruby2d/gl.c +0 -398
  600. data/ext/ruby2d/gl2.c +0 -86
  601. data/ext/ruby2d/gl3.c +0 -304
  602. data/ext/ruby2d/gles.c +0 -302
  603. data/ext/ruby2d/input.c +0 -48
  604. data/ext/ruby2d/music.c +0 -127
  605. data/ext/ruby2d/sound.c +0 -132
  606. data/lib/ruby2d/cli/console.rb +0 -65
  607. data/lib/ruby2d/cli/enable_console.rb +0 -7
  608. data/lib/ruby2d/cli/platform.rb +0 -17
  609. data/lib/ruby2d/music.rb +0 -77
  610. data/lib/ruby2d/pixel.rb +0 -18
  611. data/lib/ruby2d/pixmap.rb +0 -39
  612. data/lib/ruby2d/pixmap_atlas.rb +0 -56
  613. data/lib/ruby2d/sound.rb +0 -61
  614. data/lib/ruby2d/texture.rb +0 -38
  615. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2.h +0 -0
  616. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2ext.h +0 -0
  617. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2platform.h +0 -0
  618. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_khrplatform.h +0 -0
  619. /data/assets/{include → platform/include}/mruby/re.h +0 -0
@@ -0,0 +1,1645 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * # CategoryEvents
24
+ *
25
+ * Event queue management.
26
+ *
27
+ * It's extremely common--often required--that an app deal with SDL's event
28
+ * queue. Almost all useful information about interactions with the real world
29
+ * flow through here: the user interacting with the computer and app, hardware
30
+ * coming and going, the system changing in some way, etc.
31
+ *
32
+ * An app generally takes a moment, perhaps at the start of a new frame, to
33
+ * examine any events that have occurred since the last time and process or
34
+ * ignore them. This is generally done by calling SDL_PollEvent() in a loop
35
+ * until it returns false (or, if using the main callbacks, events are
36
+ * provided one at a time in calls to SDL_AppEvent() before the next call to
37
+ * SDL_AppIterate(); in this scenario, the app does not call SDL_PollEvent()
38
+ * at all).
39
+ *
40
+ * There is other forms of control, too: SDL_PeepEvents() has more
41
+ * functionality at the cost of more complexity, and SDL_WaitEvent() can block
42
+ * the process until something interesting happens, which might be beneficial
43
+ * for certain types of programs on low-power hardware. One may also call
44
+ * SDL_AddEventWatch() to set a callback when new events arrive.
45
+ *
46
+ * The app is free to generate their own events, too: SDL_PushEvent allows the
47
+ * app to put events onto the queue for later retrieval; SDL_RegisterEvents
48
+ * can guarantee that these events have a type that isn't in use by other
49
+ * parts of the system.
50
+ */
51
+
52
+ #ifndef SDL_events_h_
53
+ #define SDL_events_h_
54
+
55
+ #include <SDL3/SDL_stdinc.h>
56
+ #include <SDL3/SDL_audio.h>
57
+ #include <SDL3/SDL_camera.h>
58
+ #include <SDL3/SDL_error.h>
59
+ #include <SDL3/SDL_gamepad.h>
60
+ #include <SDL3/SDL_joystick.h>
61
+ #include <SDL3/SDL_keyboard.h>
62
+ #include <SDL3/SDL_keycode.h>
63
+ #include <SDL3/SDL_mouse.h>
64
+ #include <SDL3/SDL_pen.h>
65
+ #include <SDL3/SDL_power.h>
66
+ #include <SDL3/SDL_sensor.h>
67
+ #include <SDL3/SDL_scancode.h>
68
+ #include <SDL3/SDL_touch.h>
69
+ #include <SDL3/SDL_video.h>
70
+
71
+ #include <SDL3/SDL_begin_code.h>
72
+ /* Set up for C function definitions, even when using C++ */
73
+ #ifdef __cplusplus
74
+ extern "C" {
75
+ #endif
76
+
77
+ /* General keyboard/mouse/pen state definitions */
78
+
79
+ /**
80
+ * The types of events that can be delivered.
81
+ *
82
+ * \since This enum is available since SDL 3.2.0.
83
+ */
84
+ typedef enum SDL_EventType
85
+ {
86
+ SDL_EVENT_FIRST = 0, /**< Unused (do not remove) */
87
+
88
+ /* Application events */
89
+ SDL_EVENT_QUIT = 0x100, /**< User-requested quit */
90
+
91
+ /* These application events have special meaning on iOS and Android, see README-ios.md and README-android.md for details */
92
+ SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS. This event must be handled in a callback set with SDL_AddEventWatch().
93
+ Called on iOS in applicationWillTerminate()
94
+ Called on Android in onDestroy()
95
+ */
96
+ SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible. This event must be handled in a callback set with SDL_AddEventWatch().
97
+ Called on iOS in applicationDidReceiveMemoryWarning()
98
+ Called on Android in onTrimMemory()
99
+ */
100
+ SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background. This event must be handled in a callback set with SDL_AddEventWatch().
101
+ Called on iOS in applicationWillResignActive()
102
+ Called on Android in onPause()
103
+ */
104
+ SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with SDL_AddEventWatch().
105
+ Called on iOS in applicationDidEnterBackground()
106
+ Called on Android in onPause()
107
+ */
108
+ SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground. This event must be handled in a callback set with SDL_AddEventWatch().
109
+ Called on iOS in applicationWillEnterForeground()
110
+ Called on Android in onResume()
111
+ */
112
+ SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive. This event must be handled in a callback set with SDL_AddEventWatch().
113
+ Called on iOS in applicationDidBecomeActive()
114
+ Called on Android in onResume()
115
+ */
116
+
117
+ SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
118
+
119
+ SDL_EVENT_SYSTEM_THEME_CHANGED, /**< The system theme changed */
120
+
121
+ /* Display events */
122
+ /* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
123
+ SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
124
+ SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
125
+ SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
126
+ SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
127
+ SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED, /**< Display has changed desktop mode */
128
+ SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED, /**< Display has changed current mode */
129
+ SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
130
+ SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED, /**< Display has changed usable bounds */
131
+ SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
132
+ SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED,
133
+
134
+ /* Window events */
135
+ /* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
136
+ /* 0x201 was SDL_SYSWMEVENT, reserve the number for sdl2-compat */
137
+ SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
138
+ SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
139
+ SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
140
+ data1 is 1 for live-resize expose events, 0 otherwise. */
141
+ SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
142
+ SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
143
+ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
144
+ SDL_EVENT_WINDOW_METAL_VIEW_RESIZED,/**< The pixel size of a Metal view associated with the window has changed */
145
+ SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */
146
+ SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */
147
+ SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */
148
+ SDL_EVENT_WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
149
+ SDL_EVENT_WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
150
+ SDL_EVENT_WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
151
+ SDL_EVENT_WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
152
+ SDL_EVENT_WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
153
+ SDL_EVENT_WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
154
+ SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */
155
+ SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
156
+ SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */
157
+ SDL_EVENT_WINDOW_SAFE_AREA_CHANGED, /**< The window safe area has been changed */
158
+ SDL_EVENT_WINDOW_OCCLUDED, /**< The window has been occluded */
159
+ SDL_EVENT_WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */
160
+ SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */
161
+ SDL_EVENT_WINDOW_DESTROYED, /**< The window with the associated ID is being or has been destroyed. If this message is being handled
162
+ in an event watcher, the window handle is still valid and can still be used to retrieve any properties
163
+ associated with the window. Otherwise, the handle has already been destroyed and all resources
164
+ associated with it are invalid */
165
+ SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
166
+ SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
167
+ SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
168
+
169
+ /* Keyboard events */
170
+ SDL_EVENT_KEY_DOWN = 0x300, /**< Key pressed */
171
+ SDL_EVENT_KEY_UP, /**< Key released */
172
+ SDL_EVENT_TEXT_EDITING, /**< Keyboard text editing (composition) */
173
+ SDL_EVENT_TEXT_INPUT, /**< Keyboard text input */
174
+ SDL_EVENT_KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
175
+ input language or keyboard layout change. */
176
+ SDL_EVENT_KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
177
+ SDL_EVENT_KEYBOARD_REMOVED, /**< A keyboard has been removed */
178
+ SDL_EVENT_TEXT_EDITING_CANDIDATES, /**< Keyboard text editing candidates */
179
+ SDL_EVENT_SCREEN_KEYBOARD_SHOWN, /**< The on-screen keyboard has been shown */
180
+ SDL_EVENT_SCREEN_KEYBOARD_HIDDEN, /**< The on-screen keyboard has been hidden */
181
+
182
+ /* Mouse events */
183
+ SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */
184
+ SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
185
+ SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */
186
+ SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */
187
+ SDL_EVENT_MOUSE_ADDED, /**< A new mouse has been inserted into the system */
188
+ SDL_EVENT_MOUSE_REMOVED, /**< A mouse has been removed */
189
+
190
+ /* Joystick events */
191
+ SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
192
+ SDL_EVENT_JOYSTICK_BALL_MOTION, /**< Joystick trackball motion */
193
+ SDL_EVENT_JOYSTICK_HAT_MOTION, /**< Joystick hat position change */
194
+ SDL_EVENT_JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
195
+ SDL_EVENT_JOYSTICK_BUTTON_UP, /**< Joystick button released */
196
+ SDL_EVENT_JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
197
+ SDL_EVENT_JOYSTICK_REMOVED, /**< An opened joystick has been removed */
198
+ SDL_EVENT_JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
199
+ SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, /**< Joystick update is complete */
200
+
201
+ /* Gamepad events */
202
+ SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
203
+ SDL_EVENT_GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
204
+ SDL_EVENT_GAMEPAD_BUTTON_UP, /**< Gamepad button released */
205
+ SDL_EVENT_GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
206
+ SDL_EVENT_GAMEPAD_REMOVED, /**< A gamepad has been removed */
207
+ SDL_EVENT_GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
208
+ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
209
+ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
210
+ SDL_EVENT_GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
211
+ SDL_EVENT_GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
212
+ SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, /**< Gamepad update is complete */
213
+ SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED, /**< Gamepad Steam handle has changed */
214
+
215
+ /* Touch events */
216
+ SDL_EVENT_FINGER_DOWN = 0x700,
217
+ SDL_EVENT_FINGER_UP,
218
+ SDL_EVENT_FINGER_MOTION,
219
+ SDL_EVENT_FINGER_CANCELED,
220
+
221
+ /* Pinch events */
222
+ SDL_EVENT_PINCH_BEGIN = 0x710, /**< Pinch gesture started */
223
+ SDL_EVENT_PINCH_UPDATE, /**< Pinch gesture updated */
224
+ SDL_EVENT_PINCH_END, /**< Pinch gesture ended */
225
+
226
+ /* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
227
+
228
+ /* Clipboard events */
229
+ SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard changed */
230
+
231
+ /* Drag and drop events */
232
+ SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */
233
+ SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event */
234
+ SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
235
+ SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
236
+ SDL_EVENT_DROP_POSITION, /**< Position while moving over the window */
237
+
238
+ /* Audio hotplug events */
239
+ SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
240
+ SDL_EVENT_AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
241
+ SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED, /**< An audio device's format has been changed by the system. */
242
+
243
+ /* Sensor events */
244
+ SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
245
+
246
+ /* Pressure-sensitive pen events */
247
+ SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
248
+ SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
249
+ SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
250
+ SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
251
+ SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
252
+ SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
253
+ SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
254
+ SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
255
+
256
+ /* Camera hotplug events */
257
+ SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
258
+ SDL_EVENT_CAMERA_DEVICE_REMOVED, /**< A camera device has been removed. */
259
+ SDL_EVENT_CAMERA_DEVICE_APPROVED, /**< A camera device has been approved for use by the user. */
260
+ SDL_EVENT_CAMERA_DEVICE_DENIED, /**< A camera device has been denied for use by the user. */
261
+
262
+ /* Render events */
263
+ SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
264
+ SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
265
+ SDL_EVENT_RENDER_DEVICE_LOST, /**< The device has been lost and can't be recovered. */
266
+
267
+ /* Reserved events for private platforms */
268
+ SDL_EVENT_PRIVATE0 = 0x4000,
269
+ SDL_EVENT_PRIVATE1,
270
+ SDL_EVENT_PRIVATE2,
271
+ SDL_EVENT_PRIVATE3,
272
+
273
+ /* Internal events */
274
+ SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
275
+
276
+ /** Events SDL_EVENT_USER through SDL_EVENT_LAST are for your use,
277
+ * and should be allocated with SDL_RegisterEvents()
278
+ */
279
+ SDL_EVENT_USER = 0x8000,
280
+
281
+ /**
282
+ * This last event is only for bounding internal arrays
283
+ */
284
+ SDL_EVENT_LAST = 0xFFFF,
285
+
286
+ /* This just makes sure the enum is the size of Uint32 */
287
+ SDL_EVENT_ENUM_PADDING = 0x7FFFFFFF
288
+
289
+ } SDL_EventType;
290
+
291
+ /**
292
+ * Fields shared by every event
293
+ *
294
+ * \since This struct is available since SDL 3.2.0.
295
+ */
296
+ typedef struct SDL_CommonEvent
297
+ {
298
+ Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
299
+ Uint32 reserved;
300
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
301
+ } SDL_CommonEvent;
302
+
303
+ /**
304
+ * Display state change event data (event.display.*)
305
+ *
306
+ * \since This struct is available since SDL 3.2.0.
307
+ */
308
+ typedef struct SDL_DisplayEvent
309
+ {
310
+ SDL_EventType type; /**< SDL_EVENT_DISPLAY_* */
311
+ Uint32 reserved;
312
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
313
+ SDL_DisplayID displayID;/**< The associated display */
314
+ Sint32 data1; /**< event dependent data */
315
+ Sint32 data2; /**< event dependent data */
316
+ } SDL_DisplayEvent;
317
+
318
+ /**
319
+ * Window state change event data (event.window.*)
320
+ *
321
+ * \since This struct is available since SDL 3.2.0.
322
+ */
323
+ typedef struct SDL_WindowEvent
324
+ {
325
+ SDL_EventType type; /**< SDL_EVENT_WINDOW_* */
326
+ Uint32 reserved;
327
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
328
+ SDL_WindowID windowID; /**< The associated window */
329
+ Sint32 data1; /**< event dependent data */
330
+ Sint32 data2; /**< event dependent data */
331
+ } SDL_WindowEvent;
332
+
333
+ /**
334
+ * Keyboard device event structure (event.kdevice.*)
335
+ *
336
+ * \since This struct is available since SDL 3.2.0.
337
+ */
338
+ typedef struct SDL_KeyboardDeviceEvent
339
+ {
340
+ SDL_EventType type; /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */
341
+ Uint32 reserved;
342
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
343
+ SDL_KeyboardID which; /**< The keyboard instance id */
344
+ } SDL_KeyboardDeviceEvent;
345
+
346
+ /**
347
+ * Keyboard button event structure (event.key.*)
348
+ *
349
+ * The `key` is the base SDL_Keycode generated by pressing the `scancode`
350
+ * using the current keyboard layout, applying any options specified in
351
+ * SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the
352
+ * event scancode and modifiers directly from the keyboard layout, bypassing
353
+ * SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode().
354
+ *
355
+ * \since This struct is available since SDL 3.2.0.
356
+ *
357
+ * \sa SDL_GetKeyFromScancode
358
+ * \sa SDL_HINT_KEYCODE_OPTIONS
359
+ */
360
+ typedef struct SDL_KeyboardEvent
361
+ {
362
+ SDL_EventType type; /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */
363
+ Uint32 reserved;
364
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
365
+ SDL_WindowID windowID; /**< The window with keyboard focus, if any */
366
+ SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */
367
+ SDL_Scancode scancode; /**< SDL physical key code */
368
+ SDL_Keycode key; /**< SDL virtual key code */
369
+ SDL_Keymod mod; /**< current key modifiers */
370
+ Uint16 raw; /**< The platform dependent scancode for this event */
371
+ bool down; /**< true if the key is pressed */
372
+ bool repeat; /**< true if this is a key repeat */
373
+ } SDL_KeyboardEvent;
374
+
375
+ /**
376
+ * Keyboard text editing event structure (event.edit.*)
377
+ *
378
+ * The start cursor is the position, in UTF-8 characters, where new typing
379
+ * will be inserted into the editing text. The length is the number of UTF-8
380
+ * characters that will be replaced by new typing.
381
+ *
382
+ * \since This struct is available since SDL 3.2.0.
383
+ */
384
+ typedef struct SDL_TextEditingEvent
385
+ {
386
+ SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING */
387
+ Uint32 reserved;
388
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
389
+ SDL_WindowID windowID; /**< The window with keyboard focus, if any */
390
+ const char *text; /**< The editing text */
391
+ Sint32 start; /**< The start cursor of selected editing text, or -1 if not set */
392
+ Sint32 length; /**< The length of selected editing text, or -1 if not set */
393
+ } SDL_TextEditingEvent;
394
+
395
+ /**
396
+ * Keyboard IME candidates event structure (event.edit_candidates.*)
397
+ *
398
+ * \since This struct is available since SDL 3.2.0.
399
+ */
400
+ typedef struct SDL_TextEditingCandidatesEvent
401
+ {
402
+ SDL_EventType type; /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */
403
+ Uint32 reserved;
404
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
405
+ SDL_WindowID windowID; /**< The window with keyboard focus, if any */
406
+ const char * const *candidates; /**< The list of candidates, or NULL if there are no candidates available */
407
+ Sint32 num_candidates; /**< The number of strings in `candidates` */
408
+ Sint32 selected_candidate; /**< The index of the selected candidate, or -1 if no candidate is selected */
409
+ bool horizontal; /**< true if the list is horizontal, false if it's vertical */
410
+ Uint8 padding1;
411
+ Uint8 padding2;
412
+ Uint8 padding3;
413
+ } SDL_TextEditingCandidatesEvent;
414
+
415
+ /**
416
+ * Keyboard text input event structure (event.text.*)
417
+ *
418
+ * This event will never be delivered unless text input is enabled by calling
419
+ * SDL_StartTextInput(). Text input is disabled by default!
420
+ *
421
+ * \since This struct is available since SDL 3.2.0.
422
+ *
423
+ * \sa SDL_StartTextInput
424
+ * \sa SDL_StopTextInput
425
+ */
426
+ typedef struct SDL_TextInputEvent
427
+ {
428
+ SDL_EventType type; /**< SDL_EVENT_TEXT_INPUT */
429
+ Uint32 reserved;
430
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
431
+ SDL_WindowID windowID; /**< The window with keyboard focus, if any */
432
+ const char *text; /**< The input text, UTF-8 encoded */
433
+ } SDL_TextInputEvent;
434
+
435
+ /**
436
+ * Mouse device event structure (event.mdevice.*)
437
+ *
438
+ * \since This struct is available since SDL 3.2.0.
439
+ */
440
+ typedef struct SDL_MouseDeviceEvent
441
+ {
442
+ SDL_EventType type; /**< SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED */
443
+ Uint32 reserved;
444
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
445
+ SDL_MouseID which; /**< The mouse instance id */
446
+ } SDL_MouseDeviceEvent;
447
+
448
+ /**
449
+ * Mouse motion event structure (event.motion.*)
450
+ *
451
+ * \since This struct is available since SDL 3.2.0.
452
+ */
453
+ typedef struct SDL_MouseMotionEvent
454
+ {
455
+ SDL_EventType type; /**< SDL_EVENT_MOUSE_MOTION */
456
+ Uint32 reserved;
457
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
458
+ SDL_WindowID windowID; /**< The window with mouse focus, if any */
459
+ SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, SDL_PEN_MOUSEID for pen events, or 0 */
460
+ SDL_MouseButtonFlags state; /**< The current button state */
461
+ float x; /**< X coordinate, relative to window */
462
+ float y; /**< Y coordinate, relative to window */
463
+ float xrel; /**< The relative motion in the X direction */
464
+ float yrel; /**< The relative motion in the Y direction */
465
+ } SDL_MouseMotionEvent;
466
+
467
+ /**
468
+ * Mouse button event structure (event.button.*)
469
+ *
470
+ * \since This struct is available since SDL 3.2.0.
471
+ */
472
+ typedef struct SDL_MouseButtonEvent
473
+ {
474
+ SDL_EventType type; /**< SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP */
475
+ Uint32 reserved;
476
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
477
+ SDL_WindowID windowID; /**< The window with mouse focus, if any */
478
+ SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */
479
+ Uint8 button; /**< The mouse button index */
480
+ bool down; /**< true if the button is pressed */
481
+ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
482
+ Uint8 padding;
483
+ float x; /**< X coordinate, relative to window */
484
+ float y; /**< Y coordinate, relative to window */
485
+ } SDL_MouseButtonEvent;
486
+
487
+ /**
488
+ * Mouse wheel event structure (event.wheel.*)
489
+ *
490
+ * \since This struct is available since SDL 3.2.0.
491
+ */
492
+ typedef struct SDL_MouseWheelEvent
493
+ {
494
+ SDL_EventType type; /**< SDL_EVENT_MOUSE_WHEEL */
495
+ Uint32 reserved;
496
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
497
+ SDL_WindowID windowID; /**< The window with mouse focus, if any */
498
+ SDL_MouseID which; /**< The mouse instance id in relative mode or 0 */
499
+ float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
500
+ float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
501
+ SDL_MouseWheelDirection 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 */
502
+ float mouse_x; /**< X coordinate, relative to window */
503
+ float mouse_y; /**< Y coordinate, relative to window */
504
+ Sint32 integer_x; /**< The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12) */
505
+ Sint32 integer_y; /**< The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12) */
506
+ } SDL_MouseWheelEvent;
507
+
508
+ /**
509
+ * Joystick axis motion event structure (event.jaxis.*)
510
+ *
511
+ * \since This struct is available since SDL 3.2.0.
512
+ */
513
+ typedef struct SDL_JoyAxisEvent
514
+ {
515
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */
516
+ Uint32 reserved;
517
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
518
+ SDL_JoystickID which; /**< The joystick instance id */
519
+ Uint8 axis; /**< The joystick axis index */
520
+ Uint8 padding1;
521
+ Uint8 padding2;
522
+ Uint8 padding3;
523
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
524
+ Uint16 padding4;
525
+ } SDL_JoyAxisEvent;
526
+
527
+ /**
528
+ * Joystick trackball motion event structure (event.jball.*)
529
+ *
530
+ * \since This struct is available since SDL 3.2.0.
531
+ */
532
+ typedef struct SDL_JoyBallEvent
533
+ {
534
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BALL_MOTION */
535
+ Uint32 reserved;
536
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
537
+ SDL_JoystickID which; /**< The joystick instance id */
538
+ Uint8 ball; /**< The joystick trackball index */
539
+ Uint8 padding1;
540
+ Uint8 padding2;
541
+ Uint8 padding3;
542
+ Sint16 xrel; /**< The relative motion in the X direction */
543
+ Sint16 yrel; /**< The relative motion in the Y direction */
544
+ } SDL_JoyBallEvent;
545
+
546
+ /**
547
+ * Joystick hat position change event structure (event.jhat.*)
548
+ *
549
+ * \since This struct is available since SDL 3.2.0.
550
+ */
551
+ typedef struct SDL_JoyHatEvent
552
+ {
553
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_HAT_MOTION */
554
+ Uint32 reserved;
555
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
556
+ SDL_JoystickID which; /**< The joystick instance id */
557
+ Uint8 hat; /**< The joystick hat index */
558
+ Uint8 value; /**< The hat position value.
559
+ * \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
560
+ * \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
561
+ * \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
562
+ *
563
+ * Note that zero means the POV is centered.
564
+ */
565
+ Uint8 padding1;
566
+ Uint8 padding2;
567
+ } SDL_JoyHatEvent;
568
+
569
+ /**
570
+ * Joystick button event structure (event.jbutton.*)
571
+ *
572
+ * \since This struct is available since SDL 3.2.0.
573
+ */
574
+ typedef struct SDL_JoyButtonEvent
575
+ {
576
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */
577
+ Uint32 reserved;
578
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
579
+ SDL_JoystickID which; /**< The joystick instance id */
580
+ Uint8 button; /**< The joystick button index */
581
+ bool down; /**< true if the button is pressed */
582
+ Uint8 padding1;
583
+ Uint8 padding2;
584
+ } SDL_JoyButtonEvent;
585
+
586
+ /**
587
+ * Joystick device event structure (event.jdevice.*)
588
+ *
589
+ * SDL will send JOYSTICK_ADDED events for devices that are already plugged in
590
+ * during SDL_Init.
591
+ *
592
+ * \since This struct is available since SDL 3.2.0.
593
+ *
594
+ * \sa SDL_GamepadDeviceEvent
595
+ */
596
+ typedef struct SDL_JoyDeviceEvent
597
+ {
598
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */
599
+ Uint32 reserved;
600
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
601
+ SDL_JoystickID which; /**< The joystick instance id */
602
+ } SDL_JoyDeviceEvent;
603
+
604
+ /**
605
+ * Joystick battery level change event structure (event.jbattery.*)
606
+ *
607
+ * \since This struct is available since SDL 3.2.0.
608
+ */
609
+ typedef struct SDL_JoyBatteryEvent
610
+ {
611
+ SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
612
+ Uint32 reserved;
613
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
614
+ SDL_JoystickID which; /**< The joystick instance id */
615
+ SDL_PowerState state; /**< The joystick battery state */
616
+ int percent; /**< The joystick battery percent charge remaining */
617
+ } SDL_JoyBatteryEvent;
618
+
619
+ /**
620
+ * Gamepad axis motion event structure (event.gaxis.*)
621
+ *
622
+ * \since This struct is available since SDL 3.2.0.
623
+ */
624
+ typedef struct SDL_GamepadAxisEvent
625
+ {
626
+ SDL_EventType type; /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */
627
+ Uint32 reserved;
628
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
629
+ SDL_JoystickID which; /**< The joystick instance id */
630
+ Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
631
+ Uint8 padding1;
632
+ Uint8 padding2;
633
+ Uint8 padding3;
634
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
635
+ Uint16 padding4;
636
+ } SDL_GamepadAxisEvent;
637
+
638
+
639
+ /**
640
+ * Gamepad button event structure (event.gbutton.*)
641
+ *
642
+ * \since This struct is available since SDL 3.2.0.
643
+ */
644
+ typedef struct SDL_GamepadButtonEvent
645
+ {
646
+ SDL_EventType type; /**< SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP */
647
+ Uint32 reserved;
648
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
649
+ SDL_JoystickID which; /**< The joystick instance id */
650
+ Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
651
+ bool down; /**< true if the button is pressed */
652
+ Uint8 padding1;
653
+ Uint8 padding2;
654
+ } SDL_GamepadButtonEvent;
655
+
656
+
657
+ /**
658
+ * Gamepad device event structure (event.gdevice.*)
659
+ *
660
+ * Joysticks that are supported gamepads receive both an SDL_JoyDeviceEvent
661
+ * and an SDL_GamepadDeviceEvent.
662
+ *
663
+ * SDL will send GAMEPAD_ADDED events for joysticks that are already plugged
664
+ * in during SDL_Init() and are recognized as gamepads. It will also send
665
+ * events for joysticks that get gamepad mappings at runtime.
666
+ *
667
+ * \since This struct is available since SDL 3.2.0.
668
+ *
669
+ * \sa SDL_JoyDeviceEvent
670
+ */
671
+ typedef struct SDL_GamepadDeviceEvent
672
+ {
673
+ SDL_EventType type; /**< SDL_EVENT_GAMEPAD_ADDED, SDL_EVENT_GAMEPAD_REMOVED, or SDL_EVENT_GAMEPAD_REMAPPED, SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED */
674
+ Uint32 reserved;
675
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
676
+ SDL_JoystickID which; /**< The joystick instance id */
677
+ } SDL_GamepadDeviceEvent;
678
+
679
+ /**
680
+ * Gamepad touchpad event structure (event.gtouchpad.*)
681
+ *
682
+ * \since This struct is available since SDL 3.2.0.
683
+ */
684
+ typedef struct SDL_GamepadTouchpadEvent
685
+ {
686
+ SDL_EventType type; /**< SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
687
+ Uint32 reserved;
688
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
689
+ SDL_JoystickID which; /**< The joystick instance id */
690
+ Sint32 touchpad; /**< The index of the touchpad */
691
+ Sint32 finger; /**< The index of the finger on the touchpad */
692
+ float x; /**< Normalized in the range 0...1 with 0 being on the left */
693
+ float y; /**< Normalized in the range 0...1 with 0 being at the top */
694
+ float pressure; /**< Normalized in the range 0...1 */
695
+ } SDL_GamepadTouchpadEvent;
696
+
697
+ /**
698
+ * Gamepad sensor event structure (event.gsensor.*)
699
+ *
700
+ * \since This struct is available since SDL 3.2.0.
701
+ */
702
+ typedef struct SDL_GamepadSensorEvent
703
+ {
704
+ SDL_EventType type; /**< SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
705
+ Uint32 reserved;
706
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
707
+ SDL_JoystickID which; /**< The joystick instance id */
708
+ Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */
709
+ float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
710
+ Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
711
+ } SDL_GamepadSensorEvent;
712
+
713
+ /**
714
+ * Audio device event structure (event.adevice.*)
715
+ *
716
+ * Note that SDL will send a SDL_EVENT_AUDIO_DEVICE_ADDED event for every
717
+ * device it discovers during initialization. After that, this event will only
718
+ * arrive when a device is hotplugged during the program's run.
719
+ *
720
+ * \since This struct is available since SDL 3.2.0.
721
+ */
722
+ typedef struct SDL_AudioDeviceEvent
723
+ {
724
+ SDL_EventType type; /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
725
+ Uint32 reserved;
726
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
727
+ SDL_AudioDeviceID which; /**< SDL_AudioDeviceID for the device being added or removed or changing */
728
+ bool recording; /**< false if a playback device, true if a recording device. */
729
+ Uint8 padding1;
730
+ Uint8 padding2;
731
+ Uint8 padding3;
732
+ } SDL_AudioDeviceEvent;
733
+
734
+ /**
735
+ * Camera device event structure (event.cdevice.*)
736
+ *
737
+ * \since This struct is available since SDL 3.2.0.
738
+ */
739
+ typedef struct SDL_CameraDeviceEvent
740
+ {
741
+ SDL_EventType type; /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */
742
+ Uint32 reserved;
743
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
744
+ SDL_CameraID which; /**< SDL_CameraID for the device being added or removed or changing */
745
+ } SDL_CameraDeviceEvent;
746
+
747
+
748
+ /**
749
+ * Renderer event structure (event.render.*)
750
+ *
751
+ * \since This struct is available since SDL 3.2.0.
752
+ */
753
+ typedef struct SDL_RenderEvent
754
+ {
755
+ SDL_EventType type; /**< SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST */
756
+ Uint32 reserved;
757
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
758
+ SDL_WindowID windowID; /**< The window containing the renderer in question. */
759
+ } SDL_RenderEvent;
760
+
761
+
762
+ /**
763
+ * Touch finger event structure (event.tfinger.*)
764
+ *
765
+ * Coordinates in this event are normalized. `x` and `y` are normalized to a
766
+ * range between 0.0f and 1.0f, relative to the window, so (0,0) is the top
767
+ * left and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are
768
+ * normalized in the ranges of -1.0f (traversed all the way from the bottom or
769
+ * right to all the way up or left) to 1.0f (traversed all the way from the
770
+ * top or left to all the way down or right).
771
+ *
772
+ * Note that while the coordinates are _normalized_, they are not _clamped_,
773
+ * which means in some circumstances you can get a value outside of this
774
+ * range. For example, a renderer using logical presentation might give a
775
+ * negative value when the touch is in the letterboxing. Some platforms might
776
+ * report a touch outside of the window, which will also be outside of the
777
+ * range.
778
+ *
779
+ * \since This struct is available since SDL 3.2.0.
780
+ */
781
+ typedef struct SDL_TouchFingerEvent
782
+ {
783
+ SDL_EventType type; /**< SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED */
784
+ Uint32 reserved;
785
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
786
+ SDL_TouchID touchID; /**< The touch device id */
787
+ SDL_FingerID fingerID;
788
+ float x; /**< Normalized in the range 0...1 */
789
+ float y; /**< Normalized in the range 0...1 */
790
+ float dx; /**< Normalized in the range -1...1 */
791
+ float dy; /**< Normalized in the range -1...1 */
792
+ float pressure; /**< Normalized in the range 0...1 */
793
+ SDL_WindowID windowID; /**< The window underneath the finger, if any */
794
+ } SDL_TouchFingerEvent;
795
+
796
+ /**
797
+ * Pinch event structure (event.pinch.*)
798
+ */
799
+ typedef struct SDL_PinchFingerEvent
800
+ {
801
+ SDL_EventType type; /**< ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END */
802
+ Uint32 reserved;
803
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
804
+ float scale; /**< The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in". */
805
+ SDL_WindowID windowID; /**< The window underneath the finger, if any */
806
+ } SDL_PinchFingerEvent;
807
+
808
+ /**
809
+ * Pressure-sensitive pen proximity event structure (event.pproximity.*)
810
+ *
811
+ * When a pen becomes visible to the system (it is close enough to a tablet,
812
+ * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's
813
+ * ID. This ID is valid until the pen leaves proximity again (has been removed
814
+ * from the tablet's area, the tablet has been unplugged, etc). If the same
815
+ * pen reenters proximity again, it will be given a new ID.
816
+ *
817
+ * Note that "proximity" means "close enough for the tablet to know the tool
818
+ * is there." The pen touching and lifting off from the tablet while not
819
+ * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP.
820
+ *
821
+ * Not all platforms have a window associated with the pen during proximity
822
+ * events. Some wait until motion/button/etc events to offer this info.
823
+ *
824
+ * \since This struct is available since SDL 3.2.0.
825
+ */
826
+ typedef struct SDL_PenProximityEvent
827
+ {
828
+ SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
829
+ Uint32 reserved;
830
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
831
+ SDL_WindowID windowID; /**< The window with pen focus, if any */
832
+ SDL_PenID which; /**< The pen instance id */
833
+ } SDL_PenProximityEvent;
834
+
835
+ /**
836
+ * Pressure-sensitive pen motion event structure (event.pmotion.*)
837
+ *
838
+ * Depending on the hardware, you may get motion events when the pen is not
839
+ * touching a tablet, for tracking a pen even when it isn't drawing. You
840
+ * should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check
841
+ * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when
842
+ * dealing with pen motion.
843
+ *
844
+ * \since This struct is available since SDL 3.2.0.
845
+ */
846
+ typedef struct SDL_PenMotionEvent
847
+ {
848
+ SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */
849
+ Uint32 reserved;
850
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
851
+ SDL_WindowID windowID; /**< The window with pen focus, if any */
852
+ SDL_PenID which; /**< The pen instance id */
853
+ SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
854
+ float x; /**< X coordinate, relative to window */
855
+ float y; /**< Y coordinate, relative to window */
856
+ } SDL_PenMotionEvent;
857
+
858
+ /**
859
+ * Pressure-sensitive pen touched event structure (event.ptouch.*)
860
+ *
861
+ * These events come when a pen touches a surface (a tablet, etc), or lifts
862
+ * off from one.
863
+ *
864
+ * \since This struct is available since SDL 3.2.0.
865
+ */
866
+ typedef struct SDL_PenTouchEvent
867
+ {
868
+ SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
869
+ Uint32 reserved;
870
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
871
+ SDL_WindowID windowID; /**< The window with pen focus, if any */
872
+ SDL_PenID which; /**< The pen instance id */
873
+ SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
874
+ float x; /**< X coordinate, relative to window */
875
+ float y; /**< Y coordinate, relative to window */
876
+ bool eraser; /**< true if eraser end is used (not all pens support this). */
877
+ bool down; /**< true if the pen is touching or false if the pen is lifted off */
878
+ } SDL_PenTouchEvent;
879
+
880
+ /**
881
+ * Pressure-sensitive pen button event structure (event.pbutton.*)
882
+ *
883
+ * This is for buttons on the pen itself that the user might click. The pen
884
+ * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead.
885
+ *
886
+ * \since This struct is available since SDL 3.2.0.
887
+ */
888
+ typedef struct SDL_PenButtonEvent
889
+ {
890
+ SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
891
+ Uint32 reserved;
892
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
893
+ SDL_WindowID windowID; /**< The window with mouse focus, if any */
894
+ SDL_PenID which; /**< The pen instance id */
895
+ SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
896
+ float x; /**< X coordinate, relative to window */
897
+ float y; /**< Y coordinate, relative to window */
898
+ Uint8 button; /**< The pen button index (first button is 1). */
899
+ bool down; /**< true if the button is pressed */
900
+ } SDL_PenButtonEvent;
901
+
902
+ /**
903
+ * Pressure-sensitive pen pressure / angle event structure (event.paxis.*)
904
+ *
905
+ * You might get some of these events even if the pen isn't touching the
906
+ * tablet.
907
+ *
908
+ * \since This struct is available since SDL 3.2.0.
909
+ */
910
+ typedef struct SDL_PenAxisEvent
911
+ {
912
+ SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */
913
+ Uint32 reserved;
914
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
915
+ SDL_WindowID windowID; /**< The window with pen focus, if any */
916
+ SDL_PenID which; /**< The pen instance id */
917
+ SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */
918
+ float x; /**< X coordinate, relative to window */
919
+ float y; /**< Y coordinate, relative to window */
920
+ SDL_PenAxis axis; /**< Axis that has changed */
921
+ float value; /**< New value of axis */
922
+ } SDL_PenAxisEvent;
923
+
924
+ /**
925
+ * An event used to drop text or request a file open by the system
926
+ * (event.drop.*)
927
+ *
928
+ * \since This struct is available since SDL 3.2.0.
929
+ */
930
+ typedef struct SDL_DropEvent
931
+ {
932
+ SDL_EventType type; /**< SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION */
933
+ Uint32 reserved;
934
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
935
+ SDL_WindowID windowID; /**< The window that was dropped on, if any */
936
+ float x; /**< X coordinate, relative to window (not on begin) */
937
+ float y; /**< Y coordinate, relative to window (not on begin) */
938
+ const char *source; /**< The source app that sent this drop event, or NULL if that isn't available */
939
+ const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
940
+ } SDL_DropEvent;
941
+
942
+ /**
943
+ * An event triggered when the clipboard contents have changed
944
+ * (event.clipboard.*)
945
+ *
946
+ * \since This struct is available since SDL 3.2.0.
947
+ */
948
+ typedef struct SDL_ClipboardEvent
949
+ {
950
+ SDL_EventType type; /**< SDL_EVENT_CLIPBOARD_UPDATE */
951
+ Uint32 reserved;
952
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
953
+ bool owner; /**< are we owning the clipboard (internal update) */
954
+ Sint32 num_mime_types; /**< number of mime types */
955
+ const char **mime_types; /**< current mime types */
956
+ } SDL_ClipboardEvent;
957
+
958
+ /**
959
+ * Sensor event structure (event.sensor.*)
960
+ *
961
+ * \since This struct is available since SDL 3.2.0.
962
+ */
963
+ typedef struct SDL_SensorEvent
964
+ {
965
+ SDL_EventType type; /**< SDL_EVENT_SENSOR_UPDATE */
966
+ Uint32 reserved;
967
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
968
+ SDL_SensorID which; /**< The instance ID of the sensor */
969
+ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
970
+ Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
971
+ } SDL_SensorEvent;
972
+
973
+ /**
974
+ * The "quit requested" event
975
+ *
976
+ * \since This struct is available since SDL 3.2.0.
977
+ */
978
+ typedef struct SDL_QuitEvent
979
+ {
980
+ SDL_EventType type; /**< SDL_EVENT_QUIT */
981
+ Uint32 reserved;
982
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
983
+ } SDL_QuitEvent;
984
+
985
+ /**
986
+ * A user-defined event type (event.user.*)
987
+ *
988
+ * This event is unique; it is never created by SDL, but only by the
989
+ * application. The event can be pushed onto the event queue using
990
+ * SDL_PushEvent(). The contents of the structure members are completely up to
991
+ * the programmer; the only requirement is that '''type''' is a value obtained
992
+ * from SDL_RegisterEvents().
993
+ *
994
+ * \since This struct is available since SDL 3.2.0.
995
+ */
996
+ typedef struct SDL_UserEvent
997
+ {
998
+ Uint32 type; /**< SDL_EVENT_USER through SDL_EVENT_LAST, Uint32 because these are not in the SDL_EventType enumeration */
999
+ Uint32 reserved;
1000
+ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
1001
+ SDL_WindowID windowID; /**< The associated window if any */
1002
+ Sint32 code; /**< User defined event code */
1003
+ void *data1; /**< User defined data pointer */
1004
+ void *data2; /**< User defined data pointer */
1005
+ } SDL_UserEvent;
1006
+
1007
+
1008
+ /**
1009
+ * The structure for all events in SDL.
1010
+ *
1011
+ * The SDL_Event structure is the core of all event handling in SDL. SDL_Event
1012
+ * is a union of all event structures used in SDL.
1013
+ *
1014
+ * \since This struct is available since SDL 3.2.0.
1015
+ */
1016
+ typedef union SDL_Event
1017
+ {
1018
+ Uint32 type; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
1019
+ SDL_CommonEvent common; /**< Common event data */
1020
+ SDL_DisplayEvent display; /**< Display event data */
1021
+ SDL_WindowEvent window; /**< Window event data */
1022
+ SDL_KeyboardDeviceEvent kdevice; /**< Keyboard device change event data */
1023
+ SDL_KeyboardEvent key; /**< Keyboard event data */
1024
+ SDL_TextEditingEvent edit; /**< Text editing event data */
1025
+ SDL_TextEditingCandidatesEvent edit_candidates; /**< Text editing candidates event data */
1026
+ SDL_TextInputEvent text; /**< Text input event data */
1027
+ SDL_MouseDeviceEvent mdevice; /**< Mouse device change event data */
1028
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
1029
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
1030
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
1031
+ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
1032
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
1033
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
1034
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
1035
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
1036
+ SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
1037
+ SDL_GamepadDeviceEvent gdevice; /**< Gamepad device event data */
1038
+ SDL_GamepadAxisEvent gaxis; /**< Gamepad axis event data */
1039
+ SDL_GamepadButtonEvent gbutton; /**< Gamepad button event data */
1040
+ SDL_GamepadTouchpadEvent gtouchpad; /**< Gamepad touchpad event data */
1041
+ SDL_GamepadSensorEvent gsensor; /**< Gamepad sensor event data */
1042
+ SDL_AudioDeviceEvent adevice; /**< Audio device event data */
1043
+ SDL_CameraDeviceEvent cdevice; /**< Camera device event data */
1044
+ SDL_SensorEvent sensor; /**< Sensor event data */
1045
+ SDL_QuitEvent quit; /**< Quit request event data */
1046
+ SDL_UserEvent user; /**< Custom event data */
1047
+ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
1048
+ SDL_PinchFingerEvent pinch; /**< Pinch event data */
1049
+ SDL_PenProximityEvent pproximity; /**< Pen proximity event data */
1050
+ SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */
1051
+ SDL_PenMotionEvent pmotion; /**< Pen motion event data */
1052
+ SDL_PenButtonEvent pbutton; /**< Pen button event data */
1053
+ SDL_PenAxisEvent paxis; /**< Pen axis event data */
1054
+ SDL_RenderEvent render; /**< Render event data */
1055
+ SDL_DropEvent drop; /**< Drag and drop event data */
1056
+ SDL_ClipboardEvent clipboard; /**< Clipboard event data */
1057
+
1058
+ /* This is necessary for ABI compatibility between Visual C++ and GCC.
1059
+ Visual C++ will respect the push pack pragma and use 52 bytes (size of
1060
+ SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit
1061
+ architectures) for this union, and GCC will use the alignment of the
1062
+ largest datatype within the union, which is 8 bytes on 64-bit
1063
+ architectures.
1064
+
1065
+ So... we'll add padding to force the size to be the same for both.
1066
+
1067
+ On architectures where pointers are 16 bytes, this needs rounding up to
1068
+ the next multiple of 16, 64, and on architectures where pointers are
1069
+ even larger the size of SDL_UserEvent will dominate as being 3 pointers.
1070
+ */
1071
+ Uint8 padding[128];
1072
+ } SDL_Event;
1073
+
1074
+ /* Make sure we haven't broken binary compatibility */
1075
+ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof((SDL_static_cast(SDL_Event *, NULL))->padding));
1076
+
1077
+
1078
+ /* Function prototypes */
1079
+
1080
+ /**
1081
+ * Pump the event loop, gathering events from the input devices.
1082
+ *
1083
+ * This function updates the event queue and internal input device state.
1084
+ *
1085
+ * SDL_PumpEvents() gathers all the pending input information from devices and
1086
+ * places it in the event queue. Without calls to SDL_PumpEvents() no events
1087
+ * would ever be placed on the queue. Often the need for calls to
1088
+ * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and
1089
+ * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not
1090
+ * polling or waiting for events (e.g. you are filtering them), then you must
1091
+ * call SDL_PumpEvents() to force an event queue update.
1092
+ *
1093
+ * \threadsafety This function should only be called on the main thread.
1094
+ *
1095
+ * \since This function is available since SDL 3.2.0.
1096
+ *
1097
+ * \sa SDL_PollEvent
1098
+ * \sa SDL_WaitEvent
1099
+ */
1100
+ extern SDL_DECLSPEC void SDLCALL SDL_PumpEvents(void);
1101
+
1102
+ /* @{ */
1103
+
1104
+ /**
1105
+ * The type of action to request from SDL_PeepEvents().
1106
+ *
1107
+ * \since This enum is available since SDL 3.2.0.
1108
+ */
1109
+ typedef enum SDL_EventAction
1110
+ {
1111
+ SDL_ADDEVENT, /**< Add events to the back of the queue. */
1112
+ SDL_PEEKEVENT, /**< Check but don't remove events from the queue front. */
1113
+ SDL_GETEVENT /**< Retrieve/remove events from the front of the queue. */
1114
+ } SDL_EventAction;
1115
+
1116
+ /**
1117
+ * Check the event queue for messages and optionally return them.
1118
+ *
1119
+ * `action` may be any of the following:
1120
+ *
1121
+ * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the
1122
+ * event queue.
1123
+ * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue,
1124
+ * within the specified minimum and maximum type, will be returned to the
1125
+ * caller and will _not_ be removed from the queue. If you pass NULL for
1126
+ * `events`, then `numevents` is ignored and the total number of matching
1127
+ * events will be returned.
1128
+ * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue,
1129
+ * within the specified minimum and maximum type, will be returned to the
1130
+ * caller and will be removed from the queue.
1131
+ *
1132
+ * You may have to call SDL_PumpEvents() before calling this function.
1133
+ * Otherwise, the events may not be ready to be filtered when you call
1134
+ * SDL_PeepEvents().
1135
+ *
1136
+ * \param events destination buffer for the retrieved events, may be NULL to
1137
+ * leave the events in the queue and return the number of events
1138
+ * that would have been stored.
1139
+ * \param numevents if action is SDL_ADDEVENT, the number of events to add
1140
+ * back to the event queue; if action is SDL_PEEKEVENT or
1141
+ * SDL_GETEVENT, the maximum number of events to retrieve.
1142
+ * \param action action to take; see [Remarks](#remarks) for details.
1143
+ * \param minType minimum value of the event type to be considered;
1144
+ * SDL_EVENT_FIRST is a safe choice.
1145
+ * \param maxType maximum value of the event type to be considered;
1146
+ * SDL_EVENT_LAST is a safe choice.
1147
+ * \returns the number of events actually stored or -1 on failure; call
1148
+ * SDL_GetError() for more information.
1149
+ *
1150
+ * \threadsafety It is safe to call this function from any thread.
1151
+ *
1152
+ * \since This function is available since SDL 3.2.0.
1153
+ *
1154
+ * \sa SDL_PollEvent
1155
+ * \sa SDL_PumpEvents
1156
+ * \sa SDL_PushEvent
1157
+ */
1158
+ extern SDL_DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType);
1159
+ /* @} */
1160
+
1161
+ /**
1162
+ * Check for the existence of a certain event type in the event queue.
1163
+ *
1164
+ * If you need to check for a range of event types, use SDL_HasEvents()
1165
+ * instead.
1166
+ *
1167
+ * \param type the type of event to be queried; see SDL_EventType for details.
1168
+ * \returns true if events matching `type` are present, or false if events
1169
+ * matching `type` are not present.
1170
+ *
1171
+ * \threadsafety It is safe to call this function from any thread.
1172
+ *
1173
+ * \since This function is available since SDL 3.2.0.
1174
+ *
1175
+ * \sa SDL_HasEvents
1176
+ */
1177
+ extern SDL_DECLSPEC bool SDLCALL SDL_HasEvent(Uint32 type);
1178
+
1179
+
1180
+ /**
1181
+ * Check for the existence of certain event types in the event queue.
1182
+ *
1183
+ * If you need to check for a single event type, use SDL_HasEvent() instead.
1184
+ *
1185
+ * \param minType the low end of event type to be queried, inclusive; see
1186
+ * SDL_EventType for details.
1187
+ * \param maxType the high end of event type to be queried, inclusive; see
1188
+ * SDL_EventType for details.
1189
+ * \returns true if events with type >= `minType` and <= `maxType` are
1190
+ * present, or false if not.
1191
+ *
1192
+ * \threadsafety It is safe to call this function from any thread.
1193
+ *
1194
+ * \since This function is available since SDL 3.2.0.
1195
+ *
1196
+ * \sa SDL_HasEvents
1197
+ */
1198
+ extern SDL_DECLSPEC bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
1199
+
1200
+ /**
1201
+ * Clear events of a specific type from the event queue.
1202
+ *
1203
+ * This will unconditionally remove any events from the queue that match
1204
+ * `type`. If you need to remove a range of event types, use SDL_FlushEvents()
1205
+ * instead.
1206
+ *
1207
+ * It's also normal to just ignore events you don't care about in your event
1208
+ * loop without calling this function.
1209
+ *
1210
+ * This function only affects currently queued events. If you want to make
1211
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1212
+ * on the main thread immediately before the flush call.
1213
+ *
1214
+ * If you have user events with custom data that needs to be freed, you should
1215
+ * use SDL_PeepEvents() to remove and clean up those events before calling
1216
+ * this function.
1217
+ *
1218
+ * \param type the type of event to be cleared; see SDL_EventType for details.
1219
+ *
1220
+ * \threadsafety It is safe to call this function from any thread.
1221
+ *
1222
+ * \since This function is available since SDL 3.2.0.
1223
+ *
1224
+ * \sa SDL_FlushEvents
1225
+ */
1226
+ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
1227
+
1228
+ /**
1229
+ * Clear events of a range of types from the event queue.
1230
+ *
1231
+ * This will unconditionally remove any events from the queue that are in the
1232
+ * range of `minType` to `maxType`, inclusive. If you need to remove a single
1233
+ * event type, use SDL_FlushEvent() instead.
1234
+ *
1235
+ * It's also normal to just ignore events you don't care about in your event
1236
+ * loop without calling this function.
1237
+ *
1238
+ * This function only affects currently queued events. If you want to make
1239
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
1240
+ * on the main thread immediately before the flush call.
1241
+ *
1242
+ * \param minType the low end of event type to be cleared, inclusive; see
1243
+ * SDL_EventType for details.
1244
+ * \param maxType the high end of event type to be cleared, inclusive; see
1245
+ * SDL_EventType for details.
1246
+ *
1247
+ * \threadsafety It is safe to call this function from any thread.
1248
+ *
1249
+ * \since This function is available since SDL 3.2.0.
1250
+ *
1251
+ * \sa SDL_FlushEvent
1252
+ */
1253
+ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
1254
+
1255
+ /**
1256
+ * Poll for currently pending events.
1257
+ *
1258
+ * If `event` is not NULL, the next event is removed from the queue and stored
1259
+ * in the SDL_Event structure pointed to by `event`.
1260
+ *
1261
+ * If `event` is NULL, it simply returns true if there is an event in the
1262
+ * queue, but will not remove it from the queue.
1263
+ *
1264
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
1265
+ * this function in the thread that initialized the video subsystem.
1266
+ *
1267
+ * SDL_PollEvent() is the favored way of receiving system events since it can
1268
+ * be done from the main loop and does not suspend the main loop while waiting
1269
+ * on an event to be posted.
1270
+ *
1271
+ * The common practice is to fully process the event queue once every frame,
1272
+ * usually as a first step before updating the game's state:
1273
+ *
1274
+ * ```c
1275
+ * while (game_is_still_running) {
1276
+ * SDL_Event event;
1277
+ * while (SDL_PollEvent(&event)) { // poll until all events are handled!
1278
+ * // decide what to do with this event.
1279
+ * }
1280
+ *
1281
+ * // update game state, draw the current frame
1282
+ * }
1283
+ * ```
1284
+ *
1285
+ * Note that Windows (and possibly other platforms) has a quirk about how it
1286
+ * handles events while dragging/resizing a window, which can cause this
1287
+ * function to block for significant amounts of time. Technical explanations
1288
+ * and solutions are discussed on the wiki:
1289
+ *
1290
+ * https://wiki.libsdl.org/SDL3/AppFreezeDuringDrag
1291
+ *
1292
+ * \param event the SDL_Event structure to be filled with the next event from
1293
+ * the queue, or NULL.
1294
+ * \returns true if this got an event or false if there are none available.
1295
+ *
1296
+ * \threadsafety This function should only be called on the main thread.
1297
+ *
1298
+ * \since This function is available since SDL 3.2.0.
1299
+ *
1300
+ * \sa SDL_PushEvent
1301
+ * \sa SDL_WaitEvent
1302
+ * \sa SDL_WaitEventTimeout
1303
+ */
1304
+ extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event);
1305
+
1306
+ /**
1307
+ * Wait indefinitely for the next available event.
1308
+ *
1309
+ * If `event` is not NULL, the next event is removed from the queue and stored
1310
+ * in the SDL_Event structure pointed to by `event`.
1311
+ *
1312
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
1313
+ * this function in the thread that initialized the video subsystem.
1314
+ *
1315
+ * \param event the SDL_Event structure to be filled in with the next event
1316
+ * from the queue, or NULL.
1317
+ * \returns true on success or false if there was an error while waiting for
1318
+ * events; call SDL_GetError() for more information.
1319
+ *
1320
+ * \threadsafety This function should only be called on the main thread.
1321
+ *
1322
+ * \since This function is available since SDL 3.2.0.
1323
+ *
1324
+ * \sa SDL_PollEvent
1325
+ * \sa SDL_PushEvent
1326
+ * \sa SDL_WaitEventTimeout
1327
+ */
1328
+ extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event);
1329
+
1330
+ /**
1331
+ * Wait until the specified timeout (in milliseconds) for the next available
1332
+ * event.
1333
+ *
1334
+ * If `event` is not NULL, the next event is removed from the queue and stored
1335
+ * in the SDL_Event structure pointed to by `event`.
1336
+ *
1337
+ * As this function may implicitly call SDL_PumpEvents(), you can only call
1338
+ * this function in the thread that initialized the video subsystem.
1339
+ *
1340
+ * The timeout is not guaranteed, the actual wait time could be longer due to
1341
+ * system scheduling.
1342
+ *
1343
+ * \param event the SDL_Event structure to be filled in with the next event
1344
+ * from the queue, or NULL.
1345
+ * \param timeoutMS the maximum number of milliseconds to wait for the next
1346
+ * available event.
1347
+ * \returns true if this got an event or false if the timeout elapsed without
1348
+ * any events available.
1349
+ *
1350
+ * \threadsafety This function should only be called on the main thread.
1351
+ *
1352
+ * \since This function is available since SDL 3.2.0.
1353
+ *
1354
+ * \sa SDL_PollEvent
1355
+ * \sa SDL_PushEvent
1356
+ * \sa SDL_WaitEvent
1357
+ */
1358
+ extern SDL_DECLSPEC bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS);
1359
+
1360
+ /**
1361
+ * Add an event to the event queue.
1362
+ *
1363
+ * The event queue can actually be used as a two way communication channel.
1364
+ * Not only can events be read from the queue, but the user can also push
1365
+ * their own events onto it. `event` is a pointer to the event structure you
1366
+ * wish to push onto the queue. The event is copied into the queue, and the
1367
+ * caller may dispose of the memory pointed to after SDL_PushEvent() returns.
1368
+ *
1369
+ * Note: Pushing device input events onto the queue doesn't modify the state
1370
+ * of the device within SDL.
1371
+ *
1372
+ * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1373
+ * the event filter but events added with SDL_PeepEvents() do not.
1374
+ *
1375
+ * For pushing application-specific events, please use SDL_RegisterEvents() to
1376
+ * get an event type that does not conflict with other code that also wants
1377
+ * its own custom event types.
1378
+ *
1379
+ * \param event the SDL_Event to be added to the queue.
1380
+ * \returns true on success, false if the event was filtered or on failure;
1381
+ * call SDL_GetError() for more information. A common reason for
1382
+ * error is the event queue being full.
1383
+ *
1384
+ * \threadsafety It is safe to call this function from any thread.
1385
+ *
1386
+ * \since This function is available since SDL 3.2.0.
1387
+ *
1388
+ * \sa SDL_PeepEvents
1389
+ * \sa SDL_PollEvent
1390
+ * \sa SDL_RegisterEvents
1391
+ */
1392
+ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event);
1393
+
1394
+ /**
1395
+ * A function pointer used for callbacks that watch the event queue.
1396
+ *
1397
+ * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or
1398
+ * SDL_AddEventWatch, etc.
1399
+ * \param event the event that triggered the callback.
1400
+ * \returns true to permit event to be added to the queue, and false to
1401
+ * disallow it. When used with SDL_AddEventWatch, the return value is
1402
+ * ignored.
1403
+ *
1404
+ * \threadsafety SDL may call this callback at any time from any thread; the
1405
+ * application is responsible for locking resources the callback
1406
+ * touches that need to be protected.
1407
+ *
1408
+ * \since This datatype is available since SDL 3.2.0.
1409
+ *
1410
+ * \sa SDL_SetEventFilter
1411
+ * \sa SDL_AddEventWatch
1412
+ */
1413
+ typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
1414
+
1415
+ /**
1416
+ * Set up a filter to process all events before they are added to the internal
1417
+ * event queue.
1418
+ *
1419
+ * If you just want to see events without modifying them or preventing them
1420
+ * from being queued, you should use SDL_AddEventWatch() instead.
1421
+ *
1422
+ * If the filter function returns true when called, then the event will be
1423
+ * added to the internal queue. If it returns false, then the event will be
1424
+ * dropped from the queue, but the internal state will still be updated. This
1425
+ * allows selective filtering of dynamically arriving events.
1426
+ *
1427
+ * **WARNING**: Be very careful of what you do in the event filter function,
1428
+ * as it may run in a different thread! The exception is handling of
1429
+ * SDL_EVENT_WINDOW_EXPOSED, which is guaranteed to be sent from the OS on the
1430
+ * main thread and you are expected to redraw your window in response to this
1431
+ * event.
1432
+ *
1433
+ * On platforms that support it, if the quit event is generated by an
1434
+ * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
1435
+ * application at the next event poll.
1436
+ *
1437
+ * Note: Disabled events never make it to the event filter function; see
1438
+ * SDL_SetEventEnabled().
1439
+ *
1440
+ * Note: Events pushed onto the queue with SDL_PushEvent() get passed through
1441
+ * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
1442
+ * not.
1443
+ *
1444
+ * \param filter a function to call when an event happens.
1445
+ * \param userdata a pointer that is passed to `filter`.
1446
+ *
1447
+ * \threadsafety It is safe to call this function from any thread.
1448
+ *
1449
+ * \since This function is available since SDL 3.2.0.
1450
+ *
1451
+ * \sa SDL_AddEventWatch
1452
+ * \sa SDL_SetEventEnabled
1453
+ * \sa SDL_GetEventFilter
1454
+ * \sa SDL_PeepEvents
1455
+ * \sa SDL_PushEvent
1456
+ */
1457
+ extern SDL_DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata);
1458
+
1459
+ /**
1460
+ * Query the current event filter.
1461
+ *
1462
+ * This function can be used to "chain" filters, by saving the existing filter
1463
+ * before replacing it with a function that will call that saved filter.
1464
+ *
1465
+ * \param filter the current callback function will be stored here.
1466
+ * \param userdata the pointer that is passed to the current event filter will
1467
+ * be stored here.
1468
+ * \returns true on success or false if there is no event filter set.
1469
+ *
1470
+ * \threadsafety It is safe to call this function from any thread.
1471
+ *
1472
+ * \since This function is available since SDL 3.2.0.
1473
+ *
1474
+ * \sa SDL_SetEventFilter
1475
+ */
1476
+ extern SDL_DECLSPEC bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata);
1477
+
1478
+ /**
1479
+ * Add a callback to be triggered when an event is added to the event queue.
1480
+ *
1481
+ * `filter` will be called when an event happens, and its return value is
1482
+ * ignored.
1483
+ *
1484
+ * **WARNING**: Be very careful of what you do in the event filter function,
1485
+ * as it may run in a different thread!
1486
+ *
1487
+ * If the quit event is generated by a signal (e.g. SIGINT), it will bypass
1488
+ * the internal queue and be delivered to the watch callback immediately, and
1489
+ * arrive at the next event poll.
1490
+ *
1491
+ * Note: the callback is called for events posted by the user through
1492
+ * SDL_PushEvent(), but not for disabled events, nor for events by a filter
1493
+ * callback set with SDL_SetEventFilter(), nor for events posted by the user
1494
+ * through SDL_PeepEvents().
1495
+ *
1496
+ * \param filter an SDL_EventFilter function to call when an event happens.
1497
+ * \param userdata a pointer that is passed to `filter`.
1498
+ * \returns true on success or false on failure; call SDL_GetError() for more
1499
+ * information.
1500
+ *
1501
+ * \threadsafety It is safe to call this function from any thread.
1502
+ *
1503
+ * \since This function is available since SDL 3.2.0.
1504
+ *
1505
+ * \sa SDL_RemoveEventWatch
1506
+ * \sa SDL_SetEventFilter
1507
+ */
1508
+ extern SDL_DECLSPEC bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata);
1509
+
1510
+ /**
1511
+ * Remove an event watch callback added with SDL_AddEventWatch().
1512
+ *
1513
+ * This function takes the same input as SDL_AddEventWatch() to identify and
1514
+ * delete the corresponding callback.
1515
+ *
1516
+ * \param filter the function originally passed to SDL_AddEventWatch().
1517
+ * \param userdata the pointer originally passed to SDL_AddEventWatch().
1518
+ *
1519
+ * \threadsafety It is safe to call this function from any thread.
1520
+ *
1521
+ * \since This function is available since SDL 3.2.0.
1522
+ *
1523
+ * \sa SDL_AddEventWatch
1524
+ */
1525
+ extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);
1526
+
1527
+ /**
1528
+ * Run a specific filter function on the current event queue, removing any
1529
+ * events for which the filter returns false.
1530
+ *
1531
+ * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(),
1532
+ * this function does not change the filter permanently, it only uses the
1533
+ * supplied filter until this function returns.
1534
+ *
1535
+ * \param filter the SDL_EventFilter function to call when an event happens.
1536
+ * \param userdata a pointer that is passed to `filter`.
1537
+ *
1538
+ * \threadsafety It is safe to call this function from any thread.
1539
+ *
1540
+ * \since This function is available since SDL 3.2.0.
1541
+ *
1542
+ * \sa SDL_GetEventFilter
1543
+ * \sa SDL_SetEventFilter
1544
+ */
1545
+ extern SDL_DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata);
1546
+
1547
+ /**
1548
+ * Set the state of processing events by type.
1549
+ *
1550
+ * \param type the type of event; see SDL_EventType for details.
1551
+ * \param enabled whether to process the event or not.
1552
+ *
1553
+ * \threadsafety It is safe to call this function from any thread.
1554
+ *
1555
+ * \since This function is available since SDL 3.2.0.
1556
+ *
1557
+ * \sa SDL_EventEnabled
1558
+ */
1559
+ extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, bool enabled);
1560
+
1561
+ /**
1562
+ * Query the state of processing events by type.
1563
+ *
1564
+ * \param type the type of event; see SDL_EventType for details.
1565
+ * \returns true if the event is being processed, false otherwise.
1566
+ *
1567
+ * \threadsafety It is safe to call this function from any thread.
1568
+ *
1569
+ * \since This function is available since SDL 3.2.0.
1570
+ *
1571
+ * \sa SDL_SetEventEnabled
1572
+ */
1573
+ extern SDL_DECLSPEC bool SDLCALL SDL_EventEnabled(Uint32 type);
1574
+
1575
+ /**
1576
+ * Allocate a set of user-defined events, and return the beginning event
1577
+ * number for that set of events.
1578
+ *
1579
+ * \param numevents the number of events to be allocated.
1580
+ * \returns the beginning event number, or 0 if numevents is invalid or if
1581
+ * there are not enough user-defined events left.
1582
+ *
1583
+ * \threadsafety It is safe to call this function from any thread.
1584
+ *
1585
+ * \since This function is available since SDL 3.2.0.
1586
+ *
1587
+ * \sa SDL_PushEvent
1588
+ */
1589
+ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
1590
+
1591
+ /**
1592
+ * Get window associated with an event.
1593
+ *
1594
+ * \param event an event containing a `windowID`.
1595
+ * \returns the associated window on success or NULL if there is none.
1596
+ *
1597
+ * \threadsafety It is safe to call this function from any thread.
1598
+ *
1599
+ * \since This function is available since SDL 3.2.0.
1600
+ *
1601
+ * \sa SDL_PollEvent
1602
+ * \sa SDL_WaitEvent
1603
+ * \sa SDL_WaitEventTimeout
1604
+ */
1605
+ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromEvent(const SDL_Event *event);
1606
+
1607
+ /**
1608
+ * Generate an English description of an event.
1609
+ *
1610
+ * This will fill `buf` with a null-terminated string that might look
1611
+ * something like this:
1612
+ *
1613
+ * ```
1614
+ * SDL_EVENT_MOUSE_MOTION (timestamp=1140256324 windowid=2 which=0 state=0 x=492.99 y=139.09 xrel=52 yrel=6)
1615
+ * ```
1616
+ *
1617
+ * The exact format of the string is not guaranteed; it is intended for
1618
+ * logging purposes, to be read by a human, and not parsed by a computer.
1619
+ *
1620
+ * The returned value follows the same rules as SDL_snprintf(): `buf` will
1621
+ * always be NULL-terminated (unless `buflen` is zero), and will be truncated
1622
+ * if `buflen` is too small. The return code is the number of bytes needed for
1623
+ * the complete string, not counting the NULL-terminator, whether the string
1624
+ * was truncated or not. Unlike SDL_snprintf(), though, this function never
1625
+ * returns -1.
1626
+ *
1627
+ * \param event an event to describe. May be NULL.
1628
+ * \param buf the buffer to fill with the description string. May be NULL.
1629
+ * \param buflen the maximum bytes that can be written to `buf`.
1630
+ * \returns number of bytes needed for the full string, not counting the
1631
+ * null-terminator byte.
1632
+ *
1633
+ * \threadsafety It is safe to call this function from any thread.
1634
+ *
1635
+ * \since This function is available since SDL 3.4.0.
1636
+ */
1637
+ extern SDL_DECLSPEC int SDLCALL SDL_GetEventDescription(const SDL_Event *event, char *buf, int buflen);
1638
+
1639
+ /* Ends C function definitions when using C++ */
1640
+ #ifdef __cplusplus
1641
+ }
1642
+ #endif
1643
+ #include <SDL3/SDL_close_code.h>
1644
+
1645
+ #endif /* SDL_events_h_ */