ruby2d 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/SDL2/SDL.h +108 -14
  3. data/assets/include/SDL2/SDL_assert.h +81 -50
  4. data/assets/include/SDL2/SDL_atomic.h +135 -35
  5. data/assets/include/SDL2/SDL_audio.h +960 -355
  6. data/assets/include/SDL2/SDL_bits.h +11 -6
  7. data/assets/include/SDL2/SDL_blendmode.h +91 -14
  8. data/assets/include/SDL2/SDL_clipboard.h +30 -7
  9. data/assets/include/SDL2/SDL_config.h +3 -1
  10. data/assets/include/SDL2/SDL_config_android.h +11 -1
  11. data/assets/include/SDL2/SDL_config_emscripten.h +216 -0
  12. data/assets/include/SDL2/SDL_config_iphoneos.h +9 -1
  13. data/assets/include/SDL2/SDL_config_macosx.h +16 -2
  14. data/assets/include/SDL2/SDL_config_minimal.h +4 -1
  15. data/assets/include/SDL2/SDL_config_os2.h +37 -20
  16. data/assets/include/SDL2/SDL_config_pandora.h +6 -1
  17. data/assets/include/SDL2/SDL_config_psp.h +8 -8
  18. data/assets/include/SDL2/SDL_config_windows.h +39 -22
  19. data/assets/include/SDL2/SDL_config_winrt.h +23 -8
  20. data/assets/include/SDL2/SDL_config_wiz.h +6 -1
  21. data/assets/include/SDL2/SDL_copying.h +1 -1
  22. data/assets/include/SDL2/SDL_cpuinfo.h +331 -71
  23. data/assets/include/SDL2/SDL_egl.h +906 -280
  24. data/assets/include/SDL2/SDL_endian.h +101 -47
  25. data/assets/include/SDL2/SDL_error.h +70 -19
  26. data/assets/include/SDL2/SDL_events.h +387 -79
  27. data/assets/include/SDL2/SDL_filesystem.h +73 -64
  28. data/assets/include/SDL2/SDL_gamecontroller.h +585 -125
  29. data/assets/include/SDL2/SDL_gesture.h +36 -6
  30. data/assets/include/SDL2/SDL_haptic.h +304 -210
  31. data/assets/include/SDL2/SDL_hidapi.h +451 -0
  32. data/assets/include/SDL2/SDL_hints.h +1286 -897
  33. data/assets/include/SDL2/SDL_joystick.h +577 -130
  34. data/assets/include/SDL2/SDL_keyboard.h +162 -63
  35. data/assets/include/SDL2/SDL_keycode.h +7 -5
  36. data/assets/include/SDL2/SDL_loadso.h +42 -8
  37. data/assets/include/SDL2/SDL_locale.h +34 -32
  38. data/assets/include/SDL2/SDL_log.h +212 -19
  39. data/assets/include/SDL2/SDL_main.h +72 -17
  40. data/assets/include/SDL2/SDL_messagebox.h +70 -23
  41. data/assets/include/SDL2/SDL_metal.h +27 -32
  42. data/assets/include/SDL2/SDL_misc.h +19 -15
  43. data/assets/include/SDL2/SDL_mouse.h +262 -110
  44. data/assets/include/SDL2/SDL_mutex.h +286 -66
  45. data/assets/include/SDL2/SDL_name.h +1 -1
  46. data/assets/include/SDL2/SDL_opengl.h +1 -1
  47. data/assets/include/SDL2/SDL_opengles.h +1 -1
  48. data/assets/include/SDL2/SDL_opengles2.h +2 -2
  49. data/assets/include/SDL2/SDL_pixels.h +199 -34
  50. data/assets/include/SDL2/SDL_platform.h +39 -2
  51. data/assets/include/SDL2/SDL_power.h +23 -10
  52. data/assets/include/SDL2/SDL_quit.h +1 -1
  53. data/assets/include/SDL2/SDL_rect.h +78 -28
  54. data/assets/include/SDL2/SDL_render.h +1204 -472
  55. data/assets/include/SDL2/SDL_revision.h +2 -2
  56. data/assets/include/SDL2/SDL_rwops.h +605 -33
  57. data/assets/include/SDL2/SDL_scancode.h +1 -1
  58. data/assets/include/SDL2/SDL_sensor.h +76 -42
  59. data/assets/include/SDL2/SDL_shape.h +38 -27
  60. data/assets/include/SDL2/SDL_stdinc.h +96 -24
  61. data/assets/include/SDL2/SDL_surface.h +571 -139
  62. data/assets/include/SDL2/SDL_system.h +339 -101
  63. data/assets/include/SDL2/SDL_syswm.h +50 -20
  64. data/assets/include/SDL2/SDL_test.h +1 -1
  65. data/assets/include/SDL2/SDL_test_assert.h +2 -2
  66. data/assets/include/SDL2/SDL_test_common.h +23 -6
  67. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  68. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  69. data/assets/include/SDL2/SDL_test_font.h +3 -3
  70. data/assets/include/SDL2/SDL_test_fuzzer.h +28 -26
  71. data/assets/include/SDL2/SDL_test_harness.h +6 -6
  72. data/assets/include/SDL2/SDL_test_images.h +1 -1
  73. data/assets/include/SDL2/SDL_test_log.h +1 -1
  74. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  75. data/assets/include/SDL2/SDL_test_memory.h +1 -1
  76. data/assets/include/SDL2/SDL_test_random.h +2 -2
  77. data/assets/include/SDL2/SDL_thread.h +226 -128
  78. data/assets/include/SDL2/SDL_timer.h +129 -22
  79. data/assets/include/SDL2/SDL_touch.h +48 -8
  80. data/assets/include/SDL2/SDL_ttf.h +102 -9
  81. data/assets/include/SDL2/SDL_types.h +1 -1
  82. data/assets/include/SDL2/SDL_version.h +72 -46
  83. data/assets/include/SDL2/SDL_video.h +1266 -460
  84. data/assets/include/SDL2/SDL_vulkan.h +100 -161
  85. data/assets/include/SDL2/begin_code.h +22 -1
  86. data/assets/include/SDL2/close_code.h +1 -1
  87. data/assets/include/mrbconf.h +234 -0
  88. data/assets/include/mruby/array.h +317 -0
  89. data/assets/include/mruby/boxing_nan.h +130 -0
  90. data/assets/include/mruby/boxing_no.h +58 -0
  91. data/assets/include/mruby/boxing_word.h +205 -0
  92. data/assets/include/mruby/class.h +108 -0
  93. data/assets/include/mruby/common.h +92 -0
  94. data/assets/include/mruby/compile.h +210 -0
  95. data/assets/include/mruby/data.h +76 -0
  96. data/assets/include/mruby/debug.h +66 -0
  97. data/assets/include/mruby/dump.h +158 -0
  98. data/assets/include/mruby/endian.h +44 -0
  99. data/assets/include/mruby/error.h +137 -0
  100. data/assets/include/mruby/gc.h +92 -0
  101. data/assets/include/mruby/hash.h +242 -0
  102. data/assets/include/mruby/irep.h +147 -0
  103. data/assets/include/mruby/istruct.h +50 -0
  104. data/assets/include/mruby/khash.h +284 -0
  105. data/assets/include/mruby/numeric.h +169 -0
  106. data/assets/include/mruby/object.h +43 -0
  107. data/assets/include/mruby/opcode.h +43 -0
  108. data/assets/include/mruby/ops.h +122 -0
  109. data/assets/include/mruby/presym/disable.h +70 -0
  110. data/assets/include/mruby/presym/enable.h +37 -0
  111. data/assets/include/mruby/presym/scanning.h +73 -0
  112. data/assets/include/mruby/presym.h +40 -0
  113. data/assets/include/mruby/proc.h +209 -0
  114. data/assets/include/mruby/range.h +79 -0
  115. data/assets/include/mruby/re.h +16 -0
  116. data/assets/include/mruby/string.h +469 -0
  117. data/assets/include/mruby/throw.h +66 -0
  118. data/assets/include/mruby/value.h +400 -0
  119. data/assets/include/mruby/variable.h +140 -0
  120. data/assets/include/mruby/version.h +143 -0
  121. data/assets/include/mruby.h +1444 -0
  122. data/assets/macos/universal/bin/mrbc +0 -0
  123. data/assets/macos/universal/lib/libFLAC.a +0 -0
  124. data/assets/macos/universal/lib/libSDL2.a +0 -0
  125. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  126. data/assets/macos/{lib → universal/lib}/libSDL2_mixer.a +0 -0
  127. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  128. data/assets/macos/universal/lib/libfreetype.a +0 -0
  129. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  130. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  131. data/assets/macos/universal/lib/libjpeg.a +0 -0
  132. data/assets/macos/{lib → universal/lib}/libmodplug.a +0 -0
  133. data/assets/macos/{lib → universal/lib}/libmpg123.a +0 -0
  134. data/assets/{mingw/lib/libSDL2.a → macos/universal/lib/libmruby.a} +0 -0
  135. data/assets/macos/{lib → universal/lib}/libogg.a +0 -0
  136. data/assets/macos/universal/lib/libpng16.a +0 -0
  137. data/assets/macos/universal/lib/libtiff.a +0 -0
  138. data/assets/macos/universal/lib/libvorbis.a +0 -0
  139. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  140. data/assets/macos/universal/lib/libwebp.a +0 -0
  141. data/assets/test_media/README.md +3 -0
  142. data/assets/test_media/bitstream_vera/COPYRIGHT.txt +124 -0
  143. data/assets/test_media/bitstream_vera/vera.ttf +0 -0
  144. data/assets/test_media/boom.png +0 -0
  145. data/assets/test_media/coin.png +0 -0
  146. data/assets/test_media/colors.png +0 -0
  147. data/assets/test_media/controller.png +0 -0
  148. data/assets/test_media/dial.wav +0 -0
  149. data/assets/test_media/hero.png +0 -0
  150. data/assets/test_media/image.bmp +0 -0
  151. data/assets/test_media/image.jpg +0 -0
  152. data/assets/test_media/image.png +0 -0
  153. data/assets/test_media/music.flac +0 -0
  154. data/assets/test_media/music.mp3 +0 -0
  155. data/assets/test_media/music.ogg +0 -0
  156. data/assets/test_media/music.wav +0 -0
  157. data/assets/test_media/originals/boom.pxm +0 -0
  158. data/assets/test_media/originals/coin.pxm +0 -0
  159. data/assets/test_media/originals/controller.sketch +0 -0
  160. data/assets/test_media/originals/hero.pxm +0 -0
  161. data/assets/test_media/originals/image.pxm +0 -0
  162. data/assets/test_media/originals/music.caf +0 -0
  163. data/assets/test_media/originals/texture_atlas.pxm +0 -0
  164. data/assets/test_media/rondo_alla_turka.ogg +0 -0
  165. data/assets/test_media/sound.flac +0 -0
  166. data/assets/test_media/sound.mp3 +0 -0
  167. data/assets/test_media/sound.ogg +0 -0
  168. data/assets/test_media/sound.wav +0 -0
  169. data/assets/test_media/sprite_sheet.png +0 -0
  170. data/assets/test_media/texture_atlas.png +0 -0
  171. data/assets/wasm/build_config.rb +13 -0
  172. data/assets/wasm/libmruby.a +0 -0
  173. data/assets/wasm/template.html +17 -0
  174. data/assets/windows/glew/README.md +10 -0
  175. data/assets/windows/glew/glew.h +23686 -0
  176. data/assets/{mingw/lib → windows/glew}/libglew32.a +0 -0
  177. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  178. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  179. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  180. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  181. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  182. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  183. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  184. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  185. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  186. data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
  187. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  188. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  189. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  190. data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
  191. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  192. data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
  193. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  194. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  195. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  196. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  197. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  198. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  199. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  200. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  201. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  202. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  203. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  204. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  205. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  206. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  207. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  208. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  209. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  210. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  211. data/assets/{ios → xcode/ios}/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  212. data/assets/{ios → xcode/ios}/Assets.xcassets/Contents.json +0 -0
  213. data/assets/{ios → xcode/ios}/Base.lproj/LaunchScreen.storyboard +0 -0
  214. data/assets/{ios → xcode/ios}/Info.plist +0 -0
  215. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mrbconf.h +0 -0
  216. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/array.h +0 -0
  217. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  218. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  219. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  220. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/class.h +0 -0
  221. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/common.h +0 -0
  222. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/compile.h +0 -0
  223. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/data.h +0 -0
  224. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/debug.h +0 -0
  225. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/dump.h +0 -0
  226. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/error.h +0 -0
  227. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/gc.h +0 -0
  228. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/hash.h +0 -0
  229. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/irep.h +0 -0
  230. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  231. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/khash.h +0 -0
  232. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  233. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/object.h +0 -0
  234. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  235. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/ops.h +0 -0
  236. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/proc.h +0 -0
  237. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/range.h +0 -0
  238. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/re.h +0 -0
  239. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/string.h +0 -0
  240. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/throw.h +0 -0
  241. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/value.h +0 -0
  242. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/variable.h +0 -0
  243. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/version.h +0 -0
  244. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby.h +0 -0
  245. data/assets/{ios → xcode/ios}/MRuby.framework/Info.plist +0 -0
  246. data/assets/{ios → xcode/ios}/MRuby.framework/MRuby +0 -0
  247. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.pbxproj +0 -0
  248. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  249. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  250. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  251. data/assets/{ios → xcode/ios}/main.c +0 -0
  252. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  253. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -0
  254. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -0
  255. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  256. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -0
  257. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  258. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  259. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  260. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -0
  261. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -0
  262. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  263. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -0
  264. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  265. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  266. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -0
  267. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -0
  268. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -0
  269. data/assets/{tvos → xcode/tvos}/Assets.xcassets/Contents.json +0 -0
  270. data/assets/{tvos → xcode/tvos}/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -0
  271. data/assets/{tvos → xcode/tvos}/Info.plist +0 -0
  272. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mrbconf.h +0 -0
  273. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/array.h +0 -0
  274. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  275. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  276. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  277. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/class.h +0 -0
  278. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/common.h +0 -0
  279. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/compile.h +0 -0
  280. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/data.h +0 -0
  281. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/debug.h +0 -0
  282. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/dump.h +0 -0
  283. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/error.h +0 -0
  284. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/gc.h +0 -0
  285. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/hash.h +0 -0
  286. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/irep.h +0 -0
  287. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  288. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/khash.h +0 -0
  289. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  290. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/object.h +0 -0
  291. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  292. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/ops.h +0 -0
  293. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/proc.h +0 -0
  294. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/range.h +0 -0
  295. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/re.h +0 -0
  296. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/string.h +0 -0
  297. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/throw.h +0 -0
  298. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/value.h +0 -0
  299. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/variable.h +0 -0
  300. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/version.h +0 -0
  301. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby.h +0 -0
  302. data/assets/{tvos → xcode/tvos}/MRuby.framework/Info.plist +0 -0
  303. data/assets/{tvos → xcode/tvos}/MRuby.framework/MRuby +0 -0
  304. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.pbxproj +0 -0
  305. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  306. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  307. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  308. data/assets/{tvos → xcode/tvos}/main.c +0 -0
  309. data/bin/ruby2d +3 -4
  310. data/ext/ruby2d/extconf.rb +39 -25
  311. data/ext/ruby2d/gl.c +1 -1
  312. data/ext/ruby2d/gl3.c +0 -1
  313. data/ext/ruby2d/gles.c +137 -84
  314. data/ext/ruby2d/ruby2d.c +126 -32
  315. data/ext/ruby2d/ruby2d.h +53 -6
  316. data/ext/ruby2d/text.c +14 -1
  317. data/ext/ruby2d/window.c +253 -215
  318. data/lib/ruby2d/cli/build.rb +237 -59
  319. data/lib/ruby2d/cli/colorize.rb +5 -4
  320. data/lib/ruby2d/cli/platform.rb +17 -0
  321. data/lib/ruby2d/font.rb +7 -1
  322. data/lib/ruby2d/sprite.rb +7 -2
  323. data/lib/ruby2d/text.rb +1 -3
  324. data/lib/ruby2d/texture.rb +21 -21
  325. data/lib/ruby2d/tileset.rb +34 -33
  326. data/lib/ruby2d/version.rb +1 -1
  327. data/lib/ruby2d/vertices.rb +11 -6
  328. data/lib/ruby2d.rb +14 -20
  329. metadata +246 -152
  330. data/assets/README.md +0 -22
  331. data/assets/Rakefile +0 -85
  332. data/assets/macos/lib/libFLAC.a +0 -0
  333. data/assets/macos/lib/libSDL2.a +0 -0
  334. data/assets/macos/lib/libSDL2_image.a +0 -0
  335. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  336. data/assets/macos/lib/libfreetype.a +0 -0
  337. data/assets/macos/lib/libjpeg.a +0 -0
  338. data/assets/macos/lib/libpng16.a +0 -0
  339. data/assets/macos/lib/libtiff.a +0 -0
  340. data/assets/macos/lib/libvorbis.a +0 -0
  341. data/assets/macos/lib/libvorbisfile.a +0 -0
  342. data/assets/macos/lib/libwebp.a +0 -0
  343. data/assets/mingw/bin/SDL2.dll +0 -0
  344. data/assets/mingw/bin/SDL2_image.dll +0 -0
  345. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  346. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  347. data/assets/mingw/bin/glew32.dll +0 -0
  348. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  349. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  350. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  351. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  352. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  353. data/assets/mingw/bin/libogg-0.dll +0 -0
  354. data/assets/mingw/bin/libopus-0.dll +0 -0
  355. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  356. data/assets/mingw/bin/libpng16-16.dll +0 -0
  357. data/assets/mingw/bin/libtiff-5.dll +0 -0
  358. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  359. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  360. data/assets/mingw/bin/libwebp-7.dll +0 -0
  361. data/assets/mingw/bin/zlib1.dll +0 -0
  362. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  363. data/assets/mingw/lib/libSDL2_image.a +0 -0
  364. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  365. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  366. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  367. data/assets/mingw/lib/libSDL2_test.a +0 -0
  368. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  369. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  370. data/assets/mingw/lib/libSDL2main.a +0 -0
  371. data/assets/mingw/lib/libglew32.dll.a +0 -0
