gosu 1.5.0 → 2.0.0.pre6
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/dependencies/SDL/include/SDL.h +233 -0
- data/dependencies/SDL/include/SDL_assert.h +320 -0
- data/dependencies/SDL/include/SDL_atomic.h +414 -0
- data/dependencies/SDL/include/SDL_audio.h +1500 -0
- data/dependencies/SDL/include/{SDL3/SDL_bits.h → SDL_bits.h} +27 -47
- data/dependencies/SDL/include/{SDL3/SDL_blendmode.h → SDL_blendmode.h} +55 -59
- data/dependencies/SDL/include/SDL_clipboard.h +141 -0
- data/dependencies/SDL/include/SDL_config.h +331 -0
- data/dependencies/SDL/include/SDL_cpuinfo.h +594 -0
- data/dependencies/SDL/include/{SDL3/SDL_egl.h → SDL_egl.h} +8 -11
- data/dependencies/SDL/include/SDL_endian.h +348 -0
- data/dependencies/SDL/include/SDL_error.h +163 -0
- data/dependencies/SDL/include/SDL_events.h +1166 -0
- data/dependencies/SDL/include/SDL_filesystem.h +149 -0
- data/dependencies/SDL/include/SDL_gamecontroller.h +1074 -0
- data/dependencies/SDL/include/SDL_gesture.h +117 -0
- data/dependencies/SDL/include/SDL_guid.h +100 -0
- data/dependencies/SDL/include/SDL_haptic.h +1341 -0
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +2613 -0
- data/dependencies/SDL/include/SDL_joystick.h +1069 -0
- data/dependencies/SDL/include/SDL_keyboard.h +353 -0
- data/dependencies/SDL/include/SDL_keycode.h +358 -0
- data/dependencies/SDL/include/SDL_loadso.h +115 -0
- data/dependencies/SDL/include/{SDL3/SDL_locale.h → SDL_locale.h} +24 -40
- data/dependencies/SDL/include/SDL_log.h +404 -0
- data/dependencies/SDL/include/SDL_main.h +282 -0
- data/dependencies/SDL/include/{SDL3/SDL_messagebox.h → SDL_messagebox.h} +48 -85
- data/dependencies/SDL/include/{SDL3/SDL_metal.h → SDL_metal.h} +29 -29
- data/dependencies/SDL/include/{SDL3/SDL_misc.h → SDL_misc.h} +12 -13
- data/dependencies/SDL/include/SDL_mouse.h +464 -0
- data/dependencies/SDL/include/SDL_mutex.h +545 -0
- data/dependencies/SDL/include/SDL_name.h +33 -0
- data/dependencies/SDL/include/{SDL3/SDL_opengl.h → SDL_opengl.h} +252 -1221
- data/dependencies/SDL/include/{SDL3/SDL_opengles.h → SDL_opengles.h} +7 -6
- data/dependencies/SDL/include/{SDL3/SDL_opengles2.h → SDL_opengles2.h} +11 -10
- data/dependencies/SDL/include/SDL_pixels.h +644 -0
- data/dependencies/SDL/include/SDL_platform.h +261 -0
- data/dependencies/SDL/include/{SDL3/SDL_power.h → SDL_power.h} +19 -40
- data/dependencies/SDL/include/SDL_quit.h +58 -0
- data/dependencies/SDL/include/SDL_rect.h +376 -0
- data/dependencies/SDL/include/SDL_render.h +1924 -0
- data/dependencies/SDL/include/SDL_revision.h +7 -0
- data/dependencies/SDL/include/SDL_rwops.h +841 -0
- data/dependencies/SDL/include/{SDL3/SDL_scancode.h → SDL_scancode.h} +68 -60
- data/dependencies/SDL/include/SDL_sensor.h +322 -0
- data/dependencies/SDL/include/SDL_shape.h +155 -0
- data/dependencies/SDL/include/SDL_stdinc.h +838 -0
- data/dependencies/SDL/include/SDL_surface.h +997 -0
- data/dependencies/SDL/include/SDL_system.h +623 -0
- data/dependencies/SDL/include/SDL_syswm.h +386 -0
- data/dependencies/SDL/include/{SDL3/SDL_test.h → SDL_test.h} +22 -16
- data/dependencies/SDL/include/{SDL3/SDL_test_assert.h → SDL_test_assert.h} +34 -27
- data/dependencies/SDL/include/{SDL3/SDL_test_common.h → SDL_test_common.h} +52 -109
- data/dependencies/SDL/include/{SDL3/SDL_test_compare.h → SDL_test_compare.h} +14 -22
- data/dependencies/SDL/include/{SDL3/SDL_test_crc32.h → SDL_test_crc32.h} +30 -27
- data/dependencies/SDL/include/{SDL3/SDL_test_font.h → SDL_test_font.h} +49 -50
- data/dependencies/SDL/include/{SDL3/SDL_test_fuzzer.h → SDL_test_fuzzer.h} +79 -64
- data/dependencies/SDL/include/{SDL3/SDL_test_harness.h → SDL_test_harness.h} +30 -47
- data/dependencies/SDL/include/SDL_test_images.h +78 -0
- data/dependencies/SDL/include/{SDL3/SDL_platform.h → SDL_test_log.h} +26 -25
- data/dependencies/SDL/include/{SDL3/SDL_test_md5.h → SDL_test_md5.h} +28 -21
- data/dependencies/SDL/include/{SDL3/SDL_test_memory.h → SDL_test_memory.h} +16 -19
- data/dependencies/SDL/include/SDL_test_random.h +115 -0
- data/dependencies/SDL/include/SDL_thread.h +464 -0
- data/dependencies/SDL/include/SDL_timer.h +222 -0
- data/dependencies/SDL/include/SDL_touch.h +150 -0
- data/dependencies/SDL/include/{SDL3/SDL_copying.h → SDL_types.h} +9 -2
- data/dependencies/SDL/include/SDL_version.h +204 -0
- data/dependencies/SDL/include/SDL_video.h +2178 -0
- data/dependencies/SDL/include/SDL_vulkan.h +215 -0
- data/dependencies/SDL/include/begin_code.h +187 -0
- data/dependencies/SDL/include/{SDL3/SDL_close_code.h → close_code.h} +6 -7
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +215 -136
- data/dependencies/SDL_sound/SDL_sound.h +725 -0
- data/dependencies/SDL_sound/SDL_sound_aiff.c +54 -55
- data/dependencies/SDL_sound/SDL_sound_au.c +32 -32
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +41 -24
- data/dependencies/SDL_sound/SDL_sound_flac.c +12 -32
- data/dependencies/SDL_sound/SDL_sound_internal.h +48 -33
- data/dependencies/SDL_sound/SDL_sound_modplug.c +29 -21
- data/dependencies/SDL_sound/SDL_sound_mp3.c +13 -35
- data/dependencies/SDL_sound/SDL_sound_raw.c +15 -14
- data/dependencies/SDL_sound/SDL_sound_shn.c +82 -82
- data/dependencies/SDL_sound/SDL_sound_voc.c +30 -30
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +25 -34
- data/dependencies/SDL_sound/SDL_sound_wav.c +82 -86
- data/dependencies/SDL_sound/dr_flac.h +1281 -1845
- data/dependencies/SDL_sound/dr_mp3.h +617 -1035
- data/dependencies/SDL_sound/libmodplug/fastmix.c +1 -1
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +4 -5
- data/dependencies/SDL_sound/libmodplug/load_ams.c +3 -6
- data/dependencies/SDL_sound/libmodplug/load_dsm.c +1 -2
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +2 -2
- data/dependencies/SDL_sound/libmodplug/modplug.h +1 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +3 -3
- data/dependencies/SDL_sound/libmodplug/sndfile.c +0 -3
- data/dependencies/SDL_sound/libmodplug/sndmix.c +3 -7
- data/dependencies/SDL_sound/stb_vorbis.h +343 -397
- data/dependencies/mojoAL/AL/alc.h +2 -2
- data/dependencies/mojoAL/mojoal.c +1878 -2113
- data/dependencies/stb/stb_image.h +1381 -1192
- data/dependencies/stb/stb_image_write.h +129 -329
- data/dependencies/stb/stb_truetype.h +60 -304
- data/dependencies/utf8proc/utf8proc.c +75 -133
- data/dependencies/utf8proc/utf8proc.h +50 -131
- data/dependencies/utf8proc/utf8proc_data.h +15658 -16213
- data/ext/gosu-ffi/extconf.rb +28 -11
- data/ext/gosu-ffi/gosu-ffi.def +0 -3
- data/ffi/Gosu.cpp +29 -52
- data/ffi/Gosu.h +4 -4
- data/ffi/Gosu_Color.cpp +36 -80
- data/ffi/Gosu_FFI_internal.h +13 -12
- data/ffi/Gosu_Font.cpp +11 -16
- data/ffi/Gosu_Font.h +4 -4
- data/ffi/Gosu_Image.cpp +36 -69
- data/ffi/Gosu_Image.h +5 -16
- data/include/Gosu/Bitmap.hpp +1 -1
- data/include/Gosu/Color.hpp +4 -5
- data/include/Gosu/Graphics.hpp +0 -2
- data/include/Gosu/Image.hpp +1 -1
- data/include/Gosu/Math.hpp +5 -5
- data/include/Gosu/Utility.hpp +1 -27
- data/include/Gosu/Version.hpp +2 -2
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/channel.rb +0 -1
- data/lib/gosu/color.rb +13 -36
- data/lib/gosu/compat.rb +14 -106
- data/lib/gosu/constants.rb +24 -24
- data/lib/gosu/ffi.rb +13 -24
- data/lib/gosu/font.rb +13 -19
- data/lib/gosu/gosu.rb +61 -101
- data/lib/gosu/image.rb +34 -72
- data/lib/gosu/sample.rb +0 -1
- data/lib/gosu/song.rb +0 -1
- data/lib/gosu/text_input.rb +1 -15
- data/lib/gosu/window.rb +10 -31
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +0 -2
- data/src/Audio.cpp +16 -22
- data/src/AudioFileSDLSound.cpp +5 -5
- data/src/BinPacker.cpp +4 -5
- data/src/Bitmap.cpp +9 -16
- data/src/Buffer.cpp +14 -5
- data/src/ClipRectStack.hpp +83 -17
- data/src/Directories.cpp +1 -1
- data/src/DrawOp.hpp +17 -14
- data/src/DrawOpQueue.hpp +31 -25
- data/src/Font.cpp +1 -1
- data/src/GosuGLView.cpp +7 -1
- data/src/Graphics.cpp +25 -32
- data/src/GraphicsImpl.hpp +24 -0
- data/src/Image.cpp +2 -2
- data/src/Input.cpp +70 -66
- data/src/Macro.cpp +26 -43
- data/src/Macro.hpp +16 -22
- data/src/Math.cpp +7 -20
- data/src/OffScreenTarget.cpp +10 -3
- data/src/OpenGLContext.cpp +8 -7
- data/src/OpenGLContext.hpp +2 -2
- data/src/RenderState.hpp +54 -30
- data/src/Resolution.cpp +38 -48
- data/src/TexChunk.cpp +2 -2
- data/src/TextInput.cpp +9 -9
- data/src/Texture.cpp +1 -1
- data/src/TiledDrawable.cpp +7 -6
- data/src/TrueTypeFontUnix.cpp +9 -12
- data/src/Utility.cpp +26 -39
- data/src/UtilityWin.cpp +2 -6
- data/src/Window.cpp +34 -54
- metadata +93 -99
- data/dependencies/SDL/include/SDL3/SDL.h +0 -91
- data/dependencies/SDL/include/SDL3/SDL_assert.h +0 -710
- data/dependencies/SDL/include/SDL3/SDL_asyncio.h +0 -550
- data/dependencies/SDL/include/SDL3/SDL_atomic.h +0 -692
- data/dependencies/SDL/include/SDL3/SDL_audio.h +0 -2382
- data/dependencies/SDL/include/SDL3/SDL_begin_code.h +0 -553
- data/dependencies/SDL/include/SDL3/SDL_camera.h +0 -535
- data/dependencies/SDL/include/SDL3/SDL_clipboard.h +0 -331
- data/dependencies/SDL/include/SDL3/SDL_cpuinfo.h +0 -374
- data/dependencies/SDL/include/SDL3/SDL_dialog.h +0 -343
- data/dependencies/SDL/include/SDL3/SDL_dlopennote.h +0 -234
- data/dependencies/SDL/include/SDL3/SDL_endian.h +0 -645
- data/dependencies/SDL/include/SDL3/SDL_error.h +0 -226
- data/dependencies/SDL/include/SDL3/SDL_events.h +0 -1651
- data/dependencies/SDL/include/SDL3/SDL_filesystem.h +0 -537
- data/dependencies/SDL/include/SDL3/SDL_gamepad.h +0 -1657
- data/dependencies/SDL/include/SDL3/SDL_gpu.h +0 -4637
- data/dependencies/SDL/include/SDL3/SDL_guid.h +0 -106
- data/dependencies/SDL/include/SDL3/SDL_haptic.h +0 -1461
- data/dependencies/SDL/include/SDL3/SDL_hidapi.h +0 -571
- data/dependencies/SDL/include/SDL3/SDL_hints.h +0 -5041
- data/dependencies/SDL/include/SDL3/SDL_init.h +0 -508
- data/dependencies/SDL/include/SDL3/SDL_intrin.h +0 -410
- data/dependencies/SDL/include/SDL3/SDL_iostream.h +0 -1379
- data/dependencies/SDL/include/SDL3/SDL_joystick.h +0 -1385
- data/dependencies/SDL/include/SDL3/SDL_keyboard.h +0 -615
- data/dependencies/SDL/include/SDL3/SDL_keycode.h +0 -348
- data/dependencies/SDL/include/SDL3/SDL_loadso.h +0 -145
- data/dependencies/SDL/include/SDL3/SDL_log.h +0 -541
- data/dependencies/SDL/include/SDL3/SDL_main.h +0 -704
- data/dependencies/SDL/include/SDL3/SDL_main_impl.h +0 -149
- data/dependencies/SDL/include/SDL3/SDL_mouse.h +0 -813
- data/dependencies/SDL/include/SDL3/SDL_mutex.h +0 -1117
- data/dependencies/SDL/include/SDL3/SDL_oldnames.h +0 -1339
- data/dependencies/SDL/include/SDL3/SDL_pen.h +0 -198
- data/dependencies/SDL/include/SDL3/SDL_pixels.h +0 -1441
- data/dependencies/SDL/include/SDL3/SDL_platform_defines.h +0 -497
- data/dependencies/SDL/include/SDL3/SDL_process.h +0 -441
- data/dependencies/SDL/include/SDL3/SDL_properties.h +0 -572
- data/dependencies/SDL/include/SDL3/SDL_rect.h +0 -528
- data/dependencies/SDL/include/SDL3/SDL_render.h +0 -3034
- data/dependencies/SDL/include/SDL3/SDL_revision.h +0 -56
- data/dependencies/SDL/include/SDL3/SDL_sensor.h +0 -321
- data/dependencies/SDL/include/SDL3/SDL_stdinc.h +0 -6186
- data/dependencies/SDL/include/SDL3/SDL_storage.h +0 -686
- data/dependencies/SDL/include/SDL3/SDL_surface.h +0 -1769
- data/dependencies/SDL/include/SDL3/SDL_system.h +0 -840
- data/dependencies/SDL/include/SDL3/SDL_test_log.h +0 -83
- data/dependencies/SDL/include/SDL3/SDL_thread.h +0 -602
- data/dependencies/SDL/include/SDL3/SDL_time.h +0 -249
- data/dependencies/SDL/include/SDL3/SDL_timer.h +0 -454
- data/dependencies/SDL/include/SDL3/SDL_touch.h +0 -184
- data/dependencies/SDL/include/SDL3/SDL_tray.h +0 -544
- data/dependencies/SDL/include/SDL3/SDL_version.h +0 -198
- data/dependencies/SDL/include/SDL3/SDL_video.h +0 -3497
- data/dependencies/SDL/include/SDL3/SDL_vulkan.h +0 -287
- data/dependencies/SDL/lib/x64/libSDL3.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL3.dll.a +0 -0
- data/dependencies/SDL_sound/SDL3_sound/SDL_sound.h +0 -755
- data/lib/SDL3.dll +0 -0
- data/lib64/SDL3.dll +0 -0
- data/src/ClipRectStack.cpp +0 -38
- /data/dependencies/SDL/include/{SDL3/SDL_opengl_glext.h → SDL_opengl_glext.h} +0 -0
- /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2.h → SDL_opengles2_gl2.h} +0 -0
- /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2ext.h → SDL_opengles2_gl2ext.h} +0 -0
- /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2platform.h → SDL_opengles2_gl2platform.h} +0 -0
- /data/dependencies/SDL/include/{SDL3/SDL_opengles2_khrplatform.h → SDL_opengles2_khrplatform.h} +0 -0
data/lib/gosu/gosu.rb
CHANGED
|
@@ -1,49 +1,38 @@
|
|
|
1
1
|
module Gosu
|
|
2
|
-
|
|
3
|
-
# without the `Gosu.` prefix after `include Gosu` (a common pattern).
|
|
4
|
-
|
|
5
|
-
module_function def fps
|
|
2
|
+
def self.fps
|
|
6
3
|
GosuFFI.check_last_error(GosuFFI.Gosu_fps())
|
|
7
4
|
end
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
def self.flush
|
|
10
7
|
GosuFFI.Gosu_flush()
|
|
11
8
|
GosuFFI.check_last_error
|
|
12
|
-
GosuFFI.check_last_gl_error
|
|
13
9
|
end
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
def self.milliseconds
|
|
16
12
|
GosuFFI.check_last_error(GosuFFI.Gosu_milliseconds())
|
|
17
13
|
end
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
def self.default_font_name
|
|
20
16
|
GosuFFI.check_last_error(GosuFFI.Gosu_default_font_name())
|
|
21
17
|
end
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
def self.user_languages
|
|
24
20
|
languages = []
|
|
25
21
|
callback = proc { |data, string| languages << string if string }
|
|
26
22
|
GosuFFI.Gosu_user_languages(callback, nil)
|
|
27
23
|
GosuFFI.check_last_error(languages)
|
|
28
24
|
end
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
raise
|
|
26
|
+
def self.gl(z = nil, &block)
|
|
27
|
+
raise "Block not given!" unless block
|
|
32
28
|
|
|
33
29
|
if z
|
|
34
|
-
# When given a Z position, Gosu.gl will not call its block immediately, but enqueue it.
|
|
35
|
-
# Ruby exceptions cannot propagate through the C++ code that calls it then, so remember
|
|
36
|
-
# the first exception (and skip the remaining blocks) until Gosu::Window re-raises it.
|
|
37
|
-
wrapped_block = proc do
|
|
38
|
-
block.call unless $gosu_gl_exception
|
|
39
|
-
rescue Exception => e
|
|
40
|
-
$gosu_gl_exception = e
|
|
41
|
-
end
|
|
30
|
+
# When given a Z position, Gosu.gl will not call its block immediately, but enqueue it for later execution.
|
|
42
31
|
# To prevent the block from getting GC'd, store it in a global variable which is cleared after Window.draw.
|
|
43
32
|
$gosu_gl_blocks ||= []
|
|
44
|
-
$gosu_gl_blocks <<
|
|
33
|
+
$gosu_gl_blocks << block
|
|
45
34
|
|
|
46
|
-
GosuFFI.Gosu_gl_z(z,
|
|
35
|
+
GosuFFI.Gosu_gl_z(z, block)
|
|
47
36
|
else
|
|
48
37
|
GosuFFI.Gosu_gl(block)
|
|
49
38
|
end
|
|
@@ -51,106 +40,77 @@ module Gosu
|
|
|
51
40
|
GosuFFI.check_last_error
|
|
52
41
|
end
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# Ruby-FFI rescues exceptions in callbacks and re-raises them as soon as the FFI call returns.
|
|
58
|
-
# (It only keeps the exception from the last callback, which is fine for blocks that are called
|
|
59
|
-
# exactly once, like in Gosu.translate.)
|
|
60
|
-
# Here, that would happen before the resulting image could be wrapped and later freed.
|
|
61
|
-
# Remember the exception and raise it ourselves instead.
|
|
62
|
-
exception = nil
|
|
63
|
-
wrapped_block = proc do
|
|
64
|
-
block.call
|
|
65
|
-
rescue Exception => e
|
|
66
|
-
exception = e
|
|
67
|
-
end
|
|
68
|
-
__image = GosuFFI.Gosu_render(width, height, wrapped_block, GosuFFI.image_flags(retro: retro, tileable: tileable))
|
|
43
|
+
def self.render(width, height, retro: false, tileable: false, &block)
|
|
44
|
+
# TODO: Exception translation from inner block
|
|
45
|
+
__image = GosuFFI.Gosu_render(width, height, block, GosuFFI.image_flags(retro: retro, tileable: tileable))
|
|
69
46
|
GosuFFI.check_last_error
|
|
70
|
-
|
|
71
|
-
raise exception if exception
|
|
72
|
-
image
|
|
47
|
+
Gosu::Image.new(__image)
|
|
73
48
|
end
|
|
74
49
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# See Gosu.render.
|
|
79
|
-
exception = nil
|
|
80
|
-
wrapped_block = proc do
|
|
81
|
-
block.call
|
|
82
|
-
rescue Exception => e
|
|
83
|
-
exception = e
|
|
84
|
-
end
|
|
85
|
-
__image = GosuFFI.Gosu_record(width, height, wrapped_block)
|
|
50
|
+
def self.record(width, height, &block)
|
|
51
|
+
# TODO: Exception translation from inner block
|
|
52
|
+
__image = GosuFFI.Gosu_record(width, height, block)
|
|
86
53
|
GosuFFI.check_last_error
|
|
87
|
-
|
|
88
|
-
raise exception if exception
|
|
89
|
-
image
|
|
54
|
+
Gosu::Image.new(__image)
|
|
90
55
|
end
|
|
91
56
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
def self.transform(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, &block)
|
|
58
|
+
# TODO: Exception translation from inner block
|
|
95
59
|
GosuFFI.Gosu_transform(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, block)
|
|
96
60
|
GosuFFI.check_last_error
|
|
97
61
|
end
|
|
98
62
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
63
|
+
def self.translate(x, y, &block)
|
|
64
|
+
# TODO: Exception translation from inner block
|
|
102
65
|
GosuFFI.Gosu_translate(x, y, block)
|
|
103
66
|
GosuFFI.check_last_error
|
|
104
67
|
end
|
|
105
68
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
69
|
+
def self.rotate(angle, around_x = 0, around_y = 0, &block)
|
|
70
|
+
# TODO: Exception translation from inner block
|
|
109
71
|
GosuFFI.Gosu_rotate(angle, around_x, around_y, block)
|
|
110
72
|
GosuFFI.check_last_error
|
|
111
73
|
end
|
|
112
74
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
75
|
+
def self.scale(x, y = x, around_x = 0, around_y = 0, &block)
|
|
76
|
+
# TODO: Exception translation from inner block
|
|
116
77
|
GosuFFI.Gosu_scale(x, y, around_x, around_y, block)
|
|
117
78
|
GosuFFI.check_last_error
|
|
118
79
|
end
|
|
119
80
|
|
|
120
81
|
# Note: On JRuby this seems to get "optimized out" for some reason
|
|
121
82
|
# For now, call jruby with the `--dev` option
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
83
|
+
def self.clip_to(x, y, width, height, &block)
|
|
84
|
+
# TODO: Exception translation from inner block
|
|
125
85
|
GosuFFI.Gosu_clip_to(x, y, width, height, block)
|
|
126
86
|
GosuFFI.check_last_error
|
|
127
87
|
end
|
|
128
88
|
|
|
129
|
-
|
|
89
|
+
def self.button_down?(id)
|
|
130
90
|
GosuFFI.check_last_error(GosuFFI.Gosu_button_down(id))
|
|
131
91
|
end
|
|
132
92
|
|
|
133
|
-
|
|
93
|
+
def self.axis(id)
|
|
134
94
|
GosuFFI.check_last_error(GosuFFI.Gosu_axis(id))
|
|
135
95
|
end
|
|
136
96
|
|
|
137
|
-
|
|
97
|
+
def self.button_id_to_char(id)
|
|
138
98
|
GosuFFI.check_last_error(GosuFFI.Gosu_button_id_to_char(id))
|
|
139
99
|
end
|
|
140
100
|
|
|
141
|
-
|
|
101
|
+
def self.char_to_button_id(id)
|
|
142
102
|
GosuFFI.check_last_error(GosuFFI.Gosu_button_char_to_id(id))
|
|
143
103
|
end
|
|
144
104
|
|
|
145
|
-
|
|
105
|
+
def self.button_name(id)
|
|
146
106
|
GosuFFI.check_last_error(GosuFFI.Gosu_button_name(id))
|
|
147
107
|
end
|
|
148
108
|
|
|
149
|
-
|
|
109
|
+
def self.gamepad_name(id)
|
|
150
110
|
GosuFFI.check_last_error(GosuFFI.Gosu_gamepad_name(id))
|
|
151
111
|
end
|
|
152
112
|
|
|
153
|
-
|
|
113
|
+
def self.clipboard
|
|
154
114
|
GosuFFI.check_last_error(GosuFFI.Gosu_clipboard())
|
|
155
115
|
end
|
|
156
116
|
|
|
@@ -159,56 +119,56 @@ module Gosu
|
|
|
159
119
|
GosuFFI.check_last_error
|
|
160
120
|
end
|
|
161
121
|
|
|
162
|
-
|
|
163
|
-
GosuFFI.
|
|
164
|
-
|
|
122
|
+
def self.draw_line(x1, y1, c1, x2, y2, c2, z = 0, mode = :default)
|
|
123
|
+
GosuFFI.Gosu_draw_line(x1, y1, GosuFFI.color_to_uint32(c1), x2, y2, GosuFFI.color_to_uint32(c2), z, GosuFFI.blend_mode(mode))
|
|
124
|
+
GosuFFI.check_last_error
|
|
165
125
|
end
|
|
166
126
|
|
|
167
|
-
|
|
168
|
-
GosuFFI.
|
|
169
|
-
|
|
170
|
-
|
|
127
|
+
def self.draw_triangle(x1, y1, c1, x2, y2, c2, x3, y3, c3, z = 0, mode = :default)
|
|
128
|
+
GosuFFI.Gosu_draw_triangle(x1, y1, GosuFFI.color_to_uint32(c1), x2, y2, GosuFFI.color_to_uint32(c2),
|
|
129
|
+
x3, y3, GosuFFI.color_to_uint32(c3), z, GosuFFI.blend_mode(mode))
|
|
130
|
+
GosuFFI.check_last_error
|
|
171
131
|
end
|
|
172
132
|
|
|
173
|
-
|
|
133
|
+
def self.draw_quad(x1, y1, c1, x2, y2, c2,
|
|
174
134
|
x3, y3, c3, x4, y4, c4,
|
|
175
135
|
z = 0, mode = :default)
|
|
176
|
-
GosuFFI.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
136
|
+
GosuFFI.Gosu_draw_quad(x1, y1, GosuFFI.color_to_uint32(c1), x2, y2, GosuFFI.color_to_uint32(c2),
|
|
137
|
+
x3, y3, GosuFFI.color_to_uint32(c3), x4, y4, GosuFFI.color_to_uint32(c4),
|
|
138
|
+
z, GosuFFI.blend_mode(mode))
|
|
139
|
+
GosuFFI.check_last_error
|
|
180
140
|
end
|
|
181
141
|
|
|
182
|
-
|
|
183
|
-
GosuFFI.
|
|
184
|
-
|
|
142
|
+
def self.draw_rect(x, y, width, height, c, z = 0, mode = :default)
|
|
143
|
+
GosuFFI.Gosu_draw_rect(x, y, width, height, GosuFFI.color_to_uint32(c), z, GosuFFI.blend_mode(mode))
|
|
144
|
+
GosuFFI.check_last_error
|
|
185
145
|
end
|
|
186
146
|
|
|
187
|
-
|
|
147
|
+
def self.offset_x(angle, distance)
|
|
188
148
|
GosuFFI.check_last_error(GosuFFI.Gosu_offset_x(angle, distance))
|
|
189
149
|
end
|
|
190
150
|
|
|
191
|
-
|
|
151
|
+
def self.offset_y(angle, distance)
|
|
192
152
|
GosuFFI.check_last_error(GosuFFI.Gosu_offset_y(angle, distance))
|
|
193
153
|
end
|
|
194
154
|
|
|
195
|
-
|
|
155
|
+
def self.distance(x1, y1, x2, y2)
|
|
196
156
|
GosuFFI.check_last_error(GosuFFI.Gosu_distance(x1, y1, x2, y2))
|
|
197
157
|
end
|
|
198
158
|
|
|
199
|
-
|
|
159
|
+
def self.angle(x1, y1, x2, y2)
|
|
200
160
|
GosuFFI.check_last_error(GosuFFI.Gosu_angle(x1, y1, x2, y2))
|
|
201
161
|
end
|
|
202
162
|
|
|
203
|
-
|
|
163
|
+
def self.angle_diff(angle1, angle2)
|
|
204
164
|
GosuFFI.check_last_error(GosuFFI.Gosu_angle_diff(angle1, angle2))
|
|
205
165
|
end
|
|
206
166
|
|
|
207
|
-
|
|
167
|
+
def self.random(min, max)
|
|
208
168
|
GosuFFI.check_last_error(GosuFFI.Gosu_random(min, max))
|
|
209
169
|
end
|
|
210
170
|
|
|
211
|
-
|
|
171
|
+
def self.available_width(window = nil)
|
|
212
172
|
if window.nil?
|
|
213
173
|
GosuFFI.check_last_error(GosuFFI.Gosu_available_width(nil))
|
|
214
174
|
else
|
|
@@ -217,7 +177,7 @@ module Gosu
|
|
|
217
177
|
end
|
|
218
178
|
end
|
|
219
179
|
|
|
220
|
-
|
|
180
|
+
def self.available_height(window = nil)
|
|
221
181
|
if window.nil?
|
|
222
182
|
GosuFFI.check_last_error(GosuFFI.Gosu_available_height(nil))
|
|
223
183
|
else
|
|
@@ -226,7 +186,7 @@ module Gosu
|
|
|
226
186
|
end
|
|
227
187
|
end
|
|
228
188
|
|
|
229
|
-
|
|
189
|
+
def self.screen_width(window = nil)
|
|
230
190
|
if window.nil?
|
|
231
191
|
GosuFFI.check_last_error(GosuFFI.Gosu_screen_width(nil))
|
|
232
192
|
else
|
|
@@ -235,7 +195,7 @@ module Gosu
|
|
|
235
195
|
end
|
|
236
196
|
end
|
|
237
197
|
|
|
238
|
-
|
|
198
|
+
def self.screen_height(window = nil)
|
|
239
199
|
if window.nil?
|
|
240
200
|
GosuFFI.check_last_error(GosuFFI.Gosu_screen_height(nil))
|
|
241
201
|
else
|
|
@@ -244,7 +204,7 @@ module Gosu
|
|
|
244
204
|
end
|
|
245
205
|
end
|
|
246
206
|
|
|
247
|
-
|
|
207
|
+
def self.enable_undocumented_retrofication
|
|
248
208
|
# TODO: Move implementation from C++ to Ruby.
|
|
249
209
|
end
|
|
250
210
|
end
|
data/lib/gosu/image.rb
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
module Gosu
|
|
2
2
|
class Image
|
|
3
|
+
BlobHelper = Struct.new(:columns, :rows, :to_blob)
|
|
4
|
+
|
|
3
5
|
def self.from_blob(width, height, rgba = "\0\0\0\0" * (width * height), retro: false, tileable: false)
|
|
4
|
-
|
|
5
|
-
self.new(@struct.new(width, height, rgba), retro: retro, tileable: tileable)
|
|
6
|
+
self.new(BlobHelper.new(width, height, rgba), retro: retro, tileable: tileable)
|
|
6
7
|
end
|
|
7
8
|
|
|
8
|
-
def self.from_text(
|
|
9
|
+
def self.from_text(markup, line_height, font: Gosu.default_font_name, width: -1, spacing: 0, align: :left,
|
|
9
10
|
bold: false, italic: false, underline: false, retro: false)
|
|
10
|
-
__image = GosuFFI.Gosu_Image_create_from_text(
|
|
11
|
+
__image = GosuFFI.Gosu_Image_create_from_text(markup, font, line_height, width, spacing,
|
|
11
12
|
GosuFFI.font_alignment_flags(align),
|
|
12
13
|
GosuFFI.font_flags(bold, italic, underline),
|
|
13
14
|
GosuFFI.image_flags(retro: retro))
|
|
@@ -17,7 +18,7 @@ module Gosu
|
|
|
17
18
|
|
|
18
19
|
def self.from_markup(markup, line_height, font: Gosu.default_font_name, width: -1, spacing: 0, align: :left,
|
|
19
20
|
bold: false, italic: false, underline: false, retro: false)
|
|
20
|
-
__image = GosuFFI.Gosu_Image_create_from_markup(markup
|
|
21
|
+
__image = GosuFFI.Gosu_Image_create_from_markup(markup, font, line_height, width, spacing,
|
|
21
22
|
GosuFFI.font_alignment_flags(align),
|
|
22
23
|
GosuFFI.font_flags(bold, italic, underline),
|
|
23
24
|
GosuFFI.image_flags(retro: retro))
|
|
@@ -47,42 +48,28 @@ module Gosu
|
|
|
47
48
|
return images
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
def initialize(object, retro: false, tileable: false
|
|
51
|
-
if rect and rect.size != 4
|
|
52
|
-
raise ArgumentError, "Expected 4-element array as rect"
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
flags = GosuFFI.image_flags(retro: retro, tileable: tileable)
|
|
56
|
-
|
|
51
|
+
def initialize(object, retro: false, tileable: false)
|
|
57
52
|
if object.is_a? String
|
|
58
|
-
|
|
59
|
-
__image = GosuFFI.Gosu_Image_create_from_rect(object, *rect, flags)
|
|
60
|
-
else
|
|
61
|
-
__image = GosuFFI.Gosu_Image_create(object, flags)
|
|
62
|
-
end
|
|
53
|
+
__image = GosuFFI.Gosu_Image_create(object, GosuFFI.image_flags(retro: retro, tileable: tileable))
|
|
63
54
|
GosuFFI.check_last_error
|
|
64
55
|
elsif object.is_a?(FFI::Pointer)
|
|
65
56
|
__image = object
|
|
66
|
-
elsif object.respond_to?(:to_blob)
|
|
67
|
-
object.respond_to?(:columns)
|
|
57
|
+
elsif object.respond_to?(:to_blob) &&
|
|
58
|
+
object.respond_to?(:columns) &&
|
|
68
59
|
object.respond_to?(:rows)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# Do not consider the terminating null byte part of the ptr length.
|
|
76
|
-
__image = GosuFFI.Gosu_Image_create_from_blob(ptr, ptr.size - 1, object.columns, object.rows, *rect, flags)
|
|
77
|
-
ptr.free
|
|
60
|
+
blob_bytes = object.to_blob { self.format = "RGBA"; self.depth = 8 }.bytes
|
|
61
|
+
FFI::MemoryPointer.new(:uchar, blob_bytes.size) do |blob|
|
|
62
|
+
blob.write_array_of_type(:uchar, :put_uchar, blob_bytes)
|
|
63
|
+
__image = GosuFFI.Gosu_Image_create_from_blob(blob, blob_bytes.size, object.columns, object.rows, GosuFFI.image_flags(retro: retro, tileable: tileable))
|
|
64
|
+
GosuFFI.check_last_error
|
|
65
|
+
end
|
|
78
66
|
|
|
79
|
-
|
|
67
|
+
raise "Failed to load image from blob" if __image.null?
|
|
80
68
|
else
|
|
81
|
-
raise ArgumentError
|
|
69
|
+
raise ArgumentError
|
|
82
70
|
end
|
|
83
71
|
|
|
84
72
|
@managed_pointer = FFI::AutoPointer.new(__image, GosuFFI.method(:Gosu_Image_destroy))
|
|
85
|
-
self
|
|
86
73
|
end
|
|
87
74
|
|
|
88
75
|
def __pointer
|
|
@@ -90,51 +77,28 @@ module Gosu
|
|
|
90
77
|
end
|
|
91
78
|
|
|
92
79
|
def width
|
|
93
|
-
|
|
94
|
-
@width ||= GosuFFI.check_last_error(GosuFFI.Gosu_Image_width(__pointer))
|
|
80
|
+
GosuFFI.check_last_error(GosuFFI.Gosu_Image_width(__pointer))
|
|
95
81
|
end
|
|
96
82
|
|
|
97
83
|
def height
|
|
98
|
-
|
|
99
|
-
@height ||= GosuFFI.check_last_error(GosuFFI.Gosu_Image_height(__pointer))
|
|
84
|
+
GosuFFI.check_last_error(GosuFFI.Gosu_Image_height(__pointer))
|
|
100
85
|
end
|
|
101
86
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
alias rows height
|
|
106
|
-
|
|
107
|
-
def draw(x, y, z = 0, scale_x = 1, scale_y = 1, color = Gosu::Color::WHITE, flags = :default)
|
|
108
|
-
if scale_x == 1 and scale_y == 1 and color.equal?(Gosu::Color::WHITE) and flags == :default
|
|
109
|
-
# Use a fast-path method when most arguments have their default value.
|
|
110
|
-
GosuFFI.check_last_error if not
|
|
111
|
-
GosuFFI.Gosu_Image_draw_quick(__pointer, x, y, z)
|
|
112
|
-
else
|
|
113
|
-
GosuFFI.check_last_error if not
|
|
114
|
-
GosuFFI.Gosu_Image_draw(__pointer, x, y, z, scale_x, scale_y,
|
|
115
|
-
GosuFFI.color_to_uint32(color), GosuFFI.blend_mode(flags))
|
|
116
|
-
end
|
|
87
|
+
def draw(x, y, z, scale_x = 1, scale_y = 1, color = Gosu::Color::WHITE, flags = :default)
|
|
88
|
+
GosuFFI.Gosu_Image_draw(__pointer, x, y, z, scale_x, scale_y, GosuFFI.color_to_uint32(color), GosuFFI.blend_mode(flags))
|
|
89
|
+
GosuFFI.check_last_error
|
|
117
90
|
end
|
|
118
91
|
|
|
119
|
-
def draw_rot(x, y, z
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
# Use a fast-path method when most arguments have their default value.
|
|
123
|
-
GosuFFI.check_last_error if not
|
|
124
|
-
GosuFFI.Gosu_Image_draw_rot_quick(__pointer, x, y, z, angle)
|
|
125
|
-
else
|
|
126
|
-
GosuFFI.check_last_error if not
|
|
127
|
-
GosuFFI.Gosu_Image_draw_rot(__pointer, x, y, z, angle, center_x, center_y, scale_x, scale_y,
|
|
128
|
-
GosuFFI.color_to_uint32(color), GosuFFI.blend_mode(flags))
|
|
129
|
-
end
|
|
92
|
+
def draw_rot(x, y, z, angle = 0, center_x = 0.5, center_y = 0.5, scale_x = 1, scale_y = 1, color = Gosu::Color::WHITE, flags = :default)
|
|
93
|
+
GosuFFI.Gosu_Image_draw_rot(__pointer, x, y, z, angle, center_x, center_y, scale_x, scale_y, GosuFFI.color_to_uint32(color), GosuFFI.blend_mode(flags))
|
|
94
|
+
GosuFFI.check_last_error
|
|
130
95
|
end
|
|
131
96
|
|
|
132
97
|
def draw_as_quad(x1, y1, color1, x2, y2, color2, x3, y3, color3, x4, y4, color4, z = 0, mode = :default)
|
|
133
|
-
GosuFFI.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
z, GosuFFI.blend_mode(mode))
|
|
98
|
+
GosuFFI.Gosu_Image_draw_as_quad(x1, y1, GosuFFI.color_to_uint32(color1), x2, y2, GosuFFI.color_to_uint32(color2),
|
|
99
|
+
x3, y3, GosuFFI.color_to_uint32(color3), x4, y4, GosuFFI.color_to_uint32(color4),
|
|
100
|
+
z, GosuFFI.blend_mode(mode))
|
|
101
|
+
GosuFFI.check_last_error
|
|
138
102
|
end
|
|
139
103
|
|
|
140
104
|
def save(filename)
|
|
@@ -148,19 +112,17 @@ module Gosu
|
|
|
148
112
|
end
|
|
149
113
|
|
|
150
114
|
def subimage(left, top, width, height)
|
|
151
|
-
|
|
115
|
+
__pointer = GosuFFI.Gosu_Image_create_from_subimage(__pointer, left, top, width, height)
|
|
152
116
|
GosuFFI.check_last_error
|
|
153
|
-
Gosu::Image.new(
|
|
117
|
+
Gosu::Image.new(__pointer)
|
|
154
118
|
end
|
|
155
119
|
|
|
156
120
|
def insert(image, x, y)
|
|
157
121
|
image_ = nil
|
|
158
122
|
if image.is_a?(Gosu::Image)
|
|
159
123
|
image_ = image.__pointer
|
|
160
|
-
elsif image.respond_to?(:
|
|
161
|
-
|
|
162
|
-
elsif image.respond_to?(:to_blob) and
|
|
163
|
-
image.respond_to?(:rows) and
|
|
124
|
+
elsif image.respond_to?(:to_blob) &&
|
|
125
|
+
image.respond_to?(:rows) &&
|
|
164
126
|
image.respond_to?(:columns)
|
|
165
127
|
image_ = Gosu::Image.new(image).__pointer
|
|
166
128
|
else
|
data/lib/gosu/sample.rb
CHANGED
data/lib/gosu/song.rb
CHANGED
data/lib/gosu/text_input.rb
CHANGED
|
@@ -8,8 +8,6 @@ module Gosu
|
|
|
8
8
|
@__filter_proc = proc { |data, text| protected_filter(text) }
|
|
9
9
|
GosuFFI.Gosu_TextInput_set_filter(__pointer, @__filter_proc, nil)
|
|
10
10
|
GosuFFI.check_last_error
|
|
11
|
-
|
|
12
|
-
self
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def __pointer
|
|
@@ -64,20 +62,8 @@ module Gosu
|
|
|
64
62
|
|
|
65
63
|
# Ensures that filter_result is set on C side before filter callback returns
|
|
66
64
|
private def protected_filter(text)
|
|
67
|
-
string =
|
|
68
|
-
filter(text)
|
|
69
|
-
rescue Exception => e
|
|
70
|
-
# We cannot use Ruby exceptions (internally: longjmp) in C++ callbacks.
|
|
71
|
-
# Reject the input and remember the exception. Window will re-raise it.
|
|
72
|
-
@__exception = e
|
|
73
|
-
""
|
|
74
|
-
end
|
|
65
|
+
string = filter(text)
|
|
75
66
|
GosuFFI.Gosu_TextInput_set_filter_result(__pointer, string)
|
|
76
67
|
end
|
|
77
|
-
|
|
78
|
-
# Raises and forgets the last exception from #filter, if any.
|
|
79
|
-
def __raise_filter_exception
|
|
80
|
-
raise remove_instance_variable(:@__exception) if defined?(@__exception)
|
|
81
|
-
end
|
|
82
68
|
end
|
|
83
69
|
end
|
data/lib/gosu/window.rb
CHANGED
|
@@ -5,24 +5,15 @@ module Gosu
|
|
|
5
5
|
define_method "protected_#{callback}" do |*args|
|
|
6
6
|
begin
|
|
7
7
|
# If there has been an exception, don't do anything as to not make matters worse.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
else
|
|
11
|
-
# Treat exceptions from TextInput#filter and Gosu.gl(z) like exceptions from the callbacks themselves.
|
|
12
|
-
@text_input&.__raise_filter_exception
|
|
13
|
-
GosuFFI.check_last_gl_error
|
|
14
|
-
|
|
15
|
-
# Let the GC clean up deferred Gosu.gl(z) blocks before the next draw.
|
|
16
|
-
$gosu_gl_blocks = nil if callback == "draw"
|
|
17
|
-
result = send(callback, *args)
|
|
18
|
-
# Conveniently turn the return value into a boolean result (for needs_cursor? etc).
|
|
19
|
-
callback.end_with?("?") ? !!result : result
|
|
20
|
-
end
|
|
8
|
+
# Conveniently turn the return value into a boolean result (for needs_cursor? etc).
|
|
9
|
+
defined?(@__exception) ? false : send(callback, *args)
|
|
21
10
|
rescue Exception => e
|
|
22
11
|
# Exit the message loop naturally, then re-throw during the next tick.
|
|
23
12
|
@__exception = e
|
|
24
13
|
close!
|
|
25
14
|
false
|
|
15
|
+
ensure
|
|
16
|
+
$gosu_gl_blocks = nil if callback == "draw"
|
|
26
17
|
end
|
|
27
18
|
end
|
|
28
19
|
end
|
|
@@ -61,8 +52,6 @@ module Gosu
|
|
|
61
52
|
GosuFFI.send(:"Gosu_Window_set_#{callback_safename}", __pointer, instance_variable_get(:"@__#{callback_safename}_proc"), nil)
|
|
62
53
|
GosuFFI.check_last_error
|
|
63
54
|
end
|
|
64
|
-
|
|
65
|
-
self
|
|
66
55
|
end
|
|
67
56
|
|
|
68
57
|
# Returns FFI pointer of C side Gosu::Window
|
|
@@ -98,7 +87,7 @@ module Gosu
|
|
|
98
87
|
end
|
|
99
88
|
|
|
100
89
|
def needs_cursor?
|
|
101
|
-
|
|
90
|
+
false
|
|
102
91
|
end
|
|
103
92
|
|
|
104
93
|
def capture_cursor?
|
|
@@ -212,31 +201,21 @@ module Gosu
|
|
|
212
201
|
end
|
|
213
202
|
|
|
214
203
|
def show
|
|
215
|
-
GosuFFI.
|
|
204
|
+
GosuFFI.Gosu_Window_show(__pointer)
|
|
216
205
|
|
|
217
|
-
|
|
206
|
+
raise @__exception if defined?(@__exception)
|
|
207
|
+
|
|
208
|
+
GosuFFI.check_last_error
|
|
218
209
|
end
|
|
219
210
|
|
|
220
211
|
def tick
|
|
221
212
|
value = GosuFFI.check_last_error(GosuFFI.Gosu_Window_tick(__pointer))
|
|
222
213
|
|
|
223
|
-
|
|
214
|
+
raise @__exception if defined?(@__exception)
|
|
224
215
|
|
|
225
216
|
value
|
|
226
217
|
end
|
|
227
218
|
|
|
228
|
-
private def raise_pending_exception
|
|
229
|
-
raise remove_instance_variable(:@__exception) if defined?(@__exception)
|
|
230
|
-
|
|
231
|
-
# Blocks passed to Gosu.gl(z) are called after Window#draw, so they may have failed after the last callback.
|
|
232
|
-
begin
|
|
233
|
-
GosuFFI.check_last_gl_error
|
|
234
|
-
rescue Exception
|
|
235
|
-
close!
|
|
236
|
-
raise
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
|
|
240
219
|
def close!
|
|
241
220
|
GosuFFI.Gosu_Window_close_immediately(__pointer)
|
|
242
221
|
GosuFFI.check_last_error
|
data/lib64/SDL2.dll
ADDED
|
Binary file
|
data/rdoc/gosu.rb
CHANGED
|
@@ -1192,8 +1192,6 @@ module Gosu
|
|
|
1192
1192
|
#
|
|
1193
1193
|
# @note Because the returned object is not backed by a bitmap texture, there are restrictions on how it can be used. For example, you can not use any color other than {Gosu::Color#WHITE} when drawing the image.
|
|
1194
1194
|
#
|
|
1195
|
-
# @note {draw_line}, {clip_to} and {gl} cannot currently be used inside the block.
|
|
1196
|
-
#
|
|
1197
1195
|
# @note The width and height of the returned image will be the values you passed to {record}, regardless of the area you draw on.
|
|
1198
1196
|
# It is important to pass accurate values if you plan on calling {Gosu::Image#draw_as_quad} or {Gosu::Image#draw_rot} on the result later.
|
|
1199
1197
|
#
|