ruby2d 0.11.0 → 0.11.3
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/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/libmruby.a +0 -0
- data/assets/wasm/template.html +64 -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-ucrt-x86_64/bin/mrbc.exe +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbz2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libgraphite2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjbig.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng16.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.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 +44 -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 +242 -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 +279 -151
- 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/lib/ruby2d/cli/build.rb
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
# Build a Ruby 2D app
|
1
|
+
# Build a compiled Ruby 2D app with mruby
|
2
2
|
|
3
|
+
require 'ruby2d'
|
3
4
|
require 'fileutils'
|
5
|
+
require 'ruby2d/cli/colorize'
|
6
|
+
require 'ruby2d/cli/platform'
|
4
7
|
|
5
|
-
# The installed gem directory
|
6
|
-
@gem_dir = "#{Gem::Specification.find_by_name('ruby2d').gem_dir}"
|
7
8
|
|
8
9
|
# The Ruby 2D library files
|
9
|
-
@
|
10
|
+
@ruby2d_lib_files = [
|
10
11
|
'cli/colorize',
|
11
12
|
'exceptions',
|
12
13
|
'renderable',
|
13
14
|
'color',
|
14
15
|
'window',
|
15
16
|
'dsl',
|
17
|
+
'entity',
|
16
18
|
'quad',
|
17
19
|
'line',
|
18
20
|
'circle',
|
19
21
|
'rectangle',
|
20
22
|
'square',
|
21
23
|
'triangle',
|
24
|
+
'pixel',
|
22
25
|
'image',
|
23
26
|
'sprite',
|
27
|
+
'tileset',
|
24
28
|
'font',
|
25
29
|
'text',
|
26
30
|
'sound',
|
@@ -31,30 +35,11 @@ require 'fileutils'
|
|
31
35
|
]
|
32
36
|
|
33
37
|
|
34
|
-
#
|
35
|
-
def check_build_src_file(rb_file)
|
36
|
-
if !rb_file
|
37
|
-
puts "Please provide a Ruby file to build"
|
38
|
-
exit
|
39
|
-
elsif !File.exist? rb_file
|
40
|
-
puts "Can't find file: #{rb_file}"
|
41
|
-
exit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
# Assemble the Ruby 2D library in one `.rb` file
|
47
|
-
def make_lib
|
48
|
-
FileUtils.mkdir_p 'build'
|
49
|
-
|
50
|
-
lib_dir = "#{@gem_dir}/lib/ruby2d/"
|
51
|
-
|
52
|
-
lib = ''
|
53
|
-
@lib_files.each do |f|
|
54
|
-
lib << File.read("#{lib_dir + f}.rb") + "\n\n"
|
55
|
-
end
|
38
|
+
# Helpers ######################################################################
|
56
39
|
|
57
|
-
|
40
|
+
def run_cmd(cmd)
|
41
|
+
puts "#{'$'.info} #{cmd.bold}\n" if @debug
|
42
|
+
system cmd
|
58
43
|
end
|
59
44
|
|
60
45
|
|
@@ -68,57 +53,256 @@ def strip_require(file)
|
|
68
53
|
end
|
69
54
|
|
70
55
|
|
71
|
-
#
|
72
|
-
def
|
73
|
-
|
56
|
+
# Add linker flags
|
57
|
+
def add_ld_flags(ld_flags, name, type, dir = nil)
|
58
|
+
case type
|
59
|
+
when :archive
|
60
|
+
ld_flags << "#{dir}/lib#{name}.a "
|
61
|
+
when :framework
|
62
|
+
ld_flags << "-Wl,-framework,#{name} "
|
63
|
+
end
|
64
|
+
end
|
74
65
|
|
75
|
-
|
76
|
-
|
77
|
-
|
66
|
+
|
67
|
+
# Build Tasks ##################################################################
|
68
|
+
|
69
|
+
# Build the user's application
|
70
|
+
def build(target, ruby2d_app)
|
71
|
+
|
72
|
+
# Check if source file provided is good
|
73
|
+
if !ruby2d_app
|
74
|
+
puts "Please provide a Ruby file to build"
|
75
|
+
exit
|
76
|
+
elsif !File.exist? ruby2d_app
|
77
|
+
puts "Can't find file: #{ruby2d_app}"
|
78
78
|
exit
|
79
79
|
end
|
80
80
|
|
81
81
|
# Add debugging information to produce backtrace
|
82
82
|
if @debug then debug_flag = '-g' end
|
83
83
|
|
84
|
-
#
|
85
|
-
|
86
|
-
`mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb`
|
84
|
+
# Create build directory
|
85
|
+
FileUtils.mkdir_p 'build'
|
87
86
|
|
88
|
-
#
|
89
|
-
|
90
|
-
|
87
|
+
# Assemble Ruby 2D library files into one '.rb' file
|
88
|
+
|
89
|
+
ruby2d_lib_dir = "#{Ruby2D.gem_dir}/lib/ruby2d/"
|
90
|
+
|
91
|
+
ruby2d_lib = ''
|
92
|
+
@ruby2d_lib_files.each do |f|
|
93
|
+
ruby2d_lib << File.read("#{ruby2d_lib_dir + f}.rb") + "\n\n"
|
94
|
+
end
|
95
|
+
|
96
|
+
File.write('build/ruby2d_lib.rb', ruby2d_lib)
|
97
|
+
|
98
|
+
# Assemble the Ruby 2D C extension files into one '.c' file
|
99
|
+
|
100
|
+
ruby2d_ext_dir = "#{Ruby2D.gem_dir}/ext/ruby2d/"
|
101
|
+
|
102
|
+
ruby2d_ext = "#define MRUBY 1" << "\n\n"
|
103
|
+
Dir["#{ruby2d_ext_dir}*.c"].each do |c_file|
|
104
|
+
ruby2d_ext << File.read(c_file)
|
105
|
+
end
|
106
|
+
|
107
|
+
File.write('build/ruby2d_ext.c', ruby2d_ext)
|
108
|
+
|
109
|
+
# Select `mrbc` executable based on platform
|
110
|
+
case $RUBY2D_PLATFORM
|
111
|
+
when :macos
|
112
|
+
mrbc = "#{Ruby2D.assets}/macos/universal/bin/mrbc"
|
113
|
+
when :windows
|
114
|
+
mrbc = "#{Ruby2D.assets}/windows/mingw-w64-x86_64/bin/mrbc.exe"
|
115
|
+
else
|
116
|
+
mrbc = 'mrbc'
|
117
|
+
end
|
118
|
+
|
119
|
+
# Compile the Ruby 2D lib (`.rb` files) to mruby bytecode
|
120
|
+
run_cmd "#{mrbc} #{debug_flag} -Bruby2d_lib -obuild/ruby2d_lib.c build/ruby2d_lib.rb"
|
121
|
+
|
122
|
+
# Read the user's provided Ruby source file, copy to build dir and compile to bytecode
|
123
|
+
File.open('build/ruby2d_app.rb', 'w') { |f| f << strip_require(ruby2d_app) }
|
124
|
+
run_cmd "#{mrbc} #{debug_flag} -Bruby2d_app -obuild/ruby2d_app.c build/ruby2d_app.rb"
|
91
125
|
|
92
126
|
# Combine contents of C source files and bytecode into one file
|
93
127
|
open('build/app.c', 'w') do |f|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
f << File.read("#{@gem_dir}/ext/ruby2d/ruby2d.c")
|
128
|
+
['ruby2d_app', 'ruby2d_lib', 'ruby2d_ext'].each do |c_file|
|
129
|
+
f << File.read("build/#{c_file}.c") << "\n\n"
|
130
|
+
end
|
98
131
|
end
|
99
132
|
|
100
|
-
# Compile
|
101
|
-
|
133
|
+
# Compile the final application based on the target platform
|
134
|
+
case target
|
135
|
+
when :native
|
136
|
+
compile_native
|
137
|
+
when :web
|
138
|
+
compile_web
|
139
|
+
end
|
102
140
|
|
103
|
-
#
|
141
|
+
# Remove files used in the build process
|
104
142
|
clean_up unless @debug
|
105
143
|
|
106
|
-
# Success!
|
107
|
-
puts "Native app created at `build/app`"
|
108
144
|
end
|
109
145
|
|
110
146
|
|
111
|
-
#
|
112
|
-
def
|
113
|
-
|
147
|
+
# Create a native executable using the available C compiler
|
148
|
+
def compile_native
|
149
|
+
|
150
|
+
# Get include directories
|
151
|
+
incl_dir_ruby2d = "#{Ruby2D.gem_dir}/ext/ruby2d/"
|
152
|
+
incl_dir_deps = "#{Ruby2D.assets}/include/"
|
153
|
+
|
154
|
+
# Add compiler flags for each platform
|
155
|
+
case $RUBY2D_PLATFORM
|
156
|
+
|
157
|
+
when :macos
|
158
|
+
ld_dir = "#{Ruby2D.assets}/macos/universal/lib"
|
159
|
+
|
160
|
+
c_flags = '-arch arm64 -arch x86_64'
|
161
|
+
|
162
|
+
ld_flags = ''
|
163
|
+
['mruby', 'SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf',
|
164
|
+
'jpeg', 'png16', 'tiff', 'webp',
|
165
|
+
'mpg123', 'ogg', 'FLAC', 'vorbis', 'vorbisfile', 'modplug',
|
166
|
+
'freetype', 'harfbuzz', 'graphite2'].each do |name|
|
167
|
+
add_ld_flags(ld_flags, name, :archive, ld_dir)
|
168
|
+
end
|
169
|
+
|
170
|
+
ld_flags << "-lz -lbz2 -liconv -lstdc++ "
|
171
|
+
['Cocoa', 'Carbon', 'CoreVideo', 'OpenGL', 'Metal', 'CoreAudio', 'AudioToolbox',
|
172
|
+
'IOKit', 'GameController', 'ForceFeedback', 'CoreHaptics'].each do |name|
|
173
|
+
add_ld_flags(ld_flags, name, :framework)
|
174
|
+
end
|
175
|
+
|
176
|
+
when :linux, :linux_rpi, :bsd
|
177
|
+
# TODO: implement this
|
178
|
+
# ld_flags = '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm -lGL'
|
179
|
+
|
180
|
+
when :windows
|
181
|
+
|
182
|
+
if RUBY_PLATFORM =~ /ucrt/
|
183
|
+
ld_dir = "#{Ruby2D.assets}/windows/mingw-w64-ucrt-x86_64/lib"
|
184
|
+
else
|
185
|
+
ld_dir = "#{Ruby2D.assets}/windows/mingw-w64-x86_64/lib"
|
186
|
+
end
|
187
|
+
|
188
|
+
ld_flags = '-static -Wl,--start-group '
|
189
|
+
['mruby',
|
190
|
+
'SDL2',
|
191
|
+
'SDL2_image', 'jpeg', 'png16', 'tiff', 'webp', 'jbig', 'deflate', 'lzma', 'zstd', 'Lerc',
|
192
|
+
'SDL2_mixer', 'mpg123', 'FLAC', 'vorbis', 'vorbisfile', 'ogg', 'modplug', 'opus', 'opusfile', 'sndfile',
|
193
|
+
'SDL2_ttf', 'freetype', 'harfbuzz', 'graphite2', 'bz2', 'brotlicommon', 'brotlidec',
|
194
|
+
'glew32', 'stdc++', 'z', 'ssp'
|
195
|
+
].each do |name|
|
196
|
+
add_ld_flags(ld_flags, name, :archive, ld_dir)
|
197
|
+
end
|
198
|
+
ld_flags << '-lmingw32 -lopengl32 -lole32 -loleaut32 -limm32 -lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite '\
|
199
|
+
'-lws2_32 -lshlwapi '
|
200
|
+
ld_flags << '-Wl,--end-group'
|
201
|
+
end
|
202
|
+
|
203
|
+
# Compile the app
|
204
|
+
run_cmd "cc #{c_flags} -I#{incl_dir_ruby2d} -I#{incl_dir_deps} build/app.c #{ld_flags} -o build/app"
|
205
|
+
|
206
|
+
create_macos_bundle if $RUBY2D_PLATFORM == :macos
|
114
207
|
end
|
115
208
|
|
116
209
|
|
117
|
-
#
|
118
|
-
def
|
210
|
+
# Create a WebAssembly executable using Emscripten
|
211
|
+
def compile_web
|
212
|
+
|
213
|
+
# Check for compiler toolchain issues
|
214
|
+
if doctor_web(:building)
|
215
|
+
puts "Fix errors before building.\n\n"
|
216
|
+
end
|
217
|
+
|
218
|
+
wasm_assets = "#{Ruby2D.assets}/wasm"
|
219
|
+
|
220
|
+
# Get include directories
|
221
|
+
incl_dir_ruby2d = "#{Ruby2D.gem_dir}/ext/ruby2d/"
|
222
|
+
incl_dir_deps = "#{Ruby2D.assets}/include/"
|
223
|
+
|
224
|
+
optimize_flags = '-Os --closure 1'
|
225
|
+
ld_flags = "#{wasm_assets}/libmruby.a"
|
226
|
+
|
227
|
+
# Compile using Emscripten
|
228
|
+
run_cmd "emcc -s WASM=1 -I#{incl_dir_ruby2d} -I#{incl_dir_deps} "\
|
229
|
+
"-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_TTF=2 "\
|
230
|
+
"build/app.c #{ld_flags} -o build/app.html"
|
231
|
+
|
232
|
+
# TODO: Copy HTML template from gem assets to build directory
|
233
|
+
# FileUtils.cp "#{wasm_assets}/template.html", 'build/app.html'
|
234
|
+
|
235
|
+
exit(1) unless $?.success?
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
def doctor_native
|
240
|
+
# Check if MRuby exists; if not, quit
|
241
|
+
if `which mruby`.empty?
|
242
|
+
puts "#{'Error:'.error} Can't find `mruby`, which is needed to build native Ruby 2D applications.\n"
|
243
|
+
exit
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
|
248
|
+
# Check for problems with web build
|
249
|
+
def doctor_web(mode = nil)
|
250
|
+
|
251
|
+
errors = false
|
252
|
+
mruby_errors = false
|
253
|
+
emscripten_errors = false
|
254
|
+
|
255
|
+
puts "\nChecking for mruby"
|
256
|
+
|
257
|
+
# Check for `mrbc`
|
258
|
+
print ' mrbc...'
|
259
|
+
if `which mrbc`.empty?
|
260
|
+
puts 'not found'.error
|
261
|
+
mruby_errors = true
|
262
|
+
else
|
263
|
+
puts 'found'.success
|
264
|
+
end
|
119
265
|
|
120
|
-
|
121
|
-
|
266
|
+
puts "\nChecking for Emscripten tools"
|
267
|
+
|
268
|
+
# Check for `emcc`
|
269
|
+
print ' emcc...'
|
270
|
+
if `which emcc`.empty?
|
271
|
+
puts 'not found'.error
|
272
|
+
emscripten_errors = true
|
273
|
+
else
|
274
|
+
puts 'found'.success
|
275
|
+
end
|
276
|
+
|
277
|
+
# Check for `emar`
|
278
|
+
print ' emar...'
|
279
|
+
if `which emar`.empty?
|
280
|
+
puts 'not found'.error
|
281
|
+
emscripten_errors = true
|
282
|
+
else
|
283
|
+
puts 'found'.success
|
284
|
+
end
|
285
|
+
|
286
|
+
if mruby_errors || emscripten_errors then errors = true end
|
287
|
+
|
288
|
+
if errors
|
289
|
+
puts "\nErrors were found!\n\n"
|
290
|
+
if mruby_errors
|
291
|
+
puts "* Did you install mruby?"
|
292
|
+
end
|
293
|
+
if emscripten_errors
|
294
|
+
puts "* Did you run \`./emsdk_env.sh\` ?", " For help, check out the \"Getting Started\" guide on webassembly.org"
|
295
|
+
end
|
296
|
+
puts "\n"
|
297
|
+
exit(1)
|
298
|
+
else
|
299
|
+
puts "\n👍 Everything looks good!\n\n"
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
|
304
|
+
# Build an app bundle for macOS
|
305
|
+
def create_macos_bundle
|
122
306
|
|
123
307
|
# Property list source for the bundle
|
124
308
|
info_plist = %(
|
@@ -153,10 +337,10 @@ def build_macos(rb_file)
|
|
153
337
|
# FileUtils.cp "#{@gem_dir}/assets/app.icns", 'build/App.app/Contents/Resources'
|
154
338
|
|
155
339
|
# Clean up
|
156
|
-
FileUtils.rm_f 'build/app' unless @debug
|
340
|
+
# FileUtils.rm_f 'build/app' unless @debug
|
157
341
|
|
158
342
|
# Success!
|
159
|
-
puts 'macOS app bundle created: `build/App.app`'
|
343
|
+
# puts 'macOS app bundle created: `build/App.app`'
|
160
344
|
end
|
161
345
|
|
162
346
|
|
@@ -208,8 +392,7 @@ end
|
|
208
392
|
# Clean up unneeded build files
|
209
393
|
def clean_up(cmd = nil)
|
210
394
|
FileUtils.rm(
|
211
|
-
Dir.glob('build
|
212
|
-
Dir.glob('build/app.c')
|
395
|
+
Dir.glob('build/*.{rb,c,js}')
|
213
396
|
)
|
214
397
|
if cmd == :all
|
215
398
|
puts "cleaning up..."
|
data/lib/ruby2d/cli/colorize.rb
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
# Extend `String` to include some fancy colors
|
4
4
|
class String
|
5
5
|
def ruby2d_colorize(c); "\e[#{c}m#{self}\e[0m" end
|
6
|
-
def bold;
|
7
|
-
def info;
|
8
|
-
def warn;
|
9
|
-
def
|
6
|
+
def bold; ruby2d_colorize('1') end
|
7
|
+
def info; ruby2d_colorize('1;34') end
|
8
|
+
def warn; ruby2d_colorize('1;33') end
|
9
|
+
def success; ruby2d_colorize('1;32') end
|
10
|
+
def error; ruby2d_colorize('1;31') end
|
10
11
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Set the OS and platform
|
2
|
+
|
3
|
+
case RUBY_PLATFORM
|
4
|
+
when /darwin/
|
5
|
+
$RUBY2D_PLATFORM = :macos
|
6
|
+
when /linux/
|
7
|
+
$RUBY2D_PLATFORM = :linux
|
8
|
+
if `cat /etc/os-release` =~ /raspbian/
|
9
|
+
$RUBY2D_PLATFORM = :linux_rpi
|
10
|
+
end
|
11
|
+
when /bsd/
|
12
|
+
$RUBY2D_PLATFORM = :bsd
|
13
|
+
when /mingw/
|
14
|
+
$RUBY2D_PLATFORM = :windows
|
15
|
+
else
|
16
|
+
$RUBY2D_PLATFORM = nil
|
17
|
+
end
|
data/lib/ruby2d/font.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Ruby2D
|
4
4
|
class Font
|
5
|
+
FONT_CACHE_LIMIT = 100
|
6
|
+
|
5
7
|
@@loaded_fonts = {}
|
6
8
|
|
7
9
|
attr_reader :ttf_font
|
@@ -16,7 +18,11 @@ module Ruby2D
|
|
16
18
|
raise Error, "Cannot find font file `#{path}`"
|
17
19
|
end
|
18
20
|
|
19
|
-
@@loaded_fonts[[path, size, style]] ||= Font.new(path, size, style)
|
21
|
+
(@@loaded_fonts[[path, size, style]] ||= Font.new(path, size, style)).tap do |font|
|
22
|
+
if @@loaded_fonts.size > FONT_CACHE_LIMIT
|
23
|
+
@@loaded_fonts.shift
|
24
|
+
end
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
# List all fonts, names only
|
data/lib/ruby2d/sprite.rb
CHANGED
@@ -177,8 +177,13 @@ module Ruby2D
|
|
177
177
|
unless @loop
|
178
178
|
# Stop animation and play block, if provided
|
179
179
|
stop
|
180
|
-
if @done_proc
|
181
|
-
|
180
|
+
if @done_proc
|
181
|
+
# allow proc to make nested `play/do` calls to sequence multiple
|
182
|
+
# animations by clearing `@done_proc` before the call
|
183
|
+
kept_done_proc = @done_proc
|
184
|
+
@done_proc = nil
|
185
|
+
kept_done_proc.call
|
186
|
+
end
|
182
187
|
end
|
183
188
|
end
|
184
189
|
|
data/lib/ruby2d/text.rb
CHANGED
data/lib/ruby2d/texture.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
# Ruby2D::
|
1
|
+
# Ruby2D::Texture
|
2
2
|
|
3
3
|
module Ruby2D
|
4
|
-
|
5
|
-
|
4
|
+
class Texture
|
5
|
+
attr_reader :width, :height, :texture_id
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def draw(coordinates, texture_coordinates, color)
|
15
|
-
if @texture_id == 0
|
16
|
-
@texture_id = ext_create(@pixel_data, @width, @height)
|
17
|
-
@pixel_data = nil
|
18
|
-
end
|
7
|
+
def initialize(pixel_data, width, height)
|
8
|
+
@pixel_data = pixel_data
|
9
|
+
@width = width
|
10
|
+
@height = height
|
11
|
+
@texture_id = 0
|
12
|
+
end
|
19
13
|
|
20
|
-
|
21
|
-
|
14
|
+
def draw(coordinates, texture_coordinates, color)
|
15
|
+
if @texture_id == 0
|
16
|
+
@texture_id = ext_create(@pixel_data, @width, @height)
|
17
|
+
@pixel_data = nil
|
22
18
|
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
color = [color.r, color.g, color.b, color.a]
|
21
|
+
ext_draw(coordinates, texture_coordinates, color, @texture_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete
|
25
|
+
ext_delete(@texture_id)
|
27
26
|
end
|
28
|
-
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/ruby2d/tileset.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Ruby2D
|
4
4
|
class Tileset
|
5
|
+
DEFAULT_COLOR = Color.new([1.0, 1.0, 1.0, 1.0])
|
6
|
+
|
5
7
|
include Renderable
|
6
8
|
|
7
9
|
def initialize(path, opts = {})
|
@@ -46,42 +48,41 @@ module Ruby2D
|
|
46
48
|
def clear_tiles
|
47
49
|
@tiles = []
|
48
50
|
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def draw
|
52
|
-
Window.render_ready_check
|
53
|
-
|
54
|
-
render
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
51
|
|
52
|
+
def draw
|
53
|
+
Window.render_ready_check
|
59
54
|
|
60
|
-
|
61
|
-
|
62
|
-
scaled_spacing = @spacing * @scale
|
63
|
-
scaled_tile_width = @tile_width * @scale
|
64
|
-
scaled_tile_height = @tile_height * @scale
|
65
|
-
scaled_width = @width * @scale
|
66
|
-
scaled_height = @height * @scale
|
67
|
-
|
68
|
-
@tiles.each do |tile|
|
69
|
-
crop = {
|
70
|
-
x: scaled_padding + (tile.fetch(:tile_x) * (scaled_spacing + scaled_tile_width)),
|
71
|
-
y: scaled_padding + (tile.fetch(:tile_y) * (scaled_spacing + scaled_tile_height)),
|
72
|
-
width: scaled_tile_width,
|
73
|
-
height: scaled_tile_height,
|
74
|
-
image_width: scaled_width,
|
75
|
-
image_height: scaled_height,
|
76
|
-
}
|
77
|
-
|
78
|
-
color = defined?(@color) ? @color : Color.new([1.0, 1.0, 1.0, 1.0])
|
79
|
-
|
80
|
-
vertices = Vertices.new(tile.fetch(:x), tile.fetch(:y), scaled_tile_width, scaled_tile_height, tile.fetch(:tile_rotate), crop: crop, flip: tile.fetch(:tile_flip))
|
55
|
+
render
|
56
|
+
end
|
81
57
|
|
82
|
-
|
83
|
-
|
84
|
-
|
58
|
+
private
|
59
|
+
|
60
|
+
def render
|
61
|
+
scaled_padding = @padding * @scale
|
62
|
+
scaled_spacing = @spacing * @scale
|
63
|
+
scaled_tile_width = @tile_width * @scale
|
64
|
+
scaled_tile_height = @tile_height * @scale
|
65
|
+
scaled_width = @width * @scale
|
66
|
+
scaled_height = @height * @scale
|
67
|
+
|
68
|
+
@tiles.each do |tile|
|
69
|
+
crop = {
|
70
|
+
x: scaled_padding + (tile.fetch(:tile_x) * (scaled_spacing + scaled_tile_width)),
|
71
|
+
y: scaled_padding + (tile.fetch(:tile_y) * (scaled_spacing + scaled_tile_height)),
|
72
|
+
width: scaled_tile_width,
|
73
|
+
height: scaled_tile_height,
|
74
|
+
image_width: scaled_width,
|
75
|
+
image_height: scaled_height,
|
76
|
+
}
|
77
|
+
|
78
|
+
color = defined?(@color) ? @color : DEFAULT_COLOR
|
79
|
+
|
80
|
+
vertices = Vertices.new(tile.fetch(:x), tile.fetch(:y), scaled_tile_width, scaled_tile_height, tile.fetch(:tile_rotate), crop: crop, flip: tile.fetch(:tile_flip))
|
81
|
+
|
82
|
+
@texture.draw(
|
83
|
+
vertices.coordinates, vertices.texture_coordinates, color
|
84
|
+
)
|
85
|
+
end
|
85
86
|
end
|
86
87
|
end
|
87
88
|
end
|
data/lib/ruby2d/version.rb
CHANGED
data/lib/ruby2d/vertices.rb
CHANGED
@@ -30,10 +30,17 @@ module Ruby2D
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def coordinates
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
if @rotate == 0
|
34
|
+
x1, y1 = @x, @y; # Top left
|
35
|
+
x2, y2 = @x + @width, @y; # Top right
|
36
|
+
x3, y3 = @x + @width, @y + @height; # Bottom right
|
37
|
+
x4, y4 = @x, @y + @height; # Bottom left
|
38
|
+
else
|
39
|
+
x1, y1 = rotate(@x, @y); # Top left
|
40
|
+
x2, y2 = rotate(@x + @width, @y); # Top right
|
41
|
+
x3, y3 = rotate(@x + @width, @y + @height); # Bottom right
|
42
|
+
x4, y4 = rotate(@x, @y + @height); # Bottom left
|
43
|
+
end
|
37
44
|
|
38
45
|
[ x1, y1, x2, y2, x3, y3, x4, y4 ]
|
39
46
|
end
|
@@ -57,8 +64,6 @@ module Ruby2D
|
|
57
64
|
private
|
58
65
|
|
59
66
|
def rotate(x, y)
|
60
|
-
return [x, y] if @rotate == 0
|
61
|
-
|
62
67
|
# Convert from degrees to radians
|
63
68
|
angle = @rotate * Math::PI / 180.0
|
64
69
|
|
data/lib/ruby2d.rb
CHANGED
@@ -24,35 +24,29 @@ unless RUBY_ENGINE == 'mruby'
|
|
24
24
|
require 'ruby2d/music'
|
25
25
|
require 'ruby2d/texture'
|
26
26
|
require 'ruby2d/vertices'
|
27
|
-
|
28
|
-
if defined?(RubyInstaller)
|
29
|
-
s2d_dll_path = Gem::Specification.find_by_name('ruby2d').gem_dir + '/assets/mingw/bin'
|
30
|
-
RubyInstaller::Runtime.add_dll_directory(File.expand_path(s2d_dll_path))
|
31
|
-
end
|
32
|
-
|
33
27
|
require 'ruby2d/ruby2d' # load native extension
|
34
28
|
end
|
35
29
|
|
36
30
|
|
37
31
|
module Ruby2D
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
if RUBY_ENGINE == 'mruby'
|
45
|
-
@assets = Ruby2D.ext_base_path + 'assets'
|
46
|
-
else
|
47
|
-
@assets = './assets'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
@assets
|
32
|
+
def self.gem_dir
|
33
|
+
# mruby doesn't define `Gem`
|
34
|
+
if RUBY_ENGINE == 'mruby'
|
35
|
+
`ruby -e "print Gem::Specification.find_by_name('ruby2d').gem_dir"`
|
36
|
+
else
|
37
|
+
Gem::Specification.find_by_name('ruby2d').gem_dir
|
51
38
|
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.assets
|
42
|
+
"#{gem_dir}/assets"
|
43
|
+
end
|
52
44
|
|
53
|
-
|
45
|
+
def self.test_media
|
46
|
+
"#{gem_dir}/assets/test_media"
|
54
47
|
end
|
55
48
|
end
|
56
49
|
|
50
|
+
|
57
51
|
include Ruby2D
|
58
52
|
extend Ruby2D::DSL
|