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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Simple DirectMedia Layer
|
|
3
|
-
Copyright (C) 1997-
|
|
3
|
+
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
|
4
4
|
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
|
@@ -20,22 +20,33 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* \file SDL_bits.h
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* Functions for fiddling with bits and bitmasks.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
#ifndef SDL_bits_h_
|
|
29
29
|
#define SDL_bits_h_
|
|
30
30
|
|
|
31
|
-
#include
|
|
31
|
+
#include "SDL_stdinc.h"
|
|
32
32
|
|
|
33
|
-
#include
|
|
33
|
+
#include "begin_code.h"
|
|
34
34
|
/* Set up for C function definitions, even when using C++ */
|
|
35
35
|
#ifdef __cplusplus
|
|
36
36
|
extern "C" {
|
|
37
37
|
#endif
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* \file SDL_bits.h
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the index of the most significant bit. Result is undefined when called
|
|
45
|
+
* with 0. This operation can also be stated as "count leading zeroes" and
|
|
46
|
+
* "log base 2".
|
|
47
|
+
*
|
|
48
|
+
* \return the index of the most significant bit, or -1 if the value is 0.
|
|
49
|
+
*/
|
|
39
50
|
#if defined(__WATCOMC__) && defined(__386__)
|
|
40
51
|
extern __inline int _SDL_bsr_watcom(Uint32);
|
|
41
52
|
#pragma aux _SDL_bsr_watcom = \
|
|
@@ -45,24 +56,8 @@ extern __inline int _SDL_bsr_watcom(Uint32);
|
|
|
45
56
|
modify exact [eax] nomemory;
|
|
46
57
|
#endif
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
* This operation can also be stated as "count leading zeroes" and "log base 2".
|
|
52
|
-
*
|
|
53
|
-
* Note that this is a forced-inline function in a header, and not a public
|
|
54
|
-
* API function available in the SDL library (which is to say, the code is
|
|
55
|
-
* embedded in the calling program and the linker and dynamic loader will not
|
|
56
|
-
* be able to find this function inside SDL itself).
|
|
57
|
-
*
|
|
58
|
-
* \param x the 32-bit value to examine.
|
|
59
|
-
* \returns the index of the most significant bit, or -1 if the value is 0.
|
|
60
|
-
*
|
|
61
|
-
* \threadsafety It is safe to call this function from any thread.
|
|
62
|
-
*
|
|
63
|
-
* \since This function is available since SDL 3.2.0.
|
|
64
|
-
*/
|
|
65
|
-
SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
|
|
59
|
+
SDL_FORCE_INLINE int
|
|
60
|
+
SDL_MostSignificantBitIndex32(Uint32 x)
|
|
66
61
|
{
|
|
67
62
|
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
68
63
|
/* Count Leading Zeroes builtin in GCC.
|
|
@@ -77,10 +72,10 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
|
|
|
77
72
|
return -1;
|
|
78
73
|
}
|
|
79
74
|
return _SDL_bsr_watcom(x);
|
|
80
|
-
#elif defined(_MSC_VER)
|
|
75
|
+
#elif defined(_MSC_VER)
|
|
81
76
|
unsigned long index;
|
|
82
77
|
if (_BitScanReverse(&index, x)) {
|
|
83
|
-
return
|
|
78
|
+
return index;
|
|
84
79
|
}
|
|
85
80
|
return -1;
|
|
86
81
|
#else
|
|
@@ -111,36 +106,21 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
|
|
|
111
106
|
#endif
|
|
112
107
|
}
|
|
113
108
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*
|
|
117
|
-
* If there are no bits set (`x` is zero), or more than one bit set, this
|
|
118
|
-
* returns false. If any one bit is exclusively set, this returns true.
|
|
119
|
-
*
|
|
120
|
-
* Note that this is a forced-inline function in a header, and not a public
|
|
121
|
-
* API function available in the SDL library (which is to say, the code is
|
|
122
|
-
* embedded in the calling program and the linker and dynamic loader will not
|
|
123
|
-
* be able to find this function inside SDL itself).
|
|
124
|
-
*
|
|
125
|
-
* \param x the 32-bit value to examine.
|
|
126
|
-
* \returns true if exactly one bit is set in `x`, false otherwise.
|
|
127
|
-
*
|
|
128
|
-
* \threadsafety It is safe to call this function from any thread.
|
|
129
|
-
*
|
|
130
|
-
* \since This function is available since SDL 3.2.0.
|
|
131
|
-
*/
|
|
132
|
-
SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x)
|
|
109
|
+
SDL_FORCE_INLINE SDL_bool
|
|
110
|
+
SDL_HasExactlyOneBitSet32(Uint32 x)
|
|
133
111
|
{
|
|
134
112
|
if (x && !(x & (x - 1))) {
|
|
135
|
-
return
|
|
113
|
+
return SDL_TRUE;
|
|
136
114
|
}
|
|
137
|
-
return
|
|
115
|
+
return SDL_FALSE;
|
|
138
116
|
}
|
|
139
117
|
|
|
140
118
|
/* Ends C function definitions when using C++ */
|
|
141
119
|
#ifdef __cplusplus
|
|
142
120
|
}
|
|
143
121
|
#endif
|
|
144
|
-
#include
|
|
122
|
+
#include "close_code.h"
|
|
145
123
|
|
|
146
124
|
#endif /* SDL_bits_h_ */
|
|
125
|
+
|
|
126
|
+
/* vi: set ts=4 sw=4 expandtab: */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Simple DirectMedia Layer
|
|
3
|
-
Copyright (C) 1997-
|
|
3
|
+
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
|
4
4
|
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
|
@@ -20,72 +20,61 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* \file SDL_blendmode.h
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* standard modes for basic needs and a means to create custom modes,
|
|
27
|
-
* dictating what sort of math to do on what color components.
|
|
25
|
+
* Header file declaring the SDL_BlendMode enumeration
|
|
28
26
|
*/
|
|
29
27
|
|
|
30
28
|
#ifndef SDL_blendmode_h_
|
|
31
29
|
#define SDL_blendmode_h_
|
|
32
30
|
|
|
33
|
-
#include
|
|
34
|
-
|
|
35
|
-
#include <SDL3/SDL_begin_code.h>
|
|
31
|
+
#include "begin_code.h"
|
|
36
32
|
/* Set up for C function definitions, even when using C++ */
|
|
37
33
|
#ifdef __cplusplus
|
|
38
34
|
extern "C" {
|
|
39
35
|
#endif
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* These predefined blend modes are supported everywhere.
|
|
45
|
-
*
|
|
46
|
-
* Additional values may be obtained from SDL_ComposeCustomBlendMode.
|
|
47
|
-
*
|
|
48
|
-
* \since This datatype is available since SDL 3.2.0.
|
|
49
|
-
*
|
|
50
|
-
* \sa SDL_ComposeCustomBlendMode
|
|
38
|
+
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
|
51
39
|
*/
|
|
52
|
-
typedef
|
|
40
|
+
typedef enum
|
|
41
|
+
{
|
|
42
|
+
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
|
|
43
|
+
dstRGBA = srcRGBA */
|
|
44
|
+
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
|
|
45
|
+
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
|
|
46
|
+
dstA = srcA + (dstA * (1-srcA)) */
|
|
47
|
+
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
|
|
48
|
+
dstRGB = (srcRGB * srcA) + dstRGB
|
|
49
|
+
dstA = dstA */
|
|
50
|
+
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
|
51
|
+
dstRGB = srcRGB * dstRGB
|
|
52
|
+
dstA = dstA */
|
|
53
|
+
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
|
|
54
|
+
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
|
|
55
|
+
dstA = dstA */
|
|
56
|
+
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
#define SDL_BLENDMODE_ADD 0x00000002u /**< additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA */
|
|
58
|
-
#define SDL_BLENDMODE_ADD_PREMULTIPLIED 0x00000020u /**< pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA */
|
|
59
|
-
#define SDL_BLENDMODE_MOD 0x00000004u /**< color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA */
|
|
60
|
-
#define SDL_BLENDMODE_MUL 0x00000008u /**< color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA */
|
|
61
|
-
#define SDL_BLENDMODE_INVALID 0x7FFFFFFFu
|
|
58
|
+
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
|
59
|
+
|
|
60
|
+
} SDL_BlendMode;
|
|
62
61
|
|
|
63
62
|
/**
|
|
64
|
-
* The blend operation used when combining source and destination pixel
|
|
65
|
-
* components.
|
|
66
|
-
*
|
|
67
|
-
* \since This enum is available since SDL 3.2.0.
|
|
63
|
+
* \brief The blend operation used when combining source and destination pixel components
|
|
68
64
|
*/
|
|
69
|
-
typedef enum
|
|
65
|
+
typedef enum
|
|
70
66
|
{
|
|
71
67
|
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
|
|
72
|
-
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**<
|
|
73
|
-
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**<
|
|
74
|
-
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by
|
|
75
|
-
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by
|
|
68
|
+
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
|
|
69
|
+
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
|
|
70
|
+
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
|
|
71
|
+
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
|
|
76
72
|
} SDL_BlendOperation;
|
|
77
73
|
|
|
78
74
|
/**
|
|
79
|
-
* The normalized factor used to multiply pixel components
|
|
80
|
-
*
|
|
81
|
-
* The blend factors are multiplied with the pixels from a drawing operation
|
|
82
|
-
* (src) and the pixels from the render target (dst) before the blend
|
|
83
|
-
* operation. The comma-separated factors listed above are always applied in
|
|
84
|
-
* the component order red, green, blue, and alpha.
|
|
85
|
-
*
|
|
86
|
-
* \since This enum is available since SDL 3.2.0.
|
|
75
|
+
* \brief The normalized factor used to multiply pixel components
|
|
87
76
|
*/
|
|
88
|
-
typedef enum
|
|
77
|
+
typedef enum
|
|
89
78
|
{
|
|
90
79
|
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
|
|
91
80
|
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
|
|
@@ -140,16 +129,23 @@ typedef enum SDL_BlendFactor
|
|
|
140
129
|
* either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will
|
|
141
130
|
* return with an error if the blend mode is not supported.
|
|
142
131
|
*
|
|
143
|
-
* This list describes the support of custom blend modes for each renderer
|
|
144
|
-
* All renderers support the four blend modes listed in the
|
|
145
|
-
* enumeration.
|
|
132
|
+
* This list describes the support of custom blend modes for each renderer in
|
|
133
|
+
* SDL 2.0.6. All renderers support the four blend modes listed in the
|
|
134
|
+
* SDL_BlendMode enumeration.
|
|
146
135
|
*
|
|
147
136
|
* - **direct3d**: Supports all operations with all factors. However, some
|
|
148
137
|
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
|
|
149
138
|
* `SDL_BLENDOPERATION_MAXIMUM`.
|
|
150
139
|
* - **direct3d11**: Same as Direct3D 9.
|
|
151
140
|
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
|
152
|
-
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly
|
|
141
|
+
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL
|
|
142
|
+
* 2.0.6.
|
|
143
|
+
* - **opengles**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
|
144
|
+
* factors. Color and alpha factors need to be the same. OpenGL ES 1
|
|
145
|
+
* implementation specific: May also support `SDL_BLENDOPERATION_SUBTRACT`
|
|
146
|
+
* and `SDL_BLENDOPERATION_REV_SUBTRACT`. May support color and alpha
|
|
147
|
+
* operations being different from each other. May support color and alpha
|
|
148
|
+
* factors being different from each other.
|
|
153
149
|
* - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`,
|
|
154
150
|
* `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT`
|
|
155
151
|
* operations with all factors.
|
|
@@ -162,31 +158,29 @@ typedef enum SDL_BlendFactor
|
|
|
162
158
|
* case.
|
|
163
159
|
*
|
|
164
160
|
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
|
|
165
|
-
* blue components of the source pixels
|
|
161
|
+
* blue components of the source pixels
|
|
166
162
|
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
|
|
167
|
-
* blue components of the destination pixels
|
|
163
|
+
* blue components of the destination pixels
|
|
168
164
|
* \param colorOperation the SDL_BlendOperation used to combine the red,
|
|
169
165
|
* green, and blue components of the source and
|
|
170
|
-
* destination pixels
|
|
166
|
+
* destination pixels
|
|
171
167
|
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
|
172
|
-
* the source pixels
|
|
168
|
+
* the source pixels
|
|
173
169
|
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
|
174
|
-
* the destination pixels
|
|
170
|
+
* the destination pixels
|
|
175
171
|
* \param alphaOperation the SDL_BlendOperation used to combine the alpha
|
|
176
|
-
* component of the source and destination pixels
|
|
172
|
+
* component of the source and destination pixels
|
|
177
173
|
* \returns an SDL_BlendMode that represents the chosen factors and
|
|
178
174
|
* operations.
|
|
179
175
|
*
|
|
180
|
-
* \
|
|
181
|
-
*
|
|
182
|
-
* \since This function is available since SDL 3.2.0.
|
|
176
|
+
* \since This function is available since SDL 2.0.6.
|
|
183
177
|
*
|
|
184
178
|
* \sa SDL_SetRenderDrawBlendMode
|
|
185
179
|
* \sa SDL_GetRenderDrawBlendMode
|
|
186
180
|
* \sa SDL_SetTextureBlendMode
|
|
187
181
|
* \sa SDL_GetTextureBlendMode
|
|
188
182
|
*/
|
|
189
|
-
extern
|
|
183
|
+
extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
|
|
190
184
|
SDL_BlendFactor dstColorFactor,
|
|
191
185
|
SDL_BlendOperation colorOperation,
|
|
192
186
|
SDL_BlendFactor srcAlphaFactor,
|
|
@@ -197,6 +191,8 @@ extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFa
|
|
|
197
191
|
#ifdef __cplusplus
|
|
198
192
|
}
|
|
199
193
|
#endif
|
|
200
|
-
#include
|
|
194
|
+
#include "close_code.h"
|
|
201
195
|
|
|
202
196
|
#endif /* SDL_blendmode_h_ */
|
|
197
|
+
|
|
198
|
+
/* vi: set ts=4 sw=4 expandtab: */
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Simple DirectMedia Layer
|
|
3
|
+
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
|
4
|
+
|
|
5
|
+
This software is provided 'as-is', without any express or implied
|
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
|
7
|
+
arising from the use of this software.
|
|
8
|
+
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
|
11
|
+
freely, subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
14
|
+
claim that you wrote the original software. If you use this software
|
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
|
16
|
+
appreciated but is not required.
|
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
18
|
+
misrepresented as being the original software.
|
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* \file SDL_clipboard.h
|
|
24
|
+
*
|
|
25
|
+
* Include file for SDL clipboard handling
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#ifndef SDL_clipboard_h_
|
|
29
|
+
#define SDL_clipboard_h_
|
|
30
|
+
|
|
31
|
+
#include "SDL_stdinc.h"
|
|
32
|
+
|
|
33
|
+
#include "begin_code.h"
|
|
34
|
+
/* Set up for C function definitions, even when using C++ */
|
|
35
|
+
#ifdef __cplusplus
|
|
36
|
+
extern "C" {
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
/* Function prototypes */
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Put UTF-8 text into the clipboard.
|
|
43
|
+
*
|
|
44
|
+
* \param text the text to store in the clipboard
|
|
45
|
+
* \returns 0 on success or a negative error code on failure; call
|
|
46
|
+
* SDL_GetError() for more information.
|
|
47
|
+
*
|
|
48
|
+
* \since This function is available since SDL 2.0.0.
|
|
49
|
+
*
|
|
50
|
+
* \sa SDL_GetClipboardText
|
|
51
|
+
* \sa SDL_HasClipboardText
|
|
52
|
+
*/
|
|
53
|
+
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get UTF-8 text from the clipboard, which must be freed with SDL_free().
|
|
57
|
+
*
|
|
58
|
+
* This functions returns empty string if there was not enough memory left for
|
|
59
|
+
* a copy of the clipboard's content.
|
|
60
|
+
*
|
|
61
|
+
* \returns the clipboard text on success or an empty string on failure; call
|
|
62
|
+
* SDL_GetError() for more information. Caller must call SDL_free()
|
|
63
|
+
* on the returned pointer when done with it (even if there was an
|
|
64
|
+
* error).
|
|
65
|
+
*
|
|
66
|
+
* \since This function is available since SDL 2.0.0.
|
|
67
|
+
*
|
|
68
|
+
* \sa SDL_HasClipboardText
|
|
69
|
+
* \sa SDL_SetClipboardText
|
|
70
|
+
*/
|
|
71
|
+
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Query whether the clipboard exists and contains a non-empty text string.
|
|
75
|
+
*
|
|
76
|
+
* \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.
|
|
77
|
+
*
|
|
78
|
+
* \since This function is available since SDL 2.0.0.
|
|
79
|
+
*
|
|
80
|
+
* \sa SDL_GetClipboardText
|
|
81
|
+
* \sa SDL_SetClipboardText
|
|
82
|
+
*/
|
|
83
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Put UTF-8 text into the primary selection.
|
|
87
|
+
*
|
|
88
|
+
* \param text the text to store in the primary selection
|
|
89
|
+
* \returns 0 on success or a negative error code on failure; call
|
|
90
|
+
* SDL_GetError() for more information.
|
|
91
|
+
*
|
|
92
|
+
* \since This function is available since SDL 2.26.0.
|
|
93
|
+
*
|
|
94
|
+
* \sa SDL_GetPrimarySelectionText
|
|
95
|
+
* \sa SDL_HasPrimarySelectionText
|
|
96
|
+
*/
|
|
97
|
+
extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get UTF-8 text from the primary selection, which must be freed with
|
|
101
|
+
* SDL_free().
|
|
102
|
+
*
|
|
103
|
+
* This functions returns empty string if there was not enough memory left for
|
|
104
|
+
* a copy of the primary selection's content.
|
|
105
|
+
*
|
|
106
|
+
* \returns the primary selection text on success or an empty string on
|
|
107
|
+
* failure; call SDL_GetError() for more information. Caller must
|
|
108
|
+
* call SDL_free() on the returned pointer when done with it (even if
|
|
109
|
+
* there was an error).
|
|
110
|
+
*
|
|
111
|
+
* \since This function is available since SDL 2.26.0.
|
|
112
|
+
*
|
|
113
|
+
* \sa SDL_HasPrimarySelectionText
|
|
114
|
+
* \sa SDL_SetPrimarySelectionText
|
|
115
|
+
*/
|
|
116
|
+
extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Query whether the primary selection exists and contains a non-empty text
|
|
120
|
+
* string.
|
|
121
|
+
*
|
|
122
|
+
* \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it
|
|
123
|
+
* does not.
|
|
124
|
+
*
|
|
125
|
+
* \since This function is available since SDL 2.26.0.
|
|
126
|
+
*
|
|
127
|
+
* \sa SDL_GetPrimarySelectionText
|
|
128
|
+
* \sa SDL_SetPrimarySelectionText
|
|
129
|
+
*/
|
|
130
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void);
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/* Ends C function definitions when using C++ */
|
|
134
|
+
#ifdef __cplusplus
|
|
135
|
+
}
|
|
136
|
+
#endif
|
|
137
|
+
#include "close_code.h"
|
|
138
|
+
|
|
139
|
+
#endif /* SDL_clipboard_h_ */
|
|
140
|
+
|
|
141
|
+
/* vi: set ts=4 sw=4 expandtab: */
|