ruby2d 0.10.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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 +68 -46
- data/ext/ruby2d/font.c +35 -0
- data/ext/ruby2d/gl.c +9 -58
- data/ext/ruby2d/gl2.c +8 -83
- data/ext/ruby2d/gl3.c +57 -116
- data/ext/ruby2d/gles.c +130 -151
- data/ext/ruby2d/image.c +16 -96
- data/ext/ruby2d/ruby2d.c +265 -298
- data/ext/ruby2d/ruby2d.h +69 -159
- data/ext/ruby2d/sound.c +1 -1
- data/ext/ruby2d/text.c +20 -114
- data/ext/ruby2d/window.c +257 -219
- data/lib/ruby2d/circle.rb +3 -1
- data/lib/ruby2d/cli/build.rb +239 -59
- data/lib/ruby2d/cli/colorize.rb +5 -4
- data/lib/ruby2d/cli/platform.rb +17 -0
- data/lib/ruby2d/font.rb +26 -1
- data/lib/ruby2d/image.rb +22 -17
- data/lib/ruby2d/line.rb +3 -1
- data/lib/ruby2d/quad.rb +3 -1
- data/lib/ruby2d/rectangle.rb +1 -1
- data/lib/ruby2d/renderable.rb +0 -12
- data/lib/ruby2d/sound.rb +25 -0
- data/lib/ruby2d/sprite.rb +44 -89
- data/lib/ruby2d/square.rb +1 -1
- data/lib/ruby2d/text.rb +40 -20
- data/lib/ruby2d/texture.rb +28 -0
- data/lib/ruby2d/tileset.rb +47 -28
- data/lib/ruby2d/triangle.rb +3 -1
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +89 -0
- data/lib/ruby2d/window.rb +13 -3
- data/lib/ruby2d.rb +16 -20
- metadata +249 -153
- 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/sprite.c +0 -147
- data/ext/ruby2d/tileset.c +0 -30
data/ext/ruby2d/gl.c
CHANGED
|
@@ -20,7 +20,7 @@ static GLfloat orthoMatrix[16] =
|
|
|
20
20
|
/*
|
|
21
21
|
* Prints current GL error
|
|
22
22
|
*/
|
|
23
|
-
void R2D_GL_PrintError(char *error) {
|
|
23
|
+
void R2D_GL_PrintError(const char *error) {
|
|
24
24
|
R2D_Log(R2D_ERROR, "%s (%d)", error, glGetError());
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -69,7 +69,7 @@ void R2D_GL_StoreContextInfo(R2D_Window *window) {
|
|
|
69
69
|
* Creates a shader object, loads shader string, and compiles.
|
|
70
70
|
* Returns 0 if shader could not be compiled.
|
|
71
71
|
*/
|
|
72
|
-
GLuint R2D_GL_LoadShader(GLenum type, const GLchar *shaderSrc, char *shaderName) {
|
|
72
|
+
GLuint R2D_GL_LoadShader(GLenum type, const GLchar *shaderSrc, const char *shaderName) {
|
|
73
73
|
|
|
74
74
|
// Create the shader object
|
|
75
75
|
GLuint shader = glCreateShader(type);
|
|
@@ -111,7 +111,7 @@ GLuint R2D_GL_LoadShader(GLenum type, const GLchar *shaderSrc, char *shaderName)
|
|
|
111
111
|
/*
|
|
112
112
|
* Check if shader program was linked
|
|
113
113
|
*/
|
|
114
|
-
int R2D_GL_CheckLinked(GLuint program, char *name) {
|
|
114
|
+
int R2D_GL_CheckLinked(GLuint program, const char *name) {
|
|
115
115
|
|
|
116
116
|
GLint linked;
|
|
117
117
|
glGetProgramiv(program, GL_LINK_STATUS, &linked);
|
|
@@ -361,65 +361,16 @@ void R2D_GL_DrawTriangle(GLfloat x1, GLfloat y1,
|
|
|
361
361
|
|
|
362
362
|
|
|
363
363
|
/*
|
|
364
|
-
* Draw
|
|
364
|
+
* Draw a texture
|
|
365
365
|
*/
|
|
366
|
-
void
|
|
366
|
+
void R2D_GL_DrawTexture(GLfloat coordinates[], GLfloat texture_coordinates[], GLfloat color[], int texture_id) {
|
|
367
367
|
#if GLES
|
|
368
|
-
|
|
368
|
+
R2D_GLES_DrawTexture(coordinates, texture_coordinates, color, texture_id);
|
|
369
369
|
#else
|
|
370
370
|
if (R2D_GL2) {
|
|
371
|
-
|
|
371
|
+
R2D_GL2_DrawTexture(coordinates, texture_coordinates, color, texture_id);
|
|
372
372
|
} else {
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
#endif
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
/*
|
|
380
|
-
* Draw sprite
|
|
381
|
-
*/
|
|
382
|
-
void R2D_GL_DrawSprite(R2D_Sprite *spr) {
|
|
383
|
-
#if GLES
|
|
384
|
-
R2D_GLES_DrawSprite(spr);
|
|
385
|
-
#else
|
|
386
|
-
if (R2D_GL2) {
|
|
387
|
-
R2D_GL2_DrawSprite(spr);
|
|
388
|
-
} else {
|
|
389
|
-
R2D_GL3_DrawSprite(spr);
|
|
390
|
-
}
|
|
391
|
-
#endif
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
/*
|
|
396
|
-
* Draw a tile
|
|
397
|
-
*/
|
|
398
|
-
void R2D_GL_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
|
399
|
-
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
|
400
|
-
#if GLES
|
|
401
|
-
R2D_GLES_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
|
402
|
-
#else
|
|
403
|
-
if (R2D_GL2) {
|
|
404
|
-
R2D_GL2_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
|
405
|
-
} else {
|
|
406
|
-
R2D_GL3_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
|
407
|
-
}
|
|
408
|
-
#endif
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
/*
|
|
413
|
-
* Draw text
|
|
414
|
-
*/
|
|
415
|
-
void R2D_GL_DrawText(R2D_Text *txt) {
|
|
416
|
-
#if GLES
|
|
417
|
-
R2D_GLES_DrawText(txt);
|
|
418
|
-
#else
|
|
419
|
-
if (R2D_GL2) {
|
|
420
|
-
R2D_GL2_DrawText(txt);
|
|
421
|
-
} else {
|
|
422
|
-
R2D_GL3_DrawText(txt);
|
|
373
|
+
R2D_GL3_DrawTexture(coordinates, texture_coordinates, color, texture_id);
|
|
423
374
|
}
|
|
424
375
|
#endif
|
|
425
376
|
}
|
|
@@ -431,7 +382,7 @@ void R2D_GL_DrawText(R2D_Text *txt) {
|
|
|
431
382
|
void R2D_GL_FlushBuffers() {
|
|
432
383
|
// Only implemented in our OpenGL 3.3+ and ES 2.0 renderers
|
|
433
384
|
#if GLES
|
|
434
|
-
|
|
385
|
+
R2D_GLES_FlushBuffers();
|
|
435
386
|
#else
|
|
436
387
|
if (!R2D_GL2) R2D_GL3_FlushBuffers();
|
|
437
388
|
#endif
|
data/ext/ruby2d/gl2.c
CHANGED
|
@@ -64,98 +64,23 @@ void R2D_GL2_DrawTriangle(GLfloat x1, GLfloat y1,
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
/*
|
|
67
|
-
* Draw texture
|
|
67
|
+
* Draw a texture (New method with vertices pre-calculated)
|
|
68
68
|
*/
|
|
69
|
-
|
|
70
|
-
GLfloat angle, GLfloat rx, GLfloat ry,
|
|
71
|
-
GLfloat r, GLfloat g, GLfloat b, GLfloat a,
|
|
72
|
-
GLfloat tx1, GLfloat ty1, GLfloat tx2, GLfloat ty2,
|
|
73
|
-
GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4,
|
|
74
|
-
GLuint texture_id) {
|
|
75
|
-
|
|
76
|
-
R2D_GL_Point v1 = { .x = x, .y = y };
|
|
77
|
-
R2D_GL_Point v2 = { .x = x + w, .y = y };
|
|
78
|
-
R2D_GL_Point v3 = { .x = x + w, .y = y + h };
|
|
79
|
-
R2D_GL_Point v4 = { .x = x, .y = y + h };
|
|
80
|
-
|
|
81
|
-
// Rotate vertices
|
|
82
|
-
if (angle != 0) {
|
|
83
|
-
v1 = R2D_RotatePoint(v1, angle, rx, ry);
|
|
84
|
-
v2 = R2D_RotatePoint(v2, angle, rx, ry);
|
|
85
|
-
v3 = R2D_RotatePoint(v3, angle, rx, ry);
|
|
86
|
-
v4 = R2D_RotatePoint(v4, angle, rx, ry);
|
|
87
|
-
}
|
|
88
|
-
|
|
69
|
+
void R2D_GL2_DrawTexture(GLfloat coordinates[], GLfloat texture_coordinates[], GLfloat color[], int texture_id) {
|
|
89
70
|
glEnable(GL_TEXTURE_2D);
|
|
90
71
|
|
|
91
72
|
glBindTexture(GL_TEXTURE_2D, texture_id);
|
|
92
73
|
|
|
93
74
|
glBegin(GL_QUADS);
|
|
94
|
-
glColor4f(
|
|
95
|
-
glTexCoord2f(
|
|
96
|
-
glTexCoord2f(
|
|
97
|
-
glTexCoord2f(
|
|
98
|
-
glTexCoord2f(
|
|
75
|
+
glColor4f(color[0], color[1], color[2], color[3]);
|
|
76
|
+
glTexCoord2f(texture_coordinates[0], texture_coordinates[1]); glVertex2f(coordinates[0], coordinates[1]);
|
|
77
|
+
glTexCoord2f(texture_coordinates[2], texture_coordinates[3]); glVertex2f(coordinates[2], coordinates[3]);
|
|
78
|
+
glTexCoord2f(texture_coordinates[4], texture_coordinates[5]); glVertex2f(coordinates[4], coordinates[5]);
|
|
79
|
+
glTexCoord2f(texture_coordinates[6], texture_coordinates[7]); glVertex2f(coordinates[6], coordinates[7]);
|
|
99
80
|
glEnd();
|
|
100
81
|
|
|
101
82
|
glDisable(GL_TEXTURE_2D);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/*
|
|
106
|
-
* Draw image
|
|
107
|
-
*/
|
|
108
|
-
void R2D_GL2_DrawImage(R2D_Image *img) {
|
|
109
|
-
R2D_GL2_DrawTexture(
|
|
110
|
-
img->x, img->y, img->width, img->height,
|
|
111
|
-
img->rotate, img->rx, img->ry,
|
|
112
|
-
img->color.r, img->color.g, img->color.b, img->color.a,
|
|
113
|
-
0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 1.f,
|
|
114
|
-
img->texture_id
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
* Draw sprite
|
|
121
|
-
*/
|
|
122
|
-
void R2D_GL2_DrawSprite(R2D_Sprite *spr) {
|
|
123
|
-
R2D_GL2_DrawTexture(
|
|
124
|
-
spr->x, spr->y, spr->width, spr->height,
|
|
125
|
-
spr->rotate, spr->rx, spr->ry,
|
|
126
|
-
spr->color.r, spr->color.g, spr->color.b, spr->color.a,
|
|
127
|
-
spr->tx1, spr->ty1, spr->tx2, spr->ty2, spr->tx3, spr->ty3, spr->tx4, spr->ty4,
|
|
128
|
-
spr->img->texture_id
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
83
|
+
};
|
|
132
84
|
|
|
133
|
-
/*
|
|
134
|
-
* Draw a tile
|
|
135
|
-
*/
|
|
136
|
-
void R2D_GL2_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
|
137
|
-
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
|
138
|
-
R2D_GL2_DrawTexture(
|
|
139
|
-
x, y, tw, th,
|
|
140
|
-
img->rotate, img->rx, img->ry,
|
|
141
|
-
img->color.r, img->color.g, img->color.b, img->color.a,
|
|
142
|
-
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4,
|
|
143
|
-
img->texture_id
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/*
|
|
149
|
-
* Draw text
|
|
150
|
-
*/
|
|
151
|
-
void R2D_GL2_DrawText(R2D_Text *txt) {
|
|
152
|
-
R2D_GL2_DrawTexture(
|
|
153
|
-
txt->x, txt->y, txt->width, txt->height,
|
|
154
|
-
txt->rotate, txt->rx, txt->ry,
|
|
155
|
-
txt->color.r, txt->color.g, txt->color.b, txt->color.a,
|
|
156
|
-
0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 1.f,
|
|
157
|
-
txt->texture_id
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
85
|
|
|
161
86
|
#endif
|
data/ext/ruby2d/gl3.c
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
#include "ruby2d.h"
|
|
4
4
|
|
|
5
|
-
// Skip this file if OpenGL ES
|
|
6
5
|
#if !GLES
|
|
7
6
|
|
|
8
7
|
static GLuint vbo; // our primary vertex buffer object (VBO)
|
|
@@ -10,12 +9,10 @@ static GLuint vboSize; // size of the VBO in bytes
|
|
|
10
9
|
static GLfloat *vboData; // pointer to the VBO data
|
|
11
10
|
static GLfloat *vboDataCurrent; // pointer to the data for the current vertices
|
|
12
11
|
static GLuint vboDataIndex = 0; // index of the current object being rendered
|
|
13
|
-
static GLuint vboObjCapacity =
|
|
12
|
+
static GLuint vboObjCapacity = 7500; // number of objects the VBO can store
|
|
13
|
+
static GLuint verticesTextureIds[7500]; // store the texture_id of each vertices
|
|
14
14
|
static GLuint shaderProgram; // triangle shader program
|
|
15
15
|
static GLuint texShaderProgram; // texture shader program
|
|
16
|
-
static GLuint indices[] = // indices for rendering textured quads
|
|
17
|
-
{ 0, 1, 2,
|
|
18
|
-
2, 3, 0 };
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
/*
|
|
@@ -106,7 +103,7 @@ int R2D_GL3_Init() {
|
|
|
106
103
|
// Create a vertex buffer object and allocate data
|
|
107
104
|
glGenBuffers(1, &vbo);
|
|
108
105
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
|
109
|
-
vboSize = vboObjCapacity * sizeof(GLfloat) *
|
|
106
|
+
vboSize = vboObjCapacity * sizeof(GLfloat) * 8;
|
|
110
107
|
vboData = (GLfloat *) malloc(vboSize);
|
|
111
108
|
vboDataCurrent = vboData;
|
|
112
109
|
|
|
@@ -207,17 +204,39 @@ int R2D_GL3_Init() {
|
|
|
207
204
|
* Render the vertex buffer and reset it
|
|
208
205
|
*/
|
|
209
206
|
void R2D_GL3_FlushBuffers() {
|
|
210
|
-
|
|
211
|
-
// Use the triangle shader program
|
|
212
|
-
glUseProgram(shaderProgram);
|
|
213
|
-
|
|
214
207
|
// Bind to the vertex buffer object and update its data
|
|
215
208
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
|
209
|
+
|
|
216
210
|
glBufferData(GL_ARRAY_BUFFER, vboSize, NULL, GL_DYNAMIC_DRAW);
|
|
217
|
-
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * vboDataIndex *
|
|
211
|
+
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * vboDataIndex * 8, vboData);
|
|
212
|
+
|
|
213
|
+
GLuint verticesOffset = 0;
|
|
214
|
+
GLuint lastTextureId = verticesTextureIds[0];
|
|
215
|
+
|
|
216
|
+
for (GLuint i = 0; i <= vboDataIndex; i++) {
|
|
217
|
+
if(lastTextureId != verticesTextureIds[i] || i == vboDataIndex) {
|
|
218
|
+
// A texture ID of 0 represents no texture (render a triangle)
|
|
219
|
+
if(lastTextureId == 0) {
|
|
220
|
+
|
|
221
|
+
// Use the triangle shader program
|
|
222
|
+
glUseProgram(shaderProgram);
|
|
223
|
+
|
|
224
|
+
// A number other than 0 represents a texture_id
|
|
225
|
+
} else {
|
|
226
|
+
|
|
227
|
+
// Use the texture shader program
|
|
228
|
+
glUseProgram(texShaderProgram);
|
|
229
|
+
|
|
230
|
+
// Bind the texture using the provided ID
|
|
231
|
+
glBindTexture(GL_TEXTURE_2D, lastTextureId);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
glDrawArrays(GL_TRIANGLES, verticesOffset, i - verticesOffset);
|
|
218
235
|
|
|
219
|
-
|
|
220
|
-
|
|
236
|
+
lastTextureId = verticesTextureIds[i];
|
|
237
|
+
verticesOffset = i;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
221
240
|
|
|
222
241
|
// Reset the buffer object index and data pointer
|
|
223
242
|
vboDataIndex = 0;
|
|
@@ -236,10 +255,10 @@ void R2D_GL3_DrawTriangle(GLfloat x1, GLfloat y1,
|
|
|
236
255
|
GLfloat r3, GLfloat g3, GLfloat b3, GLfloat a3) {
|
|
237
256
|
|
|
238
257
|
// If buffer is full, flush it
|
|
239
|
-
if (vboDataIndex >= vboObjCapacity) R2D_GL3_FlushBuffers();
|
|
258
|
+
if (vboDataIndex + 3 >= vboObjCapacity) R2D_GL3_FlushBuffers();
|
|
240
259
|
|
|
241
260
|
// Set the triangle data into a formatted array
|
|
242
|
-
GLfloat vertices[] =
|
|
261
|
+
GLfloat vertices[24] =
|
|
243
262
|
{ x1, y1, r1, g1, b1, a1, 0, 0,
|
|
244
263
|
x2, y2, r2, g2, b2, a2, 0, 0,
|
|
245
264
|
x3, y3, r3, g3, b3, a3, 0, 0 };
|
|
@@ -248,116 +267,38 @@ void R2D_GL3_DrawTriangle(GLfloat x1, GLfloat y1,
|
|
|
248
267
|
memcpy(vboDataCurrent, vertices, sizeof(vertices));
|
|
249
268
|
|
|
250
269
|
// Increment the buffer object index and the vertex data pointer for next use
|
|
251
|
-
vboDataIndex
|
|
270
|
+
verticesTextureIds[vboDataIndex] = verticesTextureIds[vboDataIndex + 1] = verticesTextureIds[vboDataIndex + 2] = 0;
|
|
271
|
+
vboDataIndex += 3;
|
|
252
272
|
vboDataCurrent = (GLfloat *)((char *)vboDataCurrent + (sizeof(GLfloat) * 24));
|
|
253
273
|
}
|
|
254
274
|
|
|
255
275
|
|
|
256
276
|
/*
|
|
257
|
-
* Draw a texture
|
|
277
|
+
* Draw a texture (New method with vertices pre-calculated)
|
|
258
278
|
*/
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
R2D_GL_Point v4 = { .x = x, .y = y + h };
|
|
275
|
-
|
|
276
|
-
// Rotate vertices
|
|
277
|
-
if (angle != 0) {
|
|
278
|
-
v1 = R2D_RotatePoint(v1, angle, rx, ry);
|
|
279
|
-
v2 = R2D_RotatePoint(v2, angle, rx, ry);
|
|
280
|
-
v3 = R2D_RotatePoint(v3, angle, rx, ry);
|
|
281
|
-
v4 = R2D_RotatePoint(v4, angle, rx, ry);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// Set the textured quad data into a formatted array
|
|
285
|
-
GLfloat vertices[] =
|
|
286
|
-
// vertex coords | colors | x, y texture coords
|
|
287
|
-
{ v1.x, v1.y, r, g, b, a, tx1, ty1, // Top-left
|
|
288
|
-
v2.x, v2.y, r, g, b, a, tx2, ty2, // Top-right
|
|
289
|
-
v3.x, v3.y, r, g, b, a, tx3, ty3, // Bottom-right
|
|
290
|
-
v4.x, v4.y, r, g, b, a, tx4, ty4 }; // Bottom-left
|
|
291
|
-
|
|
292
|
-
// Use the texture shader program
|
|
293
|
-
glUseProgram(texShaderProgram);
|
|
294
|
-
|
|
295
|
-
// Bind the texture using the provided ID
|
|
296
|
-
glBindTexture(GL_TEXTURE_2D, texture_id);
|
|
297
|
-
|
|
298
|
-
// Create and Initialize the vertex data and array indices
|
|
299
|
-
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
|
300
|
-
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
|
|
301
|
-
|
|
302
|
-
// Render the textured quad
|
|
303
|
-
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
/*
|
|
308
|
-
* Draw image
|
|
309
|
-
*/
|
|
310
|
-
void R2D_GL3_DrawImage(R2D_Image *img) {
|
|
311
|
-
R2D_GL3_DrawTexture(
|
|
312
|
-
img->x, img->y, img->width, img->height,
|
|
313
|
-
img->rotate, img->rx, img->ry,
|
|
314
|
-
img->color.r, img->color.g, img->color.b, img->color.a,
|
|
315
|
-
0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 1.f,
|
|
316
|
-
img->texture_id
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
/*
|
|
322
|
-
* Draw sprite
|
|
323
|
-
*/
|
|
324
|
-
void R2D_GL3_DrawSprite(R2D_Sprite *spr) {
|
|
325
|
-
R2D_GL3_DrawTexture(
|
|
326
|
-
spr->x, spr->y, spr->width, spr->height,
|
|
327
|
-
spr->rotate, spr->rx, spr->ry,
|
|
328
|
-
spr->color.r, spr->color.g, spr->color.b, spr->color.a,
|
|
329
|
-
spr->tx1, spr->ty1, spr->tx2, spr->ty2, spr->tx3, spr->ty3, spr->tx4, spr->ty4,
|
|
330
|
-
spr->img->texture_id
|
|
331
|
-
);
|
|
332
|
-
}
|
|
279
|
+
void R2D_GL3_DrawTexture(GLfloat coordinates[], GLfloat texture_coordinates[], GLfloat color[], int texture_id) {
|
|
280
|
+
// If buffer is full, flush it
|
|
281
|
+
if (vboDataIndex + 6 >= vboObjCapacity) R2D_GL3_FlushBuffers();
|
|
282
|
+
|
|
283
|
+
// There are 6 vertices for a square as we are rendering two Triangles to make up our square:
|
|
284
|
+
// Triangle one: Top left, Top right, Bottom right
|
|
285
|
+
// Triangle two: Bottom right, Bottom left, Top left
|
|
286
|
+
GLfloat vertices[48] = {
|
|
287
|
+
coordinates[0], coordinates[1], color[0], color[1], color[2], color[3], texture_coordinates[0], texture_coordinates[1],
|
|
288
|
+
coordinates[2], coordinates[3], color[0], color[1], color[2], color[3], texture_coordinates[2], texture_coordinates[3],
|
|
289
|
+
coordinates[4], coordinates[5], color[0], color[1], color[2], color[3], texture_coordinates[4], texture_coordinates[5],
|
|
290
|
+
coordinates[4], coordinates[5], color[0], color[1], color[2], color[3], texture_coordinates[4], texture_coordinates[5],
|
|
291
|
+
coordinates[6], coordinates[7], color[0], color[1], color[2], color[3], texture_coordinates[6], texture_coordinates[7],
|
|
292
|
+
coordinates[0], coordinates[1], color[0], color[1], color[2], color[3], texture_coordinates[0], texture_coordinates[1],
|
|
293
|
+
};
|
|
333
294
|
|
|
295
|
+
// Copy the vertex data into the current position of the buffer
|
|
296
|
+
memcpy(vboDataCurrent, vertices, sizeof(vertices));
|
|
334
297
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
void R2D_GL3_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
|
339
|
-
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
|
340
|
-
R2D_GL3_DrawTexture(
|
|
341
|
-
x, y, tw, th,
|
|
342
|
-
img->rotate, img->rx, img->ry,
|
|
343
|
-
img->color.r, img->color.g, img->color.b, img->color.a,
|
|
344
|
-
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4,
|
|
345
|
-
img->texture_id
|
|
346
|
-
);
|
|
298
|
+
verticesTextureIds[vboDataIndex] = verticesTextureIds[vboDataIndex + 1] = verticesTextureIds[vboDataIndex + 2] = verticesTextureIds[vboDataIndex + 3] = verticesTextureIds[vboDataIndex + 4] = verticesTextureIds[vboDataIndex + 5] = texture_id;
|
|
299
|
+
vboDataIndex += 6;
|
|
300
|
+
vboDataCurrent = (GLfloat *)((char *)vboDataCurrent + (sizeof(GLfloat) * 48));
|
|
347
301
|
}
|
|
348
302
|
|
|
349
303
|
|
|
350
|
-
/*
|
|
351
|
-
* Draw text
|
|
352
|
-
*/
|
|
353
|
-
void R2D_GL3_DrawText(R2D_Text *txt) {
|
|
354
|
-
R2D_GL3_DrawTexture(
|
|
355
|
-
txt->x, txt->y, txt->width, txt->height,
|
|
356
|
-
txt->rotate, txt->rx, txt->ry,
|
|
357
|
-
txt->color.r, txt->color.g, txt->color.b, txt->color.a,
|
|
358
|
-
0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 1.f,
|
|
359
|
-
txt->texture_id
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
304
|
#endif
|