data/ext/ruby2d/ruby2d.c CHANGED
@@ -1,5 +1,9 @@
1
1
  // Native C extension for Ruby and MRuby
2
2
 
3
+ #ifndef RUBY2D_IOS_TVOS
4
+ #define RUBY2D_IOS_TVOS 0
5
+ #endif
6
+
3
7
  // Ruby 2D includes
4
8
  #if RUBY2D_IOS_TVOS
5
9
  #else
@@ -59,6 +63,8 @@
59
63
  #define r_str_new(str) mrb_str_new(mrb, str, strlen(str))
60
64
  #define r_test(val) (mrb_test(val) == true)
61
65
  #define r_ary_entry(ary, pos) mrb_ary_entry(ary, pos)
66
+ #define r_ary_new() mrb_ary_new(mrb)
67
+ #define r_ary_push(self, val) mrb_ary_push(mrb, self, val)
62
68
  #define r_data_wrap_struct(name, data) mrb_obj_value(Data_Wrap_Struct(mrb, mrb->object_class, &name##_data_type, data))
63
69
  #define r_data_get_struct(self, var, mrb_type, rb_type, data) Data_Get_Struct(mrb, r_iv_get(self, var), mrb_type, data)
64
70
  #define r_define_module(name) mrb_define_module(mrb, name)
