ruby2d 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/include/SDL2/SDL.h +108 -14
- data/assets/include/SDL2/SDL_assert.h +81 -50
- data/assets/include/SDL2/SDL_atomic.h +135 -35
- data/assets/include/SDL2/SDL_audio.h +960 -355
- data/assets/include/SDL2/SDL_bits.h +11 -6
- data/assets/include/SDL2/SDL_blendmode.h +91 -14
- data/assets/include/SDL2/SDL_clipboard.h +30 -7
- data/assets/include/SDL2/SDL_config.h +3 -1
- data/assets/include/SDL2/SDL_config_android.h +11 -1
- data/assets/include/SDL2/SDL_config_emscripten.h +216 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +9 -1
- data/assets/include/SDL2/SDL_config_macosx.h +16 -2
- data/assets/include/SDL2/SDL_config_minimal.h +4 -1
- data/assets/include/SDL2/SDL_config_os2.h +37 -20
- data/assets/include/SDL2/SDL_config_pandora.h +6 -1
- data/assets/include/SDL2/SDL_config_psp.h +8 -8
- data/assets/include/SDL2/SDL_config_windows.h +39 -22
- data/assets/include/SDL2/SDL_config_winrt.h +23 -8
- data/assets/include/SDL2/SDL_config_wiz.h +6 -1
- data/assets/include/SDL2/SDL_copying.h +1 -1
- data/assets/include/SDL2/SDL_cpuinfo.h +331 -71
- data/assets/include/SDL2/SDL_egl.h +906 -280
- data/assets/include/SDL2/SDL_endian.h +101 -47
- data/assets/include/SDL2/SDL_error.h +70 -19
- data/assets/include/SDL2/SDL_events.h +387 -79
- data/assets/include/SDL2/SDL_filesystem.h +73 -64
- data/assets/include/SDL2/SDL_gamecontroller.h +585 -125
- data/assets/include/SDL2/SDL_gesture.h +36 -6
- data/assets/include/SDL2/SDL_haptic.h +304 -210
- data/assets/include/SDL2/SDL_hidapi.h +451 -0
- data/assets/include/SDL2/SDL_hints.h +1286 -897
- data/assets/include/SDL2/SDL_joystick.h +577 -130
- data/assets/include/SDL2/SDL_keyboard.h +162 -63
- data/assets/include/SDL2/SDL_keycode.h +7 -5
- data/assets/include/SDL2/SDL_loadso.h +42 -8
- data/assets/include/SDL2/SDL_locale.h +34 -32
- data/assets/include/SDL2/SDL_log.h +212 -19
- data/assets/include/SDL2/SDL_main.h +72 -17
- data/assets/include/SDL2/SDL_messagebox.h +70 -23
- data/assets/include/SDL2/SDL_metal.h +27 -32
- data/assets/include/SDL2/SDL_misc.h +19 -15
- data/assets/include/SDL2/SDL_mouse.h +262 -110
- data/assets/include/SDL2/SDL_mutex.h +286 -66
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +2 -2
- data/assets/include/SDL2/SDL_pixels.h +199 -34
- data/assets/include/SDL2/SDL_platform.h +39 -2
- data/assets/include/SDL2/SDL_power.h +23 -10
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +78 -28
- data/assets/include/SDL2/SDL_render.h +1204 -472
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +605 -33
- data/assets/include/SDL2/SDL_scancode.h +1 -1
- data/assets/include/SDL2/SDL_sensor.h +76 -42
- data/assets/include/SDL2/SDL_shape.h +38 -27
- data/assets/include/SDL2/SDL_stdinc.h +96 -24
- data/assets/include/SDL2/SDL_surface.h +571 -139
- data/assets/include/SDL2/SDL_system.h +339 -101
- data/assets/include/SDL2/SDL_syswm.h +50 -20
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +2 -2
- data/assets/include/SDL2/SDL_test_common.h +23 -6
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +3 -3
- data/assets/include/SDL2/SDL_test_fuzzer.h +28 -26
- data/assets/include/SDL2/SDL_test_harness.h +6 -6
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +1 -1
- data/assets/include/SDL2/SDL_test_random.h +2 -2
- data/assets/include/SDL2/SDL_thread.h +226 -128
- data/assets/include/SDL2/SDL_timer.h +129 -22
- data/assets/include/SDL2/SDL_touch.h +48 -8
- data/assets/include/SDL2/SDL_ttf.h +102 -9
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +72 -46
- data/assets/include/SDL2/SDL_video.h +1266 -460
- data/assets/include/SDL2/SDL_vulkan.h +100 -161
- data/assets/include/SDL2/begin_code.h +22 -1
- data/assets/include/SDL2/close_code.h +1 -1
- data/assets/include/mrbconf.h +234 -0
- data/assets/include/mruby/array.h +317 -0
- data/assets/include/mruby/boxing_nan.h +130 -0
- data/assets/include/mruby/boxing_no.h +58 -0
- data/assets/include/mruby/boxing_word.h +205 -0
- data/assets/include/mruby/class.h +108 -0
- data/assets/include/mruby/common.h +92 -0
- data/assets/include/mruby/compile.h +210 -0
- data/assets/include/mruby/data.h +76 -0
- data/assets/include/mruby/debug.h +66 -0
- data/assets/include/mruby/dump.h +158 -0
- data/assets/include/mruby/endian.h +44 -0
- data/assets/include/mruby/error.h +137 -0
- data/assets/include/mruby/gc.h +92 -0
- data/assets/include/mruby/hash.h +242 -0
- data/assets/include/mruby/irep.h +147 -0
- data/assets/include/mruby/istruct.h +50 -0
- data/assets/include/mruby/khash.h +284 -0
- data/assets/include/mruby/numeric.h +169 -0
- data/assets/include/mruby/object.h +43 -0
- data/assets/include/mruby/opcode.h +43 -0
- data/assets/include/mruby/ops.h +122 -0
- data/assets/include/mruby/presym/disable.h +70 -0
- data/assets/include/mruby/presym/enable.h +37 -0
- data/assets/include/mruby/presym/scanning.h +73 -0
- data/assets/include/mruby/presym.h +40 -0
- data/assets/include/mruby/proc.h +209 -0
- data/assets/include/mruby/range.h +79 -0
- data/assets/include/mruby/re.h +16 -0
- data/assets/include/mruby/string.h +469 -0
- data/assets/include/mruby/throw.h +66 -0
- data/assets/include/mruby/value.h +400 -0
- data/assets/include/mruby/variable.h +140 -0
- data/assets/include/mruby/version.h +143 -0
- data/assets/include/mruby.h +1444 -0
- data/assets/macos/universal/bin/mrbc +0 -0
- data/assets/macos/universal/lib/libFLAC.a +0 -0
- data/assets/macos/universal/lib/libSDL2.a +0 -0
- data/assets/macos/universal/lib/libSDL2_image.a +0 -0
- data/assets/macos/{lib → universal/lib}/libSDL2_mixer.a +0 -0
- data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/universal/lib/libfreetype.a +0 -0
- data/assets/macos/universal/lib/libgraphite2.a +0 -0
- data/assets/macos/universal/lib/libharfbuzz.a +0 -0
- data/assets/macos/universal/lib/libjpeg.a +0 -0
- data/assets/macos/{lib → universal/lib}/libmodplug.a +0 -0
- data/assets/macos/{lib → universal/lib}/libmpg123.a +0 -0
- data/assets/{mingw/lib/libSDL2.a → macos/universal/lib/libmruby.a} +0 -0
- data/assets/macos/{lib → universal/lib}/libogg.a +0 -0
- data/assets/macos/universal/lib/libpng16.a +0 -0
- data/assets/macos/universal/lib/libtiff.a +0 -0
- data/assets/macos/universal/lib/libvorbis.a +0 -0
- data/assets/macos/universal/lib/libvorbisfile.a +0 -0
- data/assets/macos/universal/lib/libwebp.a +0 -0
- data/assets/test_media/README.md +3 -0
- data/assets/test_media/bitstream_vera/COPYRIGHT.txt +124 -0
- data/assets/test_media/bitstream_vera/vera.ttf +0 -0
- data/assets/test_media/boom.png +0 -0
- data/assets/test_media/coin.png +0 -0
- data/assets/test_media/colors.png +0 -0
- data/assets/test_media/controller.png +0 -0
- data/assets/test_media/dial.wav +0 -0
- data/assets/test_media/hero.png +0 -0
- data/assets/test_media/image.bmp +0 -0
- data/assets/test_media/image.jpg +0 -0
- data/assets/test_media/image.png +0 -0
- data/assets/test_media/music.flac +0 -0
- data/assets/test_media/music.mp3 +0 -0
- data/assets/test_media/music.ogg +0 -0
- data/assets/test_media/music.wav +0 -0
- data/assets/test_media/originals/boom.pxm +0 -0
- data/assets/test_media/originals/coin.pxm +0 -0
- data/assets/test_media/originals/controller.sketch +0 -0
- data/assets/test_media/originals/hero.pxm +0 -0
- data/assets/test_media/originals/image.pxm +0 -0
- data/assets/test_media/originals/music.caf +0 -0
- data/assets/test_media/originals/texture_atlas.pxm +0 -0
- data/assets/test_media/rondo_alla_turka.ogg +0 -0
- data/assets/test_media/sound.flac +0 -0
- data/assets/test_media/sound.mp3 +0 -0
- data/assets/test_media/sound.ogg +0 -0
- data/assets/test_media/sound.wav +0 -0
- data/assets/test_media/sprite_sheet.png +0 -0
- data/assets/test_media/texture_atlas.png +0 -0
- data/assets/wasm/build_config.rb +13 -0
- data/assets/wasm/libmruby.a +0 -0
- data/assets/wasm/template.html +17 -0
- data/assets/windows/glew/README.md +10 -0
- data/assets/windows/glew/glew.h +23686 -0
- data/assets/{mingw/lib → windows/glew}/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
- data/assets/{ios → xcode/ios}/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
- data/assets/{ios → xcode/ios}/Assets.xcassets/Contents.json +0 -0
- data/assets/{ios → xcode/ios}/Base.lproj/LaunchScreen.storyboard +0 -0
- data/assets/{ios → xcode/ios}/Info.plist +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mrbconf.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/array.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/class.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/common.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/compile.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/data.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/debug.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/dump.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/error.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/gc.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/hash.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/irep.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/istruct.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/khash.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/numeric.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/object.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/opcode.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/ops.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/proc.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/range.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/re.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/string.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/throw.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/value.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/variable.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/version.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Info.plist +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/MRuby +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.pbxproj +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
- data/assets/{ios → xcode/ios}/main.c +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Info.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mrbconf.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/array.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/class.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/common.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/compile.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/data.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/debug.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/dump.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/error.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/gc.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/hash.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/irep.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/istruct.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/khash.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/numeric.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/object.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/opcode.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/ops.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/proc.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/range.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/re.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/string.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/throw.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/value.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/variable.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/version.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Info.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/MRuby +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.pbxproj +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
- data/assets/{tvos → xcode/tvos}/main.c +0 -0
- data/bin/ruby2d +3 -4
- data/ext/ruby2d/extconf.rb +39 -25
- data/ext/ruby2d/gl.c +1 -1
- data/ext/ruby2d/gl3.c +0 -1
- data/ext/ruby2d/gles.c +137 -84
- data/ext/ruby2d/ruby2d.c +126 -32
- data/ext/ruby2d/ruby2d.h +53 -6
- data/ext/ruby2d/text.c +14 -1
- data/ext/ruby2d/window.c +253 -215
- data/lib/ruby2d/cli/build.rb +237 -59
- data/lib/ruby2d/cli/colorize.rb +5 -4
- data/lib/ruby2d/cli/platform.rb +17 -0
- data/lib/ruby2d/font.rb +7 -1
- data/lib/ruby2d/sprite.rb +7 -2
- data/lib/ruby2d/text.rb +1 -3
- data/lib/ruby2d/texture.rb +21 -21
- data/lib/ruby2d/tileset.rb +34 -33
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +11 -6
- data/lib/ruby2d.rb +14 -20
- metadata +246 -152
- data/assets/README.md +0 -22
- data/assets/Rakefile +0 -85
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/SDL2_mixer.dll +0 -0
- data/assets/mingw/bin/SDL2_ttf.dll +0 -0
- data/assets/mingw/bin/glew32.dll +0 -0
- data/assets/mingw/bin/libFLAC-8.dll +0 -0
- data/assets/mingw/bin/libfreetype-6.dll +0 -0
- data/assets/mingw/bin/libjpeg-9.dll +0 -0
- data/assets/mingw/bin/libmodplug-1.dll +0 -0
- data/assets/mingw/bin/libmpg123-0.dll +0 -0
- data/assets/mingw/bin/libogg-0.dll +0 -0
- data/assets/mingw/bin/libopus-0.dll +0 -0
- data/assets/mingw/bin/libopusfile-0.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libvorbis-0.dll +0 -0
- data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
- data/assets/mingw/bin/libwebp-7.dll +0 -0
- data/assets/mingw/bin/zlib1.dll +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_mixer.a +0 -0
- data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2_ttf.a +0 -0
- data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- 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 *
|
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 *
|
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(
|
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
|
-
|
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
|
-
|
370
|
-
|
371
|
-
|
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
|
-
|
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
|
-
|
394
|
-
|
395
|
-
|
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
|
-
|
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(
|
906
|
-
r_iv_set(ruby2d_window, "@mouse_y", INT2NUM(
|
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(
|
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(
|
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
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
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
|
-
|
1133
|
+
ruby2d_c_window = R2D_CreateWindow(
|
1044
1134
|
title, width, height, update, render, flags
|
1045
1135
|
);
|
1046
1136
|
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
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(
|
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 (
|
1073
|
-
R2D_Screenshot(
|
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
|
-
|
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
|
-
#
|
19
|
-
#define
|
20
|
-
#
|
21
|
-
|
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
|
-
//
|
36
|
-
#
|
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
|
+
}
|