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/ext/gosu-ffi/extconf.rb
CHANGED
|
@@ -30,8 +30,10 @@ $CXXFLAGS << " -DGOSU_DEPRECATED="
|
|
|
30
30
|
$CFLAGS << " -DNDEBUG"
|
|
31
31
|
$CXXFLAGS << " -DNDEBUG"
|
|
32
32
|
|
|
33
|
-
# Enable C++20
|
|
34
|
-
|
|
33
|
+
# Enable C++20, but at the same time make the compiler more permissive, and avoid this error:
|
|
34
|
+
# https://stackoverflow.com/a/31899029 (triggered by ruby.h, which uses register variables)
|
|
35
|
+
# The "register" macro can be removed when support for Ruby 2.6 and older has been dropped.
|
|
36
|
+
$CXXFLAGS << " -std=gnu++20 -Dregister="
|
|
35
37
|
|
|
36
38
|
# Make Gosu's own header files and all of its dependencies available to C++ source files.
|
|
37
39
|
%w(include dependencies/stb dependencies/utf8proc dependencies/SDL_sound dependencies/mojoAL/AL).each do |incdir|
|
|
@@ -45,14 +47,14 @@ $CFLAGS << " -DUTF8PROC_STATIC -DAL_LIBTYPE_STATIC"
|
|
|
45
47
|
$CXXFLAGS << " -DUTF8PROC_STATIC -DAL_LIBTYPE_STATIC"
|
|
46
48
|
|
|
47
49
|
if windows
|
|
48
|
-
# Use the bundled version of SDL
|
|
50
|
+
# Use the bundled version of SDL 2.
|
|
49
51
|
$INCFLAGS << " -I$(srcdir)/../../dependencies/SDL/include"
|
|
50
52
|
if RbConfig::CONFIG["arch"] =~ /x64-/
|
|
51
53
|
$LDFLAGS << " -L$(srcdir)/../../dependencies/SDL/lib/x64"
|
|
52
54
|
else
|
|
53
55
|
$LDFLAGS << " -L$(srcdir)/../../dependencies/SDL/lib/x86"
|
|
54
56
|
end
|
|
55
|
-
$LDFLAGS << " -lgdi32 -lwinmm -ldwmapi -lOpenGL32 -
|
|
57
|
+
$LDFLAGS << " -lgdi32 -lwinmm -ldwmapi -lOpenGL32 -lSDL2"
|
|
56
58
|
# Link libstdc++ statically to avoid having another DLL dependency when using Ocra.
|
|
57
59
|
$LDFLAGS << " -static-libstdc++"
|
|
58
60
|
elsif macos
|
|
@@ -70,13 +72,28 @@ elsif macos
|
|
|
70
72
|
# https://trac.macports.org/ticket/58255 / https://github.com/gosu/gosu/issues/424
|
|
71
73
|
$CXXFLAGS << " -Wno-reserved-user-defined-literal"
|
|
72
74
|
|
|
73
|
-
# Dependencies.
|
|
74
|
-
$CFLAGS << " #{`
|
|
75
|
-
$CXXFLAGS << " #{`
|
|
76
|
-
# Prefer statically linking SDL
|
|
77
|
-
$LDFLAGS << " #{`
|
|
75
|
+
# Dependencies.
|
|
76
|
+
$CFLAGS << " #{`sdl2-config --cflags`.chomp}"
|
|
77
|
+
$CXXFLAGS << " #{`sdl2-config --cflags`.chomp}"
|
|
78
|
+
# Prefer statically linking SDL 2.
|
|
79
|
+
$LDFLAGS << " #{`sdl2-config --static-libs`.chomp} -framework OpenGL -framework Metal"
|
|
80
|
+
# And yet another hack: `sdl2-config --static-libs` uses `-lSDL2` instead of linking to the static library,
|
|
81
|
+
# even if it exists. -> Manually replace it. (Ugh!)
|
|
82
|
+
static_lib = if RbConfig::CONFIG["target_cpu"] == "arm64"
|
|
83
|
+
"/opt/homebrew/opt/sdl2/lib/libSDL2.a"
|
|
84
|
+
else
|
|
85
|
+
"/usr/local/lib/libSDL2.a"
|
|
86
|
+
end
|
|
87
|
+
$LDFLAGS.sub! " -lSDL2 ", " #{static_lib} " if File.exist? static_lib
|
|
88
|
+
|
|
89
|
+
# Disable building of 32-bit slices in Apple's Ruby.
|
|
90
|
+
# (RbConfig::CONFIG['CXXFLAGS'] on macOS 10.11: -arch x86_64 -arch i386 -g -Os -pipe)
|
|
91
|
+
$CFLAGS.gsub! "-arch i386", ""
|
|
92
|
+
$CXXFLAGS.gsub! "-arch i386", ""
|
|
93
|
+
$LDFLAGS.gsub! "-arch i386", ""
|
|
94
|
+
$ARCH_FLAG.gsub! "-arch i386", ""
|
|
95
|
+
CONFIG["LDSHARED"].gsub! "-arch i386", ""
|
|
78
96
|
else
|
|
79
|
-
# Raspberry Pi support, hasn't been tested in a long time.
|
|
80
97
|
if /BCM2708/ =~ `cat /proc/cpuinfo`
|
|
81
98
|
$INCFLAGS << " -I/opt/vc/include/GLES"
|
|
82
99
|
$INCFLAGS << " -I/opt/vc/include"
|
|
@@ -88,7 +105,7 @@ else
|
|
|
88
105
|
pkg_config "gl"
|
|
89
106
|
end
|
|
90
107
|
|
|
91
|
-
pkg_config "
|
|
108
|
+
pkg_config "sdl2"
|
|
92
109
|
pkg_config "fontconfig"
|
|
93
110
|
end
|
|
94
111
|
|
data/ext/gosu-ffi/gosu-ffi.def
CHANGED
|
@@ -213,7 +213,6 @@ Gosu_IF_TILEABLE_TOP
|
|
|
213
213
|
Gosu_Image_create
|
|
214
214
|
Gosu_Image_create_from_blob
|
|
215
215
|
Gosu_Image_create_from_markup
|
|
216
|
-
Gosu_Image_create_from_rect
|
|
217
216
|
Gosu_Image_create_from_subimage
|
|
218
217
|
Gosu_Image_create_from_text
|
|
219
218
|
Gosu_Image_create_from_tiles
|
|
@@ -221,9 +220,7 @@ Gosu_Image_create_tiles_from_image
|
|
|
221
220
|
Gosu_Image_destroy
|
|
222
221
|
Gosu_Image_draw
|
|
223
222
|
Gosu_Image_draw_as_quad
|
|
224
|
-
Gosu_Image_draw_quick
|
|
225
223
|
Gosu_Image_draw_rot
|
|
226
|
-
Gosu_Image_draw_rot_quick
|
|
227
224
|
Gosu_Image_gl_tex_info_create
|
|
228
225
|
Gosu_Image_gl_tex_info_destroy
|
|
229
226
|
Gosu_Image_height
|
data/ffi/Gosu.cpp
CHANGED
|
@@ -7,7 +7,7 @@ GOSU_FFI_API void Init_gosu()
|
|
|
7
7
|
|
|
8
8
|
std::string& Gosu_internal_error()
|
|
9
9
|
{
|
|
10
|
-
thread_local std::string error;
|
|
10
|
+
static thread_local std::string error;
|
|
11
11
|
return error;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -19,18 +19,14 @@ GOSU_FFI_API const char* Gosu_last_error(void)
|
|
|
19
19
|
GOSU_FFI_API void Gosu_gl_z(double z, void function(void*), void* data)
|
|
20
20
|
{
|
|
21
21
|
Gosu_translate_exceptions([=] {
|
|
22
|
-
Gosu::gl(z, [=] {
|
|
23
|
-
function(data);
|
|
24
|
-
});
|
|
22
|
+
Gosu::gl(z, [=] { function(data); });
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
GOSU_FFI_API void Gosu_gl(void function(void*), void* data)
|
|
29
27
|
{
|
|
30
28
|
Gosu_translate_exceptions([=] {
|
|
31
|
-
Gosu::gl([=] {
|
|
32
|
-
function(data);
|
|
33
|
-
});
|
|
29
|
+
Gosu::gl([=] { function(data); });
|
|
34
30
|
});
|
|
35
31
|
}
|
|
36
32
|
|
|
@@ -38,23 +34,16 @@ GOSU_FFI_API Gosu_Image* Gosu_render(int width, int height, void function(void*)
|
|
|
38
34
|
unsigned image_flags)
|
|
39
35
|
{
|
|
40
36
|
return Gosu_translate_exceptions([=] {
|
|
41
|
-
Gosu::Image image = Gosu::render(
|
|
42
|
-
|
|
43
|
-
[=] {
|
|
44
|
-
function(data);
|
|
45
|
-
},
|
|
46
|
-
image_flags);
|
|
47
|
-
return new Gosu_Image { image };
|
|
37
|
+
Gosu::Image image = Gosu::render(width, height, [=] { function(data); }, image_flags);
|
|
38
|
+
return new Gosu_Image{image};
|
|
48
39
|
});
|
|
49
40
|
}
|
|
50
41
|
|
|
51
42
|
GOSU_FFI_API Gosu_Image* Gosu_record(int width, int height, void function(void*), void* data)
|
|
52
43
|
{
|
|
53
44
|
return Gosu_translate_exceptions([=] {
|
|
54
|
-
Gosu::Image image = Gosu::record(width, height, [=] {
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
return new Gosu_Image { image };
|
|
45
|
+
Gosu::Image image = Gosu::record(width, height, [=] { function(data); });
|
|
46
|
+
return new Gosu_Image{image};
|
|
58
47
|
});
|
|
59
48
|
}
|
|
60
49
|
|
|
@@ -71,20 +60,16 @@ GOSU_FFI_API void Gosu_transform(double m0, double m1, double m2, double m3, dou
|
|
|
71
60
|
void function(void*), void* data)
|
|
72
61
|
{
|
|
73
62
|
Gosu_translate_exceptions([=] {
|
|
74
|
-
Gosu::Transform transform
|
|
75
|
-
|
|
76
|
-
Gosu::transform(transform, [=] {
|
|
77
|
-
function(data);
|
|
78
|
-
});
|
|
63
|
+
Gosu::Transform transform = {m0, m1, m2, m3, m4, m5, m6, m7,
|
|
64
|
+
m8, m9, m10, m11, m12, m13, m14, m15};
|
|
65
|
+
Gosu::transform(transform, [=] { function(data); });
|
|
79
66
|
});
|
|
80
67
|
}
|
|
81
68
|
|
|
82
69
|
GOSU_FFI_API void Gosu_translate(double x, double y, void function(void*), void* data)
|
|
83
70
|
{
|
|
84
71
|
Gosu_translate_exceptions([=] {
|
|
85
|
-
Gosu::transform(Gosu::Transform::translate(x, y), [=] {
|
|
86
|
-
function(data);
|
|
87
|
-
});
|
|
72
|
+
Gosu::transform(Gosu::Transform::translate(x, y), [=] { function(data); });
|
|
88
73
|
});
|
|
89
74
|
}
|
|
90
75
|
|
|
@@ -92,9 +77,8 @@ GOSU_FFI_API void Gosu_scale(double scale_x, double scale_y, double around_x, do
|
|
|
92
77
|
void function(void*), void* data)
|
|
93
78
|
{
|
|
94
79
|
Gosu_translate_exceptions([=] {
|
|
95
|
-
Gosu::transform(Gosu::Transform::scale(scale_x, scale_y).around(around_x, around_y),
|
|
96
|
-
function(data);
|
|
97
|
-
});
|
|
80
|
+
Gosu::transform(Gosu::Transform::scale(scale_x, scale_y).around(around_x, around_y),
|
|
81
|
+
[=] { function(data); });
|
|
98
82
|
});
|
|
99
83
|
}
|
|
100
84
|
|
|
@@ -102,9 +86,8 @@ GOSU_FFI_API void Gosu_rotate(double angle, double around_x, double around_y, vo
|
|
|
102
86
|
void* data)
|
|
103
87
|
{
|
|
104
88
|
Gosu_translate_exceptions([=] {
|
|
105
|
-
Gosu::transform(Gosu::Transform::rotate(angle).around(around_x, around_y),
|
|
106
|
-
|
|
107
|
-
});
|
|
89
|
+
Gosu::transform(Gosu::Transform::rotate(angle).around(around_x, around_y),
|
|
90
|
+
[=] { function(data); });
|
|
108
91
|
});
|
|
109
92
|
}
|
|
110
93
|
|
|
@@ -112,49 +95,43 @@ GOSU_FFI_API void Gosu_clip_to(double x, double y, double width, double height,
|
|
|
112
95
|
void function(void*), void* data)
|
|
113
96
|
{
|
|
114
97
|
Gosu_translate_exceptions([=] {
|
|
115
|
-
Gosu::clip_to(x, y, width, height, [=] {
|
|
116
|
-
function(data);
|
|
117
|
-
});
|
|
98
|
+
Gosu::clip_to(x, y, width, height, [=] { function(data); });
|
|
118
99
|
});
|
|
119
100
|
}
|
|
120
101
|
|
|
121
|
-
GOSU_FFI_API
|
|
102
|
+
GOSU_FFI_API void Gosu_draw_line(double x1, double y1, unsigned c1, double x2, double y2,
|
|
122
103
|
unsigned c2, double z, unsigned mode)
|
|
123
104
|
{
|
|
124
|
-
|
|
105
|
+
Gosu_translate_exceptions([=] {
|
|
125
106
|
Gosu::draw_line(x1, y1, c1, x2, y2, c2, z, static_cast<Gosu::BlendMode>(mode));
|
|
126
|
-
return true;
|
|
127
107
|
});
|
|
128
108
|
}
|
|
129
109
|
|
|
130
|
-
GOSU_FFI_API
|
|
110
|
+
GOSU_FFI_API void Gosu_draw_triangle(double x1, double y1, unsigned c1, double x2, double y2,
|
|
131
111
|
unsigned c2, double x3, double y3, unsigned c3, double z,
|
|
132
112
|
unsigned mode)
|
|
133
113
|
{
|
|
134
|
-
|
|
114
|
+
Gosu_translate_exceptions([=] {
|
|
135
115
|
Gosu::draw_triangle(x1, y1, c1, x2, y2, c2, x3, y3, c3, z,
|
|
136
116
|
static_cast<Gosu::BlendMode>(mode));
|
|
137
|
-
return true;
|
|
138
117
|
});
|
|
139
118
|
}
|
|
140
119
|
|
|
141
|
-
GOSU_FFI_API
|
|
120
|
+
GOSU_FFI_API void Gosu_draw_rect(double x, double y, double width, double height, unsigned c,
|
|
142
121
|
double z, unsigned mode)
|
|
143
122
|
{
|
|
144
|
-
|
|
123
|
+
Gosu_translate_exceptions([=] {
|
|
145
124
|
Gosu::draw_rect(x, y, width, height, c, z, static_cast<Gosu::BlendMode>(mode));
|
|
146
|
-
return true;
|
|
147
125
|
});
|
|
148
126
|
}
|
|
149
127
|
|
|
150
|
-
GOSU_FFI_API
|
|
128
|
+
GOSU_FFI_API void Gosu_draw_quad(double x1, double y1, unsigned c1, double x2, double y2,
|
|
151
129
|
unsigned c2, double x3, double y3, unsigned c3, double x4,
|
|
152
130
|
double y4, unsigned c4, double z, unsigned mode)
|
|
153
131
|
{
|
|
154
|
-
|
|
132
|
+
Gosu_translate_exceptions([=] {
|
|
155
133
|
Gosu::draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z,
|
|
156
134
|
static_cast<Gosu::BlendMode>(mode));
|
|
157
|
-
return true;
|
|
158
135
|
});
|
|
159
136
|
}
|
|
160
137
|
|
|
@@ -237,7 +214,7 @@ GOSU_FFI_API int Gosu_button_down(int id)
|
|
|
237
214
|
|
|
238
215
|
GOSU_FFI_API const char* Gosu_button_id_to_char(int id)
|
|
239
216
|
{
|
|
240
|
-
thread_local std::string button;
|
|
217
|
+
static thread_local std::string button;
|
|
241
218
|
|
|
242
219
|
return Gosu_translate_exceptions([=] {
|
|
243
220
|
button = Gosu::Input::id_to_char(static_cast<Gosu::Button>(id));
|
|
@@ -254,7 +231,7 @@ GOSU_FFI_API unsigned Gosu_button_char_to_id(const char* btn)
|
|
|
254
231
|
|
|
255
232
|
GOSU_FFI_API const char* Gosu_button_name(int id)
|
|
256
233
|
{
|
|
257
|
-
thread_local std::string name;
|
|
234
|
+
static thread_local std::string name;
|
|
258
235
|
|
|
259
236
|
return Gosu_translate_exceptions([=] {
|
|
260
237
|
name = Gosu::Input::button_name(static_cast<Gosu::Button>(id));
|
|
@@ -264,7 +241,7 @@ GOSU_FFI_API const char* Gosu_button_name(int id)
|
|
|
264
241
|
|
|
265
242
|
GOSU_FFI_API const char* Gosu_gamepad_name(int id)
|
|
266
243
|
{
|
|
267
|
-
thread_local std::string name;
|
|
244
|
+
static thread_local std::string name;
|
|
268
245
|
|
|
269
246
|
return Gosu_translate_exceptions([=] {
|
|
270
247
|
name = Gosu::Input::gamepad_name(id);
|
|
@@ -281,7 +258,7 @@ GOSU_FFI_API double Gosu_axis(int id)
|
|
|
281
258
|
|
|
282
259
|
GOSU_FFI_API const char* Gosu_clipboard()
|
|
283
260
|
{
|
|
284
|
-
thread_local std::string text;
|
|
261
|
+
static thread_local std::string text;
|
|
285
262
|
|
|
286
263
|
return Gosu_translate_exceptions([=] {
|
|
287
264
|
text = Gosu::Input::clipboard();
|
|
@@ -321,7 +298,7 @@ GOSU_FFI_API uint64_t Gosu_milliseconds()
|
|
|
321
298
|
|
|
322
299
|
GOSU_FFI_API const char* Gosu_default_font_name()
|
|
323
300
|
{
|
|
324
|
-
thread_local std::string name;
|
|
301
|
+
static thread_local std::string name;
|
|
325
302
|
|
|
326
303
|
return Gosu_translate_exceptions([=] {
|
|
327
304
|
name = Gosu::default_font_name();
|
data/ffi/Gosu.h
CHANGED
|
@@ -36,14 +36,14 @@ GOSU_FFI_API void Gosu_rotate(double angle, double around_x, double around_y,
|
|
|
36
36
|
void function(void* data), void* data);
|
|
37
37
|
|
|
38
38
|
// Rendering
|
|
39
|
-
GOSU_FFI_API
|
|
39
|
+
GOSU_FFI_API void Gosu_draw_line(double x1, double y1, unsigned c1, double x2, double y2,
|
|
40
40
|
unsigned c2, double z, unsigned mode);
|
|
41
|
-
GOSU_FFI_API
|
|
41
|
+
GOSU_FFI_API void Gosu_draw_triangle(double x1, double y1, unsigned c1, double x2, double y2,
|
|
42
42
|
unsigned c2, double x3, double y3, unsigned c3, double z,
|
|
43
43
|
unsigned mode);
|
|
44
|
-
GOSU_FFI_API
|
|
44
|
+
GOSU_FFI_API void Gosu_draw_rect(double x, double y, double width, double height, unsigned c,
|
|
45
45
|
double z, unsigned mode);
|
|
46
|
-
GOSU_FFI_API
|
|
46
|
+
GOSU_FFI_API void Gosu_draw_quad(double x1, double y1, unsigned c1, double x2, double y2,
|
|
47
47
|
unsigned c2, double x3, double y3, unsigned c3, double x4,
|
|
48
48
|
double y4, unsigned c4, double z, unsigned mode);
|
|
49
49
|
|
data/ffi/Gosu_Color.cpp
CHANGED
|
@@ -2,175 +2,131 @@
|
|
|
2
2
|
|
|
3
3
|
GOSU_FFI_API uint32_t Gosu_Color_create(uint32_t argb)
|
|
4
4
|
{
|
|
5
|
-
return
|
|
6
|
-
return Gosu::Color{argb}.argb();
|
|
7
|
-
});
|
|
5
|
+
return Gosu::Color{argb}.argb();
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
GOSU_FFI_API uint32_t Gosu_Color_create_argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b)
|
|
11
9
|
{
|
|
12
|
-
return
|
|
13
|
-
return Gosu::Color{r, g, b}.with_alpha(a).argb();
|
|
14
|
-
});
|
|
10
|
+
return Gosu::Color{r, g, b}.with_alpha(a).argb();
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
GOSU_FFI_API uint32_t Gosu_Color_create_from_hsv(double h, double s, double v)
|
|
18
14
|
{
|
|
19
|
-
return
|
|
20
|
-
return Gosu::Color::from_hsv(h, s, v).argb();
|
|
21
|
-
});
|
|
15
|
+
return Gosu::Color::from_hsv(h, s, v).argb();
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
GOSU_FFI_API uint32_t Gosu_Color_create_from_ahsv(uint8_t alpha, double h, double s, double v)
|
|
25
19
|
{
|
|
26
|
-
return
|
|
27
|
-
return Gosu::Color::from_hsv(h, s, v).with_alpha(alpha).argb();
|
|
28
|
-
});
|
|
20
|
+
return Gosu::Color::from_hsv(h, s, v).with_alpha(alpha).argb();
|
|
29
21
|
}
|
|
30
22
|
|
|
31
23
|
GOSU_FFI_API uint8_t Gosu_Color_alpha(uint32_t color)
|
|
32
24
|
{
|
|
33
|
-
return
|
|
34
|
-
return Gosu::Color{color}.alpha;
|
|
35
|
-
});
|
|
25
|
+
return Gosu::Color{color}.alpha;
|
|
36
26
|
}
|
|
37
27
|
|
|
38
28
|
GOSU_FFI_API uint8_t Gosu_Color_red(uint32_t color)
|
|
39
29
|
{
|
|
40
|
-
return
|
|
41
|
-
return Gosu::Color{color}.red;
|
|
42
|
-
});
|
|
30
|
+
return Gosu::Color{color}.red;
|
|
43
31
|
}
|
|
44
32
|
|
|
45
33
|
GOSU_FFI_API uint8_t Gosu_Color_green(uint32_t color)
|
|
46
34
|
{
|
|
47
|
-
return
|
|
48
|
-
return Gosu::Color{color}.green;
|
|
49
|
-
});
|
|
35
|
+
return Gosu::Color{color}.green;
|
|
50
36
|
}
|
|
51
37
|
|
|
52
38
|
GOSU_FFI_API uint8_t Gosu_Color_blue(uint32_t color)
|
|
53
39
|
{
|
|
54
|
-
return
|
|
55
|
-
return Gosu::Color{color}.blue;
|
|
56
|
-
});
|
|
40
|
+
return Gosu::Color{color}.blue;
|
|
57
41
|
}
|
|
58
42
|
|
|
59
43
|
GOSU_FFI_API uint32_t Gosu_Color_set_alpha(uint32_t color, uint8_t value)
|
|
60
44
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
gosu_color.alpha = value;
|
|
45
|
+
Gosu::Color gosu_color{color};
|
|
46
|
+
gosu_color.alpha = value;
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
});
|
|
48
|
+
return gosu_color.argb();
|
|
67
49
|
}
|
|
68
50
|
|
|
69
51
|
GOSU_FFI_API uint32_t Gosu_Color_set_red(uint32_t color, uint8_t value)
|
|
70
52
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
gosu_color.red = value;
|
|
53
|
+
Gosu::Color gosu_color{color};
|
|
54
|
+
gosu_color.red = value;
|
|
74
55
|
|
|
75
|
-
|
|
76
|
-
});
|
|
56
|
+
return gosu_color.argb();
|
|
77
57
|
}
|
|
78
58
|
|
|
79
59
|
GOSU_FFI_API uint32_t Gosu_Color_set_green(uint32_t color, uint8_t value)
|
|
80
60
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
gosu_color.green = value;
|
|
61
|
+
Gosu::Color gosu_color{color};
|
|
62
|
+
gosu_color.green = value;
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
});
|
|
64
|
+
return gosu_color.argb();
|
|
87
65
|
}
|
|
88
66
|
|
|
89
67
|
GOSU_FFI_API uint32_t Gosu_Color_set_blue(uint32_t color, uint8_t value)
|
|
90
68
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
gosu_color.blue = value;
|
|
69
|
+
Gosu::Color gosu_color{color};
|
|
70
|
+
gosu_color.blue = value;
|
|
94
71
|
|
|
95
|
-
|
|
96
|
-
});
|
|
72
|
+
return gosu_color.argb();
|
|
97
73
|
}
|
|
98
74
|
|
|
99
75
|
GOSU_FFI_API double Gosu_Color_hue(uint32_t color)
|
|
100
76
|
{
|
|
101
|
-
return
|
|
102
|
-
return Gosu::Color{color}.hue();
|
|
103
|
-
});
|
|
77
|
+
return Gosu::Color{color}.hue();
|
|
104
78
|
}
|
|
105
79
|
|
|
106
80
|
GOSU_FFI_API double Gosu_Color_saturation(uint32_t color)
|
|
107
81
|
{
|
|
108
|
-
return
|
|
109
|
-
return Gosu::Color{color}.saturation();
|
|
110
|
-
});
|
|
82
|
+
return Gosu::Color{color}.saturation();
|
|
111
83
|
}
|
|
112
84
|
|
|
113
85
|
GOSU_FFI_API double Gosu_Color_value(uint32_t color)
|
|
114
86
|
{
|
|
115
|
-
return
|
|
116
|
-
return Gosu::Color{color}.value();
|
|
117
|
-
});
|
|
87
|
+
return Gosu::Color{color}.value();
|
|
118
88
|
}
|
|
119
89
|
|
|
120
90
|
GOSU_FFI_API uint32_t Gosu_Color_set_hue(uint32_t color, double value)
|
|
121
91
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
gosu_color.set_hue(value);
|
|
92
|
+
Gosu::Color gosu_color{color};
|
|
93
|
+
gosu_color.set_hue(value);
|
|
125
94
|
|
|
126
|
-
|
|
127
|
-
});
|
|
95
|
+
return gosu_color.argb();
|
|
128
96
|
}
|
|
129
97
|
|
|
130
98
|
GOSU_FFI_API uint32_t Gosu_Color_set_saturation(uint32_t color, double value)
|
|
131
99
|
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
gosu_color.set_saturation(value);
|
|
100
|
+
Gosu::Color gosu_color{color};
|
|
101
|
+
gosu_color.set_saturation(value);
|
|
135
102
|
|
|
136
|
-
|
|
137
|
-
});
|
|
103
|
+
return gosu_color.argb();
|
|
138
104
|
}
|
|
139
105
|
|
|
140
106
|
GOSU_FFI_API uint32_t Gosu_Color_set_value(uint32_t color, double value)
|
|
141
107
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
gosu_color.set_value(value);
|
|
108
|
+
Gosu::Color gosu_color{color};
|
|
109
|
+
gosu_color.set_value(value);
|
|
145
110
|
|
|
146
|
-
|
|
147
|
-
});
|
|
111
|
+
return gosu_color.argb();
|
|
148
112
|
}
|
|
149
113
|
|
|
150
114
|
GOSU_FFI_API uint32_t Gosu_Color_argb(uint32_t color)
|
|
151
115
|
{
|
|
152
|
-
return
|
|
153
|
-
return Gosu::Color{color}.argb();
|
|
154
|
-
});
|
|
116
|
+
return Gosu::Color{color}.argb();
|
|
155
117
|
}
|
|
156
118
|
|
|
157
119
|
GOSU_FFI_API uint32_t Gosu_Color_bgr(uint32_t color)
|
|
158
120
|
{
|
|
159
|
-
return
|
|
160
|
-
return Gosu::Color{color}.bgr();
|
|
161
|
-
});
|
|
121
|
+
return Gosu::Color{color}.bgr();
|
|
162
122
|
}
|
|
163
123
|
|
|
164
124
|
GOSU_FFI_API uint32_t Gosu_Color_abgr(uint32_t color)
|
|
165
125
|
{
|
|
166
|
-
return
|
|
167
|
-
return Gosu::Color{color}.abgr();
|
|
168
|
-
});
|
|
126
|
+
return Gosu::Color{color}.abgr();
|
|
169
127
|
}
|
|
170
128
|
|
|
171
129
|
GOSU_FFI_API uint32_t Gosu_Color_gl(uint32_t color)
|
|
172
130
|
{
|
|
173
|
-
return
|
|
174
|
-
return color;
|
|
175
|
-
});
|
|
131
|
+
return color;
|
|
176
132
|
}
|
data/ffi/Gosu_FFI_internal.h
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#include "Gosu.h"
|
|
8
8
|
#include <Gosu/Gosu.hpp>
|
|
9
|
-
#include <
|
|
10
|
-
#include <functional>
|
|
11
|
-
#include <string>
|
|
9
|
+
#include <stdexcept>
|
|
12
10
|
|
|
13
11
|
// Error handling
|
|
14
12
|
|
|
@@ -18,12 +16,7 @@ template<typename Functor>
|
|
|
18
16
|
auto Gosu_translate_exceptions(Functor functor)
|
|
19
17
|
{
|
|
20
18
|
try {
|
|
21
|
-
// The functor may call back into Ruby, which may in turn call other Gosu methods that fail.
|
|
22
|
-
// If the Ruby callback handles these errors itself, they must not be reported again.
|
|
23
|
-
// => Reset it not only before, but also after the functor.
|
|
24
19
|
Gosu_internal_error().clear();
|
|
25
|
-
const auto clear_again = Gosu::finally([] { Gosu_internal_error().clear(); });
|
|
26
|
-
|
|
27
20
|
return functor();
|
|
28
21
|
}
|
|
29
22
|
catch (const std::exception& e) {
|
|
@@ -33,7 +26,7 @@ auto Gosu_translate_exceptions(Functor functor)
|
|
|
33
26
|
}
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
// C-compatible wrapper structs for Gosu classes
|
|
29
|
+
// C-compatible wrapper structs for Gosu classes
|
|
37
30
|
|
|
38
31
|
struct Gosu_Channel
|
|
39
32
|
{
|
|
@@ -55,11 +48,15 @@ struct Gosu_Sample
|
|
|
55
48
|
Gosu::Sample sample;
|
|
56
49
|
};
|
|
57
50
|
|
|
58
|
-
// Use inheritance where composition is not feasible
|
|
51
|
+
// Use inheritance where composition is not feasible
|
|
59
52
|
|
|
60
53
|
struct Gosu_Song : Gosu::Song
|
|
61
54
|
{
|
|
62
|
-
|
|
55
|
+
[[maybe_unused]] // silence buggy warning, this is being used in Gosu_Song.cpp.
|
|
56
|
+
explicit Gosu_Song(const std::string& filename)
|
|
57
|
+
: Gosu::Song{filename}
|
|
58
|
+
{
|
|
59
|
+
}
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
struct Gosu_TextInput : public Gosu::TextInput
|
|
@@ -80,7 +77,11 @@ struct Gosu_TextInput : public Gosu::TextInput
|
|
|
80
77
|
|
|
81
78
|
struct Gosu_Window : public Gosu::Window
|
|
82
79
|
{
|
|
83
|
-
|
|
80
|
+
[[maybe_unused]] // silence buggy warning, this is being used in Gosu_Window.cpp.
|
|
81
|
+
Gosu_Window(int width, int height, unsigned window_flags, double update_interval)
|
|
82
|
+
: Gosu::Window(width, height, window_flags, update_interval)
|
|
83
|
+
{
|
|
84
|
+
}
|
|
84
85
|
|
|
85
86
|
void update() override
|
|
86
87
|
{
|
data/ffi/Gosu_Font.cpp
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#include "Gosu_FFI_internal.h"
|
|
2
2
|
|
|
3
|
-
GOSU_FFI_API Gosu_Font* Gosu_Font_create(int height, const char* name, unsigned flags,
|
|
4
|
-
unsigned image_flags)
|
|
3
|
+
GOSU_FFI_API Gosu_Font* Gosu_Font_create(int height, const char* name, unsigned flags, unsigned image_flags)
|
|
5
4
|
{
|
|
6
5
|
return Gosu_translate_exceptions([=] {
|
|
7
|
-
return new Gosu_Font
|
|
6
|
+
return new Gosu_Font{Gosu::Font{height, name, flags, image_flags}};
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
9
|
|
|
@@ -15,7 +14,7 @@ GOSU_FFI_API void Gosu_Font_destroy(Gosu_Font* font)
|
|
|
15
14
|
|
|
16
15
|
GOSU_FFI_API const char* Gosu_Font_name(Gosu_Font* font)
|
|
17
16
|
{
|
|
18
|
-
thread_local std::string name;
|
|
17
|
+
static thread_local std::string name;
|
|
19
18
|
|
|
20
19
|
return Gosu_translate_exceptions([=] {
|
|
21
20
|
name = font->font.name();
|
|
@@ -44,47 +43,43 @@ GOSU_FFI_API double Gosu_Font_markup_width(Gosu_Font* font, const char* markup)
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
GOSU_FFI_API
|
|
46
|
+
GOSU_FFI_API void Gosu_Font_draw_text(Gosu_Font* font, const char* text, double x, double y,
|
|
48
47
|
double z, double scale_x, double scale_y, unsigned c,
|
|
49
48
|
unsigned mode)
|
|
50
49
|
{
|
|
51
|
-
|
|
50
|
+
Gosu_translate_exceptions([=] {
|
|
52
51
|
font->font.draw_text(text, x, y, z, scale_x, scale_y, c,
|
|
53
52
|
static_cast<Gosu::BlendMode>(mode));
|
|
54
|
-
return true;
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
GOSU_FFI_API
|
|
56
|
+
GOSU_FFI_API void Gosu_Font_draw_markup(Gosu_Font* font, const char* markup, double x, double y,
|
|
59
57
|
double z, double scale_x, double scale_y, unsigned c,
|
|
60
58
|
unsigned mode)
|
|
61
59
|
{
|
|
62
|
-
|
|
60
|
+
Gosu_translate_exceptions([=] {
|
|
63
61
|
font->font.draw_markup(markup, x, y, z, scale_x, scale_y, c,
|
|
64
62
|
static_cast<Gosu::BlendMode>(mode));
|
|
65
|
-
return true;
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
GOSU_FFI_API
|
|
66
|
+
GOSU_FFI_API void Gosu_Font_draw_text_rel(Gosu_Font* font, const char* text, double x, double y,
|
|
70
67
|
double z, double rel_x, double rel_y, double scale_x,
|
|
71
68
|
double scale_y, unsigned c, unsigned mode)
|
|
72
69
|
{
|
|
73
|
-
|
|
70
|
+
Gosu_translate_exceptions([=] {
|
|
74
71
|
font->font.draw_text_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, c,
|
|
75
72
|
static_cast<Gosu::BlendMode>(mode));
|
|
76
|
-
return true;
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
GOSU_FFI_API
|
|
76
|
+
GOSU_FFI_API void Gosu_Font_draw_markup_rel(Gosu_Font* font, const char* markup, double x, double y,
|
|
81
77
|
double z, double rel_x, double rel_y, double scale_x,
|
|
82
78
|
double scale_y, unsigned c, unsigned mode)
|
|
83
79
|
{
|
|
84
|
-
|
|
80
|
+
Gosu_translate_exceptions([=] {
|
|
85
81
|
font->font.draw_markup_rel(markup, x, y, z, rel_x, rel_y, scale_x, scale_y, c,
|
|
86
82
|
static_cast<Gosu::BlendMode>(mode));
|
|
87
|
-
return true;
|
|
88
83
|
});
|
|
89
84
|
}
|
|
90
85
|
|