@@ -82,6 +88,8 @@
82
88
  #define r_str_new(str) rb_str_new2(str)
83
89
  #define r_test(val) (val != Qfalse && val != Qnil)
84
90
  #define r_ary_entry(ary, pos) rb_ary_entry(ary, pos)
91
+ #define r_ary_new() rb_ary_new()
92
+ #define r_ary_push(self, val) rb_ary_push(self, val)
85
93
  #define r_data_wrap_struct(name, data) Data_Wrap_Struct(rb_cObject, NULL, (free_##name), data)
86
94
  #define r_data_get_struct(self, var, mrb_type, rb_type, data) Data_Get_Struct(r_iv_get(self, var), rb_type, data)
87
95
  #define r_define_module(name) rb_define_module(name)
@@ -103,7 +111,7 @@
103
111
  static R_VAL ruby2d_window;
104
112
 
105
113
  // Ruby 2D native window
106
- static R2D_Window *window;
114
+ static R2D_Window *ruby2d_c_window;
107
115
 
108
116
 
109
117
  // Method signatures and structures for Ruby 2D classes
@@ -116,11 +124,19 @@ static R2D_Window *window;
116
124
  static const struct mrb_data_type music_data_type = {
117
125
  "music", free_music
118
126
  };
127
+ static void free_font(mrb_state *mrb, void *p_);
128
+ static const struct mrb_data_type font_data_type = {
129
+ "font", free_font
130
+ };
131
+ static void free_surface(mrb_state *mrb, void *p_);
132
+ static const struct mrb_data_type surface_data_type = {
133
+ "surface", free_surface
134
+ };
119
135
  #else
