ruby2d 0.9.4 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +1 -1
- data/assets/include/SDL2/SDL_audio.h +1 -1
- data/assets/include/SDL2/SDL_bits.h +1 -1
- data/assets/include/SDL2/SDL_blendmode.h +4 -1
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +1 -1
- data/assets/include/SDL2/SDL_config_android.h +7 -3
- data/assets/include/SDL2/SDL_config_iphoneos.h +16 -10
- data/assets/include/SDL2/SDL_config_macosx.h +40 -14
- data/assets/include/SDL2/SDL_config_minimal.h +1 -1
- data/assets/include/SDL2/SDL_config_os2.h +26 -8
- data/assets/include/SDL2/SDL_config_pandora.h +4 -2
- data/assets/include/SDL2/SDL_config_psp.h +2 -1
- data/assets/include/SDL2/SDL_config_windows.h +40 -9
- data/assets/include/SDL2/SDL_config_winrt.h +5 -2
- data/assets/include/SDL2/SDL_config_wiz.h +5 -2
- data/assets/include/SDL2/SDL_copying.h +1 -1
- data/assets/include/SDL2/SDL_cpuinfo.h +32 -3
- data/assets/include/SDL2/SDL_egl.h +4 -1
- data/assets/include/SDL2/SDL_endian.h +6 -3
- data/assets/include/SDL2/SDL_error.h +38 -2
- data/assets/include/SDL2/SDL_events.h +64 -28
- data/assets/include/SDL2/SDL_filesystem.h +1 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
- data/assets/include/SDL2/SDL_gesture.h +1 -1
- data/assets/include/SDL2/SDL_haptic.h +10 -1
- data/assets/include/SDL2/SDL_hints.h +316 -4
- data/assets/include/SDL2/SDL_joystick.h +115 -24
- data/assets/include/SDL2/SDL_keyboard.h +1 -1
- data/assets/include/SDL2/SDL_keycode.h +11 -9
- data/assets/include/SDL2/SDL_loadso.h +1 -1
- data/assets/include/SDL2/SDL_locale.h +101 -0
- data/assets/include/SDL2/SDL_log.h +3 -3
- data/assets/include/SDL2/SDL_main.h +1 -1
- data/assets/include/SDL2/SDL_messagebox.h +6 -4
- data/assets/include/SDL2/SDL_metal.h +117 -0
- data/assets/include/SDL2/SDL_misc.h +75 -0
- data/assets/include/SDL2/SDL_mouse.h +1 -1
- data/assets/include/SDL2/SDL_mutex.h +1 -1
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +1 -1
- data/assets/include/SDL2/SDL_pixels.h +25 -16
- data/assets/include/SDL2/SDL_platform.h +1 -1
- data/assets/include/SDL2/SDL_power.h +1 -1
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +1 -1
- data/assets/include/SDL2/SDL_render.h +63 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +2 -10
- data/assets/include/SDL2/SDL_scancode.h +1 -1
- data/assets/include/SDL2/SDL_sensor.h +25 -9
- data/assets/include/SDL2/SDL_shape.h +1 -1
- data/assets/include/SDL2/SDL_stdinc.h +44 -4
- data/assets/include/SDL2/SDL_surface.h +11 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +29 -2
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +1 -1
- data/assets/include/SDL2/SDL_test_common.h +14 -1
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +1 -1
- data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
- data/assets/include/SDL2/SDL_test_harness.h +1 -1
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +1 -1
- data/assets/include/SDL2/SDL_test_random.h +1 -1
- data/assets/include/SDL2/SDL_thread.h +34 -11
- data/assets/include/SDL2/SDL_timer.h +1 -1
- data/assets/include/SDL2/SDL_touch.h +1 -1
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +2 -2
- data/assets/include/SDL2/SDL_video.h +11 -5
- data/assets/include/SDL2/SDL_vulkan.h +6 -8
- data/assets/include/SDL2/begin_code.h +5 -9
- data/assets/include/SDL2/close_code.h +1 -1
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libmodplug.a +0 -0
- data/assets/macos/lib/libmpg123.a +0 -0
- data/assets/macos/lib/libogg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/lib/libSDL2.a +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/bin/ruby2d +1 -0
- data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
- data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
- data/ext/ruby2d/extconf.rb +37 -59
- data/ext/ruby2d/font.c +35 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +66 -98
- data/ext/ruby2d/gl2.c +86 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +69 -112
- data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +22 -81
- data/ext/ruby2d/image.c +58 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
- data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
- data/ext/ruby2d/ruby2d.c +449 -439
- data/ext/ruby2d/ruby2d.h +652 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
- data/{assets/linux/simple2d/src → ext/ruby2d}/sound.c +39 -14
- data/ext/ruby2d/text.c +22 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +63 -63
- data/lib/ruby2d/circle.rb +21 -3
- data/lib/ruby2d/cli/build.rb +4 -7
- data/lib/ruby2d/dsl.rb +16 -9
- data/lib/ruby2d/entity.rb +17 -0
- data/lib/ruby2d/font.rb +23 -3
- data/lib/ruby2d/image.rb +35 -7
- data/lib/ruby2d/line.rb +23 -1
- data/lib/ruby2d/music.rb +5 -0
- data/lib/ruby2d/pixel.rb +17 -0
- data/lib/ruby2d/quad.rb +21 -1
- data/lib/ruby2d/rectangle.rb +12 -3
- data/lib/ruby2d/renderable.rb +4 -20
- data/lib/ruby2d/sound.rb +30 -0
- data/lib/ruby2d/sprite.rb +57 -75
- data/lib/ruby2d/square.rb +10 -1
- data/lib/ruby2d/text.rb +55 -12
- data/lib/ruby2d/texture.rb +28 -0
- data/lib/ruby2d/tileset.rb +87 -0
- data/lib/ruby2d/triangle.rb +19 -1
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +84 -0
- data/lib/ruby2d/window.rb +259 -22
- data/lib/ruby2d.rb +6 -1
- metadata +30 -26
- data/assets/include/simple2d.h +0 -757
- data/assets/linux/simple2d/Makefile +0 -260
- data/assets/linux/simple2d/bin/simple2d.sh +0 -1318
- data/assets/linux/simple2d/include/simple2d.h +0 -757
- data/assets/linux/simple2d/src/gl2.c +0 -146
- data/assets/linux/simple2d/src/image.c +0 -138
- data/assets/linux/simple2d/src/sprite.c +0 -147
- data/assets/linux/simple2d/src/text.c +0 -129
- data/assets/macos/lib/libsimple2d.a +0 -0
- data/assets/mingw/lib/libsimple2d.a +0 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2020 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_misc.h
|
24
|
+
*
|
25
|
+
* \brief Include file for SDL API functions that don't fit elsewhere.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef SDL_misc_h_
|
29
|
+
#define SDL_misc_h_
|
30
|
+
|
31
|
+
#include "SDL_stdinc.h"
|
32
|
+
|
33
|
+
#include "begin_code.h"
|
34
|
+
|
35
|
+
/* Set up for C function definitions, even when using C++ */
|
36
|
+
#ifdef __cplusplus
|
37
|
+
extern "C" {
|
38
|
+
#endif
|
39
|
+
|
40
|
+
/**
|
41
|
+
* \brief Open an URL / URI in the browser or other
|
42
|
+
*
|
43
|
+
* Open a URL in a separate, system-provided application. How this works will
|
44
|
+
* vary wildly depending on the platform. This will likely launch what
|
45
|
+
* makes sense to handle a specific URL's protocol (a web browser for http://,
|
46
|
+
* etc), but it might also be able to launch file managers for directories
|
47
|
+
* and other things.
|
48
|
+
*
|
49
|
+
* What happens when you open a URL varies wildly as well: your game window
|
50
|
+
* may lose focus (and may or may not lose focus if your game was fullscreen
|
51
|
+
* or grabbing input at the time). On mobile devices, your app will likely
|
52
|
+
* move to the background or your process might be paused. Any given platform
|
53
|
+
* may or may not handle a given URL.
|
54
|
+
*
|
55
|
+
* If this is unimplemented (or simply unavailable) for a platform, this will
|
56
|
+
* fail with an error. A successful result does not mean the URL loaded, just
|
57
|
+
* that we launched something to handle it (or at least believe we did).
|
58
|
+
*
|
59
|
+
* All this to say: this function can be useful, but you should definitely
|
60
|
+
* test it on every platform you target.
|
61
|
+
*
|
62
|
+
* \param url A valid URL to open.
|
63
|
+
* \return 0 on success, or -1 on error.
|
64
|
+
*/
|
65
|
+
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
66
|
+
|
67
|
+
/* Ends C function definitions when using C++ */
|
68
|
+
#ifdef __cplusplus
|
69
|
+
}
|
70
|
+
#endif
|
71
|
+
#include "close_code.h"
|
72
|
+
|
73
|
+
#endif /* SDL_misc_h_ */
|
74
|
+
|
75
|
+
/* 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-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -48,7 +48,7 @@ extern "C" {
|
|
48
48
|
/* @} */
|
49
49
|
|
50
50
|
/** Pixel type. */
|
51
|
-
enum
|
51
|
+
typedef enum
|
52
52
|
{
|
53
53
|
SDL_PIXELTYPE_UNKNOWN,
|
54
54
|
SDL_PIXELTYPE_INDEX1,
|
@@ -62,18 +62,18 @@ enum
|
|
62
62
|
SDL_PIXELTYPE_ARRAYU32,
|
63
63
|
SDL_PIXELTYPE_ARRAYF16,
|
64
64
|
SDL_PIXELTYPE_ARRAYF32
|
65
|
-
};
|
65
|
+
} SDL_PixelType;
|
66
66
|
|
67
67
|
/** Bitmap pixel order, high bit -> low bit. */
|
68
|
-
enum
|
68
|
+
typedef enum
|
69
69
|
{
|
70
70
|
SDL_BITMAPORDER_NONE,
|
71
71
|
SDL_BITMAPORDER_4321,
|
72
72
|
SDL_BITMAPORDER_1234
|
73
|
-
};
|
73
|
+
} SDL_BitmapOrder;
|
74
74
|
|
75
75
|
/** Packed component order, high bit -> low bit. */
|
76
|
-
enum
|
76
|
+
typedef enum
|
77
77
|
{
|
78
78
|
SDL_PACKEDORDER_NONE,
|
79
79
|
SDL_PACKEDORDER_XRGB,
|
@@ -84,12 +84,12 @@ enum
|
|
84
84
|
SDL_PACKEDORDER_BGRX,
|
85
85
|
SDL_PACKEDORDER_ABGR,
|
86
86
|
SDL_PACKEDORDER_BGRA
|
87
|
-
};
|
87
|
+
} SDL_PackedOrder;
|
88
88
|
|
89
89
|
/** Array component order, low byte -> high byte. */
|
90
90
|
/* !!! FIXME: in 2.1, make these not overlap differently with
|
91
91
|
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
|
92
|
-
enum
|
92
|
+
typedef enum
|
93
93
|
{
|
94
94
|
SDL_ARRAYORDER_NONE,
|
95
95
|
SDL_ARRAYORDER_RGB,
|
@@ -98,10 +98,10 @@ enum
|
|
98
98
|
SDL_ARRAYORDER_BGR,
|
99
99
|
SDL_ARRAYORDER_BGRA,
|
100
100
|
SDL_ARRAYORDER_ABGR
|
101
|
-
};
|
101
|
+
} SDL_ArrayOrder;
|
102
102
|
|
103
103
|
/** Packed component layout. */
|
104
|
-
enum
|
104
|
+
typedef enum
|
105
105
|
{
|
106
106
|
SDL_PACKEDLAYOUT_NONE,
|
107
107
|
SDL_PACKEDLAYOUT_332,
|
@@ -112,7 +112,7 @@ enum
|
|
112
112
|
SDL_PACKEDLAYOUT_8888,
|
113
113
|
SDL_PACKEDLAYOUT_2101010,
|
114
114
|
SDL_PACKEDLAYOUT_1010102
|
115
|
-
};
|
115
|
+
} SDL_PackedLayout;
|
116
116
|
|
117
117
|
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
|
118
118
|
|
@@ -188,15 +188,22 @@ typedef enum
|
|
188
188
|
SDL_PIXELFORMAT_RGB332 =
|
189
189
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
|
190
190
|
SDL_PACKEDLAYOUT_332, 8, 1),
|
191
|
-
|
191
|
+
SDL_PIXELFORMAT_XRGB4444 =
|
192
192
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
193
193
|
SDL_PACKEDLAYOUT_4444, 12, 2),
|
194
|
-
|
194
|
+
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
|
195
|
+
SDL_PIXELFORMAT_XBGR4444 =
|
196
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
197
|
+
SDL_PACKEDLAYOUT_4444, 12, 2),
|
198
|
+
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
|
199
|
+
SDL_PIXELFORMAT_XRGB1555 =
|
195
200
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
196
201
|
SDL_PACKEDLAYOUT_1555, 15, 2),
|
197
|
-
|
202
|
+
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
|
203
|
+
SDL_PIXELFORMAT_XBGR1555 =
|
198
204
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
199
205
|
SDL_PACKEDLAYOUT_1555, 15, 2),
|
206
|
+
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
|
200
207
|
SDL_PIXELFORMAT_ARGB4444 =
|
201
208
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
|
202
209
|
SDL_PACKEDLAYOUT_4444, 16, 2),
|
@@ -233,15 +240,17 @@ typedef enum
|
|
233
240
|
SDL_PIXELFORMAT_BGR24 =
|
234
241
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
|
235
242
|
24, 3),
|
236
|
-
|
243
|
+
SDL_PIXELFORMAT_XRGB8888 =
|
237
244
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
|
238
245
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
246
|
+
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
|
239
247
|
SDL_PIXELFORMAT_RGBX8888 =
|
240
248
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
|
241
249
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
242
|
-
|
250
|
+
SDL_PIXELFORMAT_XBGR8888 =
|
243
251
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
|
244
252
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
253
|
+
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
|
245
254
|
SDL_PIXELFORMAT_BGRX8888 =
|
246
255
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
|
247
256
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
|
|
85
85
|
int max_texture_height; /**< The maximum texture height */
|
86
86
|
} SDL_RendererInfo;
|
87
87
|
|
88
|
+
/**
|
89
|
+
* \brief The scaling mode for a texture.
|
90
|
+
*/
|
91
|
+
typedef enum
|
92
|
+
{
|
93
|
+
SDL_ScaleModeNearest, /**< nearest pixel sampling */
|
94
|
+
SDL_ScaleModeLinear, /**< linear filtering */
|
95
|
+
SDL_ScaleModeBest /**< anisotropic filtering */
|
96
|
+
} SDL_ScaleMode;
|
97
|
+
|
88
98
|
/**
|
89
99
|
* \brief The access pattern allowed for a texture.
|
90
100
|
*/
|
@@ -366,6 +376,35 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
|
366
376
|
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
367
377
|
SDL_BlendMode *blendMode);
|
368
378
|
|
379
|
+
/**
|
380
|
+
* \brief Set the scale mode used for texture scale operations.
|
381
|
+
*
|
382
|
+
* \param texture The texture to update.
|
383
|
+
* \param scaleMode ::SDL_ScaleMode to use for texture scaling.
|
384
|
+
*
|
385
|
+
* \return 0 on success, or -1 if the texture is not valid.
|
386
|
+
*
|
387
|
+
* \note If the scale mode is not supported, the closest supported mode is
|
388
|
+
* chosen.
|
389
|
+
*
|
390
|
+
* \sa SDL_GetTextureScaleMode()
|
391
|
+
*/
|
392
|
+
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
393
|
+
SDL_ScaleMode scaleMode);
|
394
|
+
|
395
|
+
/**
|
396
|
+
* \brief Get the scale mode used for texture scale operations.
|
397
|
+
*
|
398
|
+
* \param texture The texture to query.
|
399
|
+
* \param scaleMode A pointer filled in with the current scale mode.
|
400
|
+
*
|
401
|
+
* \return 0 on success, or -1 if the texture is not valid.
|
402
|
+
*
|
403
|
+
* \sa SDL_SetTextureScaleMode()
|
404
|
+
*/
|
405
|
+
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
406
|
+
SDL_ScaleMode *scaleMode);
|
407
|
+
|
369
408
|
/**
|
370
409
|
* \brief Update the given texture rectangle with new pixel data.
|
371
410
|
*
|
@@ -430,10 +469,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
|
430
469
|
const SDL_Rect * rect,
|
431
470
|
void **pixels, int *pitch);
|
432
471
|
|
472
|
+
/**
|
473
|
+
* \brief Lock a portion of the texture for write-only pixel access.
|
474
|
+
* Expose it as a SDL surface.
|
475
|
+
*
|
476
|
+
* \param texture The texture to lock for access, which was created with
|
477
|
+
* ::SDL_TEXTUREACCESS_STREAMING.
|
478
|
+
* \param rect A pointer to the rectangle to lock for access. If the rect
|
479
|
+
* is NULL, the entire texture will be locked.
|
480
|
+
* \param surface This is filled in with a SDL surface representing the locked area
|
481
|
+
* Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
|
482
|
+
*
|
483
|
+
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
|
484
|
+
*
|
485
|
+
* \sa SDL_UnlockTexture()
|
486
|
+
*/
|
487
|
+
extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
|
488
|
+
const SDL_Rect *rect,
|
489
|
+
SDL_Surface **surface);
|
490
|
+
|
433
491
|
/**
|
434
492
|
* \brief Unlock a texture, uploading the changes to video memory, if needed.
|
493
|
+
* If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
|
435
494
|
*
|
436
495
|
* \sa SDL_LockTexture()
|
496
|
+
* \sa SDL_LockTextureToSurface()
|
437
497
|
*/
|
438
498
|
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
439
499
|
|
@@ -558,8 +618,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
|
558
618
|
* \brief Set the clip rectangle for the current target.
|
559
619
|
*
|
560
620
|
* \param renderer The renderer for which clip rectangle should be set.
|
561
|
-
* \param rect A pointer to the rectangle to set as the clip rectangle,
|
562
|
-
* NULL to disable clipping.
|
621
|
+
* \param rect A pointer to the rectangle to set as the clip rectangle,
|
622
|
+
* relative to the viewport, or NULL to disable clipping.
|
563
623
|
*
|
564
624
|
* \return 0 on success, or -1 on error
|
565
625
|
*
|
@@ -1,2 +1,2 @@
|
|
1
|
-
#define SDL_REVISION "hg-
|
2
|
-
#define SDL_REVISION_NUMBER
|
1
|
+
#define SDL_REVISION "hg-14525:e52d96ea04fc"
|
2
|
+
#define SDL_REVISION_NUMBER 14525
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -96,15 +96,7 @@ typedef struct SDL_RWops
|
|
96
96
|
#if defined(__ANDROID__)
|
97
97
|
struct
|
98
98
|
{
|
99
|
-
void *
|
100
|
-
void *inputStreamRef;
|
101
|
-
void *readableByteChannelRef;
|
102
|
-
void *readMethod;
|
103
|
-
void *assetFileDescriptorRef;
|
104
|
-
long position;
|
105
|
-
long size;
|
106
|
-
long offset;
|
107
|
-
int fd;
|
99
|
+
void *asset;
|
108
100
|
} androidio;
|
109
101
|
#elif defined(__WIN32__)
|
110
102
|
struct
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -78,14 +78,16 @@ typedef enum
|
|
78
78
|
* Accelerometer sensor
|
79
79
|
*
|
80
80
|
* The accelerometer returns the current acceleration in SI meters per
|
81
|
-
* second squared. This includes gravity, so
|
82
|
-
* an
|
81
|
+
* second squared. This measurement includes the force of gravity, so
|
82
|
+
* a device at rest will have an value of SDL_STANDARD_GRAVITY away
|
83
|
+
* from the center of the earth.
|
83
84
|
*
|
84
85
|
* values[0]: Acceleration on the x axis
|
85
86
|
* values[1]: Acceleration on the y axis
|
86
87
|
* values[2]: Acceleration on the z axis
|
87
88
|
*
|
88
|
-
* For phones held in portrait mode
|
89
|
+
* For phones held in portrait mode and game controllers held in front of you,
|
90
|
+
* the axes are defined as follows:
|
89
91
|
* -X ... +X : left ... right
|
90
92
|
* -Y ... +Y : bottom ... top
|
91
93
|
* -Z ... +Z : farther ... closer
|
@@ -105,22 +107,36 @@ typedef enum
|
|
105
107
|
* see positive rotation on that axis when it appeared to be rotating
|
106
108
|
* counter-clockwise.
|
107
109
|
*
|
108
|
-
* values[0]: Angular speed around the x axis
|
109
|
-
* values[1]: Angular speed around the y axis
|
110
|
-
* values[2]: Angular speed around the z axis
|
110
|
+
* values[0]: Angular speed around the x axis (pitch)
|
111
|
+
* values[1]: Angular speed around the y axis (yaw)
|
112
|
+
* values[2]: Angular speed around the z axis (roll)
|
111
113
|
*
|
112
|
-
* For phones held in portrait mode
|
114
|
+
* For phones held in portrait mode and game controllers held in front of you,
|
115
|
+
* the axes are defined as follows:
|
113
116
|
* -X ... +X : left ... right
|
114
117
|
* -Y ... +Y : bottom ... top
|
115
118
|
* -Z ... +Z : farther ... closer
|
116
119
|
*
|
117
|
-
* The axis data is not changed when the phone is rotated.
|
120
|
+
* The axis data is not changed when the phone or controller is rotated.
|
118
121
|
*
|
119
122
|
* \sa SDL_GetDisplayOrientation()
|
120
123
|
*/
|
121
124
|
|
122
125
|
/* Function prototypes */
|
123
126
|
|
127
|
+
/**
|
128
|
+
* Locking for multi-threaded access to the sensor API
|
129
|
+
*
|
130
|
+
* If you are using the sensor API or handling events from multiple threads
|
131
|
+
* you should use these locking functions to protect access to the sensors.
|
132
|
+
*
|
133
|
+
* In particular, you are guaranteed that the sensor list won't change, so
|
134
|
+
* the API functions that take a sensor index will be valid, and sensor
|
135
|
+
* events will not be delivered.
|
136
|
+
*/
|
137
|
+
extern DECLSPEC void SDLCALL SDL_LockSensors(void);
|
138
|
+
extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
139
|
+
|
124
140
|
/**
|
125
141
|
* \brief Count the number of sensors attached to the system right now
|
126
142
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 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
|
@@ -30,6 +30,12 @@
|
|
30
30
|
|
31
31
|
#include "SDL_config.h"
|
32
32
|
|
33
|
+
#ifdef __APPLE__
|
34
|
+
#ifndef _DARWIN_C_SOURCE
|
35
|
+
#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
|
36
|
+
#endif
|
37
|
+
#endif
|
38
|
+
|
33
39
|
#ifdef HAVE_SYS_TYPES_H
|
34
40
|
#include <sys/types.h>
|
35
41
|
#endif
|
@@ -408,18 +414,25 @@ extern DECLSPEC int SDLCALL SDL_abs(int x);
|
|
408
414
|
|
409
415
|
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
|
410
416
|
extern DECLSPEC int SDLCALL SDL_isspace(int x);
|
417
|
+
extern DECLSPEC int SDLCALL SDL_isupper(int x);
|
418
|
+
extern DECLSPEC int SDLCALL SDL_islower(int x);
|
411
419
|
extern DECLSPEC int SDLCALL SDL_toupper(int x);
|
412
420
|
extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
413
421
|
|
422
|
+
extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
|
423
|
+
|
414
424
|
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
|
415
425
|
|
416
426
|
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
417
427
|
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
428
|
+
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
418
429
|
|
419
430
|
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
420
431
|
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
421
432
|
{
|
422
|
-
#
|
433
|
+
#ifdef __APPLE__
|
434
|
+
memset_pattern4(dst, &val, dwords * 4);
|
435
|
+
#elif defined(__GNUC__) && defined(i386)
|
423
436
|
int u0, u1, u2;
|
424
437
|
__asm__ __volatile__ (
|
425
438
|
"cld \n\t"
|
@@ -450,11 +463,16 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_
|
|
450
463
|
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
451
464
|
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
452
465
|
|
453
|
-
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
454
466
|
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
|
455
467
|
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
456
468
|
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
469
|
+
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
470
|
+
extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
471
|
+
|
457
472
|
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
473
|
+
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
474
|
+
extern DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
|
475
|
+
extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len);
|
458
476
|
|
459
477
|
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
460
478
|
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
@@ -467,6 +485,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
|
|
467
485
|
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
468
486
|
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
469
487
|
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
488
|
+
extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
|
470
489
|
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
|
471
490
|
|
472
491
|
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
|
@@ -520,6 +539,8 @@ extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
|
520
539
|
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
|
521
540
|
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
522
541
|
extern DECLSPEC float SDLCALL SDL_floorf(float x);
|
542
|
+
extern DECLSPEC double SDLCALL SDL_trunc(double x);
|
543
|
+
extern DECLSPEC float SDLCALL SDL_truncf(float x);
|
523
544
|
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
|
524
545
|
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
|
525
546
|
extern DECLSPEC double SDLCALL SDL_log(double x);
|
@@ -566,6 +587,17 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|
566
587
|
/* force builds using Clang's static analysis tools to use literal C runtime
|
567
588
|
here, since there are possibly tests that are ineffective otherwise. */
|
568
589
|
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
|
590
|
+
|
591
|
+
/* The analyzer knows about strlcpy even when the system doesn't provide it */
|
592
|
+
#ifndef HAVE_STRLCPY
|
593
|
+
size_t strlcpy(char* dst, const char* src, size_t size);
|
594
|
+
#endif
|
595
|
+
|
596
|
+
/* The analyzer knows about strlcat even when the system doesn't provide it */
|
597
|
+
#ifndef HAVE_STRLCAT
|
598
|
+
size_t strlcat(char* dst, const char* src, size_t size);
|
599
|
+
#endif
|
600
|
+
|
569
601
|
#define SDL_malloc malloc
|
570
602
|
#define SDL_calloc calloc
|
571
603
|
#define SDL_realloc realloc
|
@@ -574,15 +606,23 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|
574
606
|
#define SDL_memcpy memcpy
|
575
607
|
#define SDL_memmove memmove
|
576
608
|
#define SDL_memcmp memcmp
|
577
|
-
#define SDL_strlen strlen
|
578
609
|
#define SDL_strlcpy strlcpy
|
579
610
|
#define SDL_strlcat strlcat
|
611
|
+
#define SDL_strlen strlen
|
612
|
+
#define SDL_wcslen wcslen
|
613
|
+
#define SDL_wcslcpy wcslcpy
|
614
|
+
#define SDL_wcslcat wcslcat
|
580
615
|
#define SDL_strdup strdup
|
616
|
+
#define SDL_wcsdup wcsdup
|
581
617
|
#define SDL_strchr strchr
|
582
618
|
#define SDL_strrchr strrchr
|
583
619
|
#define SDL_strstr strstr
|
620
|
+
#define SDL_wcsstr wcsstr
|
621
|
+
#define SDL_strtokr strtok_r
|
584
622
|
#define SDL_strcmp strcmp
|
623
|
+
#define SDL_wcscmp wcscmp
|
585
624
|
#define SDL_strncmp strncmp
|
625
|
+
#define SDL_wcsncmp wcsncmp
|
586
626
|
#define SDL_strcasecmp strcasecmp
|
587
627
|
#define SDL_strncasecmp strncasecmp
|
588
628
|
#define SDL_sscanf sscanf
|