120
136
  static void free_sound(R2D_Sound *snd);
121
137
  static void free_music(R2D_Music *mus);
122
138
  static void free_font(TTF_Font *font);
123
- static void free_surface(SDL_Surface *font);
139
+ static void free_surface(SDL_Surface *surface);
124
140
  #endif
125
141
 
126
142
 
@@ -128,7 +144,7 @@ static R2D_Window *window;
128
144
  * Function pointer to free the Ruby 2D native window
129
145
  */
130
146
  static void free_window() {
131
- R2D_FreeWindow(window);
147
+ R2D_FreeWindow(ruby2d_c_window);
132
148
  }
133
149
 
134
150
 
@@ -358,17 +374,23 @@ static R_VAL ruby2d_circle_ext_draw(R_VAL self, R_VAL a) {
358
374
  * Ruby2D::Image#ext_load_image
359
375
  * Create an SDL surface from an image path, return the surface, width, and height
360
376
  */
377
+ #if MRUBY
378
+ static R_VAL ruby2d_image_ext_load_image(mrb_state* mrb, R_VAL self) {
379
+ mrb_value path;
380
+ mrb_get_args(mrb, "o", &path);
381
+ #else
361
382
  static R_VAL ruby2d_image_ext_load_image(R_VAL self, R_VAL path) {
383
+ #endif
362
384
  R2D_Init();
363
385
 
364
- VALUE result = rb_ary_new2(3);
386
+ R_VAL result = r_ary_new();
365
387
 
366
388
  SDL_Surface *surface = R2D_CreateImageSurface(RSTRING_PTR(path));
367
389
  R2D_ImageConvertToRGB(surface);
368
390
 
369
- rb_ary_push(result, r_data_wrap_struct(surface, surface));
370
- rb_ary_push(result, INT2NUM(surface->w));
371
- rb_ary_push(result, INT2NUM(surface->h));
391
+ r_ary_push(result, r_data_wrap_struct(surface, surface));
392
+ r_ary_push(result, INT2NUM(surface->w));
393
+ r_ary_push(result, INT2NUM(surface->h));
372
394
 
373
395
  return result;
374
396
  }
@@ -377,33 +399,56 @@ static R_VAL ruby2d_image_ext_load_image(R_VAL self, R_VAL path) {
377
399
  /*
378
400
  * Ruby2D::Text#ext_load_text
379
401
  */
402
+ #if MRUBY
403
+ static R_VAL ruby2d_text_ext_load_text(mrb_state* mrb, R_VAL self) {
404
+ mrb_value font, message;
405
+ mrb_get_args(mrb, "oo", &font, &message);
406
+ #else
380
407
  static R_VAL ruby2d_text_ext_load_text(R_VAL self, R_VAL font, R_VAL message) {
408
+ #endif
381
409
  R2D_Init();
382
410
 
383
- VALUE result = rb_ary_new2(3);
411
+ R_VAL result = r_ary_new();
384
412
 
385
413
  TTF_Font *ttf_font;
414
+
415
+ #if MRUBY
416
+ Data_Get_Struct(mrb, font, &font_data_type, ttf_font);
417
+ #else
386
418
  Data_Get_Struct(font, TTF_Font, ttf_font);
419
+ #endif
387
420
 
388
421
  SDL_Surface *surface = R2D_TextCreateSurface(ttf_font, RSTRING_PTR(message));
389
422
  if (!surface) {
390
423
  return result;
391
424
  }
392
425
 
393
- rb_ary_push(result, r_data_wrap_struct(surface, surface));
394
- rb_ary_push(result, INT2NUM(surface->w));
395
- rb_ary_push(result, INT2NUM(surface->h));
426
+ r_ary_push(result, r_data_wrap_struct(surface, surface));
427
+ r_ary_push(result, INT2NUM(surface->w));
428
+ r_ary_push(result, INT2NUM(surface->h));
396
429
 
397
430
  return result;
398
431
  }
399
432
 
433
+
400
434
  /*
401
435
  * Ruby2D::Texture#ext_create
402
436
  */
437
+ #if MRUBY
438
+ static R_VAL ruby2d_texture_ext_create(mrb_state* mrb, R_VAL self) {
439
+ mrb_value rubySurface, width, height;
440
+ mrb_get_args(mrb, "ooo", &rubySurface, &width, &height);
441
+ #else
403
442
  static R_VAL ruby2d_texture_ext_create(R_VAL self, R_VAL rubySurface, R_VAL width, R_VAL height) {
443
+ #endif
404
444
  GLuint texture_id = 0;
405
445
  SDL_Surface *surface;
406
- Data_Get_Struct(rubySurface, SDL_Surface, surface);
446
+
447
+ #if MRUBY
448
+ Data_Get_Struct(mrb, rubySurface, &surface_data_type, surface);
449
+ #else
450
+ Data_Get_Struct(rubySurface, SDL_Surface, surface);
451
+ #endif
407
452
 
408
453
  // Detect image mode
409
454
  GLint format = GL_RGB;
@@ -418,10 +463,17 @@ static R_VAL ruby2d_texture_ext_create(R_VAL self, R_VAL rubySurface, R_VAL widt
418
463
  return INT2NUM(texture_id);
419
464
  }
420
465
 
466
+
421
467
  /*
422
468
  * Ruby2D::Texture#ext_delete
423
469
  */
470
+ #if MRUBY
471
+ static R_VAL ruby2d_texture_ext_delete(mrb_state* mrb, R_VAL self) {
472
+ mrb_value rubyTexture_id;
473
+ mrb_get_args(mrb, "o", &rubyTexture_id);
474
+ #else
424
475
  static R_VAL ruby2d_texture_ext_delete(R_VAL self, R_VAL rubyTexture_id) {
476
+ #endif
425
477
  GLuint texture_id = NUM2INT(rubyTexture_id);
426
478
 
427
479
  R2D_GL_FreeTexture(&texture_id);
@@ -466,7 +518,11 @@ static R_VAL ruby2d_sound_ext_play(R_VAL self) {
466
518
  /*
467
519
  * Ruby2D::Sound#ext_length
468
520
  */
521
+ #if MRUBY
522
+ static R_VAL ruby2d_sound_ext_length(mrb_state* mrb, R_VAL self) {
523
+ #else
469
524
  static R_VAL ruby2d_sound_ext_length(R_VAL self) {
525
+ #endif
470
526
  R2D_Sound *snd;
471
527
  r_data_get_struct(self, "@data", &sound_data_type, R2D_Sound, snd);
472
528
  return INT2NUM(R2D_GetSoundLength(snd));
@@ -485,6 +541,7 @@ static void free_sound(R2D_Sound *snd) {
485
541
  R2D_FreeSound(snd);
486
542
  }
487
543
 
544
+
488
545
  /*
489
546
  * Ruby2D::Sound#ext_get_volume
490
547
  */
@@ -498,6 +555,7 @@ static R_VAL ruby2d_sound_ext_get_volume(R_VAL self) {
498
555
  return INT2NUM(ceil(Mix_VolumeChunk(snd->data, -1) * (100.0 / MIX_MAX_VOLUME)));
499
556
  }
500
557
 
558
+
501
559
  /*
502
560
  * Ruby2D::Music#ext_set_volume
503
561
  */
@@ -514,6 +572,7 @@ static R_VAL ruby2d_sound_ext_set_volume(R_VAL self, R_VAL volume) {
514
572
  return R_NIL;
515
573
  }
516
574
 
575
+
517
576
  /*
518
577
  * Ruby2D::Sound#ext_get_mix_volume
519
578
  */
@@ -525,6 +584,7 @@ static R_VAL ruby2d_sound_ext_get_mix_volume(R_VAL self) {
525
584
  return INT2NUM(ceil(Mix_Volume(-1, -1) * (100.0 / MIX_MAX_VOLUME)));
526
585
  }
527
586
 
587
+
528
588
  /*
529
589
  * Ruby2D::Music#ext_set_mix_volume
530
590
  */
@@ -539,6 +599,7 @@ static R_VAL ruby2d_sound_ext_set_mix_volume(R_VAL self, R_VAL volume) {
539
599
  return R_NIL;
540
600
  }
541
601
 
602
+
542
603
  /*
543
604
  * Ruby2D::Music#ext_init
544
605
  * Initialize music structure data
@@ -656,16 +717,27 @@ static R_VAL ruby2d_music_ext_fadeout(R_VAL self, R_VAL ms) {
656
717
  /*
657
718
  * Ruby2D::Music#ext_length
658
719
  */
720
+ #if MRUBY
721
+ static R_VAL ruby2d_music_ext_length(mrb_state* mrb, R_VAL self) {
722
+ #else
659
723
  static R_VAL ruby2d_music_ext_length(R_VAL self) {
724
+ #endif
660
725
  R2D_Music *ms;
661
726
  r_data_get_struct(self, "@data", &music_data_type, R2D_Music, ms);
662
727
  return INT2NUM(R2D_GetMusicLength(ms));
663
728
  }
664
729
 
730
+
665
731
  /*
666
732
  * Ruby2D::Font#ext_load
667
733
  */
734
+ #if MRUBY
735
+ static R_VAL ruby2d_font_ext_load(mrb_state* mrb, R_VAL self) {
736
+ mrb_value path, size, style;
737
+ mrb_get_args(mrb, "ooo", &path, &size, &style);
738
+ #else
668
739
  static R_VAL ruby2d_font_ext_load(R_VAL self, R_VAL path, R_VAL size, R_VAL style) {
740
+ #endif
669
741
  R2D_Init();
670
742
 
671
743
  TTF_Font *font = R2D_FontCreateTTFFont(RSTRING_PTR(path), NUM2INT(size), RSTRING_PTR(style));
@@ -680,7 +752,13 @@ static R_VAL ruby2d_font_ext_load(R_VAL self, R_VAL path, R_VAL size, R_VAL styl
680
752
  /*
681
753
  * Ruby2D::Texture#ext_draw
682
754
  */
755
+ #if MRUBY
756
+ static R_VAL ruby2d_texture_ext_draw(mrb_state* mrb, R_VAL self) {
757
+ mrb_value ruby_coordinates, ruby_texture_coordinates, ruby_color, texture_id;
758
+ mrb_get_args(mrb, "oooo", &ruby_coordinates, &ruby_texture_coordinates, &ruby_color, &texture_id);
759
+ #else
683
760
  static R_VAL ruby2d_texture_ext_draw(R_VAL self, R_VAL ruby_coordinates, R_VAL ruby_texture_coordinates, R_VAL ruby_color, R_VAL texture_id) {
761
+ #endif
684
762
  GLfloat coordinates[8];
685
763
  GLfloat texture_coordinates[8];
686
764
  GLfloat color[4];
@@ -694,17 +772,29 @@ static R_VAL ruby2d_texture_ext_draw(R_VAL self, R_VAL ruby_coordinates, R_VAL r
694
772
  return R_NIL;
695
773
  }
696
774
 
775
+
697
776
  /*
698
777
  * Free font structure stored in the Ruby 2D `Font` class
699
778
  */
779
+ #if MRUBY
780
+ static void free_font(mrb_state *mrb, void *p_) {
781
+ TTF_Font *font = (TTF_Font *)p_;
782
+ #else
700
783
  static void free_font(TTF_Font *font) {
784
+ #endif
701
785
  TTF_CloseFont(font);
702
786
  }
703
787
 
788
+
704
789
  /*
705
790
  * Free surface structure used within the Ruby 2D `Texture` class
706
791
  */
792
+ #if MRUBY
793
+ static void free_surface(mrb_state *mrb, void *p_) {
794
+ SDL_Surface *surface = (SDL_Surface *)p_;
795
+ #else
707
796
  static void free_surface(SDL_Surface *surface) {
797
+ #endif
708
798
  SDL_FreeSurface(surface);
709
799
  }
710
800
 
@@ -902,14 +992,14 @@ static void on_controller(R2D_Event e) {
902
992
  static void update() {
903
993
 
904
994
  // Set the cursor
905
- r_iv_set(ruby2d_window, "@mouse_x", INT2NUM(window->mouse.x));
906
- r_iv_set(ruby2d_window, "@mouse_y", INT2NUM(window->mouse.y));
995
+ r_iv_set(ruby2d_window, "@mouse_x", INT2NUM(ruby2d_c_window->mouse.x));
996
+ r_iv_set(ruby2d_window, "@mouse_y", INT2NUM(ruby2d_c_window->mouse.y));
907
997
 
908
998
  // Store frames
909
- r_iv_set(ruby2d_window, "@frames", DBL2NUM(window->frames));
999
+ r_iv_set(ruby2d_window, "@frames", DBL2NUM(ruby2d_c_window->frames));
910
1000
 
911
1001
  // Store frame rate
912
- r_iv_set(ruby2d_window, "@fps", DBL2NUM(window->fps));
1002
+ r_iv_set(ruby2d_window, "@fps", DBL2NUM(ruby2d_c_window->fps));
913
1003
 
914
1004
  // Call update proc, `window.update`
915
1005
  r_funcall(ruby2d_window, "update_callback", 0);
@@ -923,10 +1013,10 @@ static void render() {
923
1013
 
924
1014
  // Set background color
925
1015
  R_VAL bc = r_iv_get(ruby2d_window, "@background");
926
- window->background.r = NUM2DBL(r_iv_get(bc, "@r"));
927
- window->background.g = NUM2DBL(r_iv_get(bc, "@g"));
928
- window->background.b = NUM2DBL(r_iv_get(bc, "@b"));
929
- window->background.a = NUM2DBL(r_iv_get(bc, "@a"));
1016
+ ruby2d_c_window->background.r = NUM2DBL(r_iv_get(bc, "@r"));
1017
+ ruby2d_c_window->background.g = NUM2DBL(r_iv_get(bc, "@g"));
1018
+ ruby2d_c_window->background.b = NUM2DBL(r_iv_get(bc, "@b"));
1019
+ ruby2d_c_window->background.a = NUM2DBL(r_iv_get(bc, "@a"));
930
1020
 
931
1021
  // Read window objects
932
1022
  R_VAL objects = r_iv_get(ruby2d_window, "@objects");
@@ -1040,19 +1130,19 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) {
1040
1130
 
1041
1131
  // Create and show window
1042
1132
 
1043
- window = R2D_CreateWindow(
1133
+ ruby2d_c_window = R2D_CreateWindow(
1044
1134
  title, width, height, update, render, flags
1045
1135
  );
1046
1136
 
1047
- window->viewport.width = viewport_width;
1048
- window->viewport.height = viewport_height;
1049
- window->fps_cap = fps_cap;
1050
- window->icon = icon;
1051
- window->on_key = on_key;
1052
- window->on_mouse = on_mouse;
1053
- window->on_controller = on_controller;
1137
+ ruby2d_c_window->viewport.width = viewport_width;
1138
+ ruby2d_c_window->viewport.height = viewport_height;
1139
+ ruby2d_c_window->fps_cap = fps_cap;
1140
+ ruby2d_c_window->icon = icon;
1141
+ ruby2d_c_window->on_key = on_key;
1142
+ ruby2d_c_window->on_mouse = on_mouse;
1143
+ ruby2d_c_window->on_controller = on_controller;
1054
1144
 
1055
- R2D_Show(window);
1145
+ R2D_Show(ruby2d_c_window);
1056
1146
 
1057
1147
  atexit(free_window);
1058
1148
  return R_NIL;
@@ -1069,8 +1159,8 @@ static R_VAL ruby2d_ext_screenshot(mrb_state* mrb, R_VAL self) {
1069
1159
  #else
1070
1160
  static R_VAL ruby2d_ext_screenshot(R_VAL self, R_VAL path) {
1071
1161
  #endif
1072
- if (window) {
1073
- R2D_Screenshot(window, RSTRING_PTR(path));
1162
+ if (ruby2d_c_window) {
1163
+ R2D_Screenshot(ruby2d_c_window, RSTRING_PTR(path));
1074
1164
  return path;
1075
1165
  } else {
1076
1166
  return R_FALSE;
@@ -1081,8 +1171,12 @@ static R_VAL ruby2d_ext_screenshot(R_VAL self, R_VAL path) {
1081
1171
  /*
1082
1172
  * Ruby2D::Window#ext_close
1083
1173
  */
1174
+ #if MRUBY
1175
+ static R_VAL ruby2d_window_ext_close(mrb_state* mrb, R_VAL self) {
1176
+ #else
1084
1177
  static R_VAL ruby2d_window_ext_close() {
1085
- R2D_Close(window);
1178
+ #endif
1179
+ R2D_Close(ruby2d_c_window);
1086
1180
  return R_NIL;
1087
1181
  }
1088
1182
 
data/ext/ruby2d/ruby2d.h CHANGED
@@ -1,5 +1,8 @@
1
1
  // ruby2d.h
2
2
 
3
+ #ifndef RUBY2D_H
4
+ #define RUBY2D_H
5
+
3
6
  #ifdef __cplusplus
4
7
  extern "C" {
5
8
  #endif
@@ -8,6 +11,10 @@ extern "C" {
8
11
 
9
12
  // Set Platform Constants //////////////////////////////////////////////////////
10
13
 
14
+ #ifndef MRUBY
15
+ #define MRUBY false
16
+ #endif
17
+
11
18
  // Apple
12
19
  #ifdef __APPLE__
13
20
  #ifndef __TARGETCONDITIONALS__
@@ -15,30 +22,54 @@ extern "C" {
15
22
  #endif
16
23
  #if TARGET_OS_OSX
17
24
  #define MACOS true
18
- #elif TARGET_OS_IOS
19
- #define IOS true
20
- #elif TARGET_OS_TV
21
- #define TVOS true
25
+ #else
26
+ #define MACOS false
27
+ #endif
28
+ #if TARGET_OS_IOS
29
+ #define IOS true
30
+ #else
31
+ #define IOS false
32
+ #endif
33
+ #if TARGET_OS_TV
34
+ #define TVOS true
35
+ #else
36
+ #define TVOS false
22
37
  #endif
23
38
  #endif
24
39
 
25
40
  // Windows
26
41
  #ifdef _WIN32
27
42
  #define WINDOWS true
43
+ #else
44
+ #define WINDOWS false
28
45
  #endif
29
46
 
30
47
  // Windows and MinGW
31
48
  #ifdef __MINGW32__
32
49
  #define MINGW true
50
+ #else
51
+ #define MINGW false
33
52
  #endif
34
53
 
35
- // GLES
36
- #if defined(__arm__) || IOS || TVOS
54
+ // WebAssembly
55
+ #ifdef __EMSCRIPTEN__
56
+ #define WASM true
57
+ #else
58
+ #define WASM false
59
+ #endif
60
+
61
+
62
+ // #define GLES true
63
+
64
+ // ARM and GLES
65
+ #if IOS || TVOS || WASM
37
66
  #define GLES true
38
67
  #else
39
68
  #define GLES false
40
69
  #endif
41
70
 
71
+
72
+
42
73
  // Includes ////////////////////////////////////////////////////////////////////
43
74
 
44
75
  // Define to get GNU extension functions and types, like `vasprintf()` and M_PI
@@ -56,6 +87,7 @@ extern "C" {
56
87
  #if WINDOWS
57
88
  #include <stdio.h>
58
89
  #include <math.h>
90
+ #include <winsock2.h>
59
91
  #include <windows.h>
60
92
  // For terminal colors
61
93
  #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
@@ -75,6 +107,17 @@ extern "C" {
75
107
  #undef main
76
108
  #endif
77
109
 
110
+ #if WASM
111
+ #include <stdlib.h>
112
+ #include <stdio.h>
113
+ #include <string.h>
114
+ #include <math.h>
115
+ #include <emscripten.h>
116
+ #include <SDL.h>
117
+ #define GL_GLEXT_PROTOTYPES 1
118
+ #include <SDL_opengles2.h>
119
+ #endif
120
+
78
121
  // OpenGL
79
122
  #if GLES
80
123
  #if IOS || TVOS
@@ -85,6 +128,7 @@ extern "C" {
85
128
  #else
86
129
  #define GL_GLEXT_PROTOTYPES 1
87
130
  #if WINDOWS
131
+ #define GLEW_STATIC
88
132
  #include <glew.h>
89
133
  #endif
90
134
  #include <SDL2/SDL_opengl.h>
@@ -623,6 +667,7 @@ void R2D_GL_FlushBuffers();
623
667
  GLfloat x3, GLfloat y3,
624
668
  GLfloat r3, GLfloat g3, GLfloat b3, GLfloat a3);
625
669
  void R2D_GLES_DrawTexture(GLfloat coordinates[], GLfloat texture_coordinates[], GLfloat color[], int texture_id);
670
+ void R2D_GLES_FlushBuffers();
626
671
  #else
627
672
  int R2D_GL2_Init();
628
673
  int R2D_GL3_Init();
@@ -650,3 +695,5 @@ void R2D_GL_FlushBuffers();
650
695
  #ifdef __cplusplus
651
696
  }
652
697
  #endif
698
+
699
+ #endif /* RUBY2D_H */
data/ext/ruby2d/text.c CHANGED
@@ -18,5 +18,18 @@ SDL_Surface *R2D_TextCreateSurface(TTF_Font *font, const char *message) {
18
18
  return NULL;
19
19
  }
20
20
 
21
+ // Re-pack surface for OpenGL
22
+ // See: https://discourse.libsdl.org/t/sdl-ttf-2-0-18-surface-to-opengl-texture-not-consistent-with-ttf-2-0-15
23
+ Sint32 i;
24
+ Uint32 len = surface->w * surface->format->BytesPerPixel;
25
+ Uint8 *src = surface->pixels;
26
+ Uint8 *dst = surface->pixels;
27
+ for (i = 0; i < surface->h; i++) {
28
+ SDL_memmove(dst, src, len);
29
+ dst += len;
30
+ src += surface->pitch;
31
+ }
32
+ surface->pitch = len;
33
+
21
34
  return surface;
22
- }
35
+ }