ruby2d 0.9.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/README.md +7 -9
- data/assets/Rakefile +85 -0
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +20 -2
- data/assets/include/SDL2/SDL_audio.h +47 -14
- data/assets/include/SDL2/SDL_bits.h +10 -1
- data/assets/include/SDL2/SDL_blendmode.h +10 -7
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +24 -390
- data/assets/include/SDL2/SDL_config_android.h +182 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
- data/assets/include/SDL2/SDL_config_macosx.h +266 -0
- data/assets/include/SDL2/SDL_config_minimal.h +85 -0
- data/assets/include/SDL2/SDL_config_os2.h +188 -0
- data/assets/include/SDL2/SDL_config_pandora.h +135 -0
- data/assets/include/SDL2/SDL_config_psp.h +165 -0
- data/assets/include/SDL2/SDL_config_windows.h +288 -0
- data/assets/include/SDL2/SDL_config_winrt.h +243 -0
- data/assets/include/SDL2/SDL_config_wiz.h +149 -0
- data/assets/include/SDL2/SDL_copying.h +20 -0
- data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
- 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 +67 -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 +460 -17
- data/assets/include/SDL2/SDL_image.h +2 -2
- 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 +28 -16
- 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 +27 -18
- 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 +29 -3
- data/assets/include/SDL2/SDL_render.h +230 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +51 -22
- data/assets/include/SDL2/SDL_scancode.h +2 -2
- data/assets/include/SDL2/SDL_sensor.h +28 -12
- 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 +12 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +39 -9
- 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 +32 -2
- 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 +3 -3
- 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 +17 -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 +9 -11
- data/assets/include/SDL2/begin_code.h +8 -9
- data/assets/include/SDL2/close_code.h +4 -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/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/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libwebp-7.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_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.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 +36 -58
- data/ext/ruby2d/font.c +35 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +72 -100
- data/ext/ruby2d/gl2.c +86 -0
- data/ext/ruby2d/gl3.c +305 -0
- 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/ext/ruby2d/sound.c +118 -0
- data/ext/ruby2d/text.c +22 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +73 -62
- 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 +41 -26
- data/assets/include/simple2d.h +0 -735
- data/assets/linux/simple2d/Makefile +0 -257
- data/assets/linux/simple2d/bin/simple2d.sh +0 -1312
- data/assets/linux/simple2d/include/simple2d.h +0 -735
- data/assets/linux/simple2d/src/gl2.c +0 -146
- data/assets/linux/simple2d/src/gl3.c +0 -275
- data/assets/linux/simple2d/src/image.c +0 -138
- data/assets/linux/simple2d/src/sound.c +0 -56
- 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
@@ -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
|
@@ -38,7 +38,7 @@
|
|
38
38
|
* SDL_Event structure.
|
39
39
|
*
|
40
40
|
* The values in this enumeration are based on the USB usage page standard:
|
41
|
-
*
|
41
|
+
* https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
|
42
42
|
*/
|
43
43
|
typedef enum
|
44
44
|
{
|
@@ -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
|
@@ -26,8 +26,8 @@
|
|
26
26
|
*
|
27
27
|
*/
|
28
28
|
|
29
|
-
#ifndef
|
30
|
-
#define
|
29
|
+
#ifndef SDL_sensor_h_
|
30
|
+
#define SDL_sensor_h_
|
31
31
|
|
32
32
|
#include "SDL_stdinc.h"
|
33
33
|
#include "SDL_error.h"
|
@@ -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
|
*/
|
@@ -246,6 +262,6 @@ extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
|
|
246
262
|
#endif
|
247
263
|
#include "close_code.h"
|
248
264
|
|
249
|
-
#endif /*
|
265
|
+
#endif /* SDL_sensor_h_ */
|
250
266
|
|
251
267
|
/* 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
|
@@ -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
|
@@ -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
|
@@ -53,6 +53,7 @@ extern "C" {
|
|
53
53
|
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
|
54
54
|
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
|
55
55
|
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
|
56
|
+
#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */
|
56
57
|
/* @} *//* Surface flags */
|
57
58
|
|
58
59
|
/**
|
@@ -79,7 +80,9 @@ typedef struct SDL_Surface
|
|
79
80
|
|
80
81
|
/** information needed for surfaces requiring locks */
|
81
82
|
int locked; /**< Read-only */
|
82
|
-
|
83
|
+
|
84
|
+
/** list of BlitMap that hold a reference to this surface */
|
85
|
+
void *list_blitmap; /**< Private */
|
83
86
|
|
84
87
|
/** clipping information */
|
85
88
|
SDL_Rect clip_rect; /**< Read-only */
|
@@ -234,6 +237,13 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
|
234
237
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
|
235
238
|
int flag);
|
236
239
|
|
240
|
+
/**
|
241
|
+
* \brief Returns whether the surface is RLE enabled
|
242
|
+
*
|
243
|
+
* \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled
|
244
|
+
*/
|
245
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
|
246
|
+
|
237
247
|
/**
|
238
248
|
* \brief Sets the color key (transparent pixel) in a blittable surface.
|
239
249
|
*
|
@@ -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
|
@@ -89,7 +89,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
|
|
89
89
|
#endif /* __LINUX__ */
|
90
90
|
|
91
91
|
/* Platform specific functions for iOS */
|
92
|
-
#
|
92
|
+
#ifdef __IPHONEOS__
|
93
93
|
|
94
94
|
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
|
95
95
|
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
@@ -101,7 +101,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
|
|
101
101
|
|
102
102
|
|
103
103
|
/* Platform specific functions for Android */
|
104
|
-
#
|
104
|
+
#ifdef __ANDROID__
|
105
105
|
|
106
106
|
/**
|
107
107
|
\brief Get the JNI environment for the current thread
|
@@ -120,6 +120,33 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
|
|
120
120
|
*/
|
121
121
|
extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
|
122
122
|
|
123
|
+
/**
|
124
|
+
\brief Return API level of the current device
|
125
|
+
|
126
|
+
API level 30: Android 11
|
127
|
+
API level 29: Android 10
|
128
|
+
API level 28: Android 9
|
129
|
+
API level 27: Android 8.1
|
130
|
+
API level 26: Android 8.0
|
131
|
+
API level 25: Android 7.1
|
132
|
+
API level 24: Android 7.0
|
133
|
+
API level 23: Android 6.0
|
134
|
+
API level 22: Android 5.1
|
135
|
+
API level 21: Android 5.0
|
136
|
+
API level 20: Android 4.4W
|
137
|
+
API level 19: Android 4.4
|
138
|
+
API level 18: Android 4.3
|
139
|
+
API level 17: Android 4.2
|
140
|
+
API level 16: Android 4.1
|
141
|
+
API level 15: Android 4.0.3
|
142
|
+
API level 14: Android 4.0
|
143
|
+
API level 13: Android 3.2
|
144
|
+
API level 12: Android 3.1
|
145
|
+
API level 11: Android 3.0
|
146
|
+
API level 10: Android 2.3.3
|
147
|
+
*/
|
148
|
+
extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
149
|
+
|
123
150
|
/**
|
124
151
|
\brief Return true if the application is running on Android TV
|
125
152
|
*/
|
@@ -172,10 +199,18 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
|
|
172
199
|
*/
|
173
200
|
extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
|
174
201
|
|
202
|
+
/**
|
203
|
+
\brief Request permissions at runtime.
|
204
|
+
|
205
|
+
This blocks the calling thread until the permission is granted or
|
206
|
+
denied. Returns SDL_TRUE if the permission was granted.
|
207
|
+
*/
|
208
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
209
|
+
|
175
210
|
#endif /* __ANDROID__ */
|
176
211
|
|
177
212
|
/* Platform specific functions for WinRT */
|
178
|
-
#
|
213
|
+
#ifdef __WINRT__
|
179
214
|
|
180
215
|
/**
|
181
216
|
* \brief WinRT / Windows Phone path types
|
@@ -268,6 +303,17 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
|
268
303
|
*/
|
269
304
|
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
|
270
305
|
|
306
|
+
/* Functions used by iOS application delegates to notify SDL about state changes */
|
307
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
|
308
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
|
309
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
|
310
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
|
311
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
|
312
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
|
313
|
+
#ifdef __IPHONEOS__
|
314
|
+
extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
|
315
|
+
#endif
|
316
|
+
|
271
317
|
/* Ends C function definitions when using C++ */
|
272
318
|
#ifdef __cplusplus
|
273
319
|
}
|
@@ -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
|
@@ -34,21 +34,24 @@
|
|
34
34
|
#include "SDL_version.h"
|
35
35
|
|
36
36
|
/**
|
37
|
-
* \
|
37
|
+
* \brief SDL_syswm.h
|
38
38
|
*
|
39
39
|
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
|
40
40
|
* which contains window-manager specific information and arrives whenever
|
41
41
|
* an unhandled window event occurs. This event is ignored by default, but
|
42
42
|
* you can enable it with SDL_EventState().
|
43
43
|
*/
|
44
|
-
#ifdef SDL_PROTOTYPES_ONLY
|
45
44
|
struct SDL_SysWMinfo;
|
46
|
-
|
45
|
+
|
46
|
+
#if !defined(SDL_PROTOTYPES_ONLY)
|
47
47
|
|
48
48
|
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
49
49
|
#ifndef WIN32_LEAN_AND_MEAN
|
50
50
|
#define WIN32_LEAN_AND_MEAN
|
51
51
|
#endif
|
52
|
+
#ifndef NOMINMAX /* don't define min() and max(). */
|
53
|
+
#define NOMINMAX
|
54
|
+
#endif
|
52
55
|
#include <windows.h>
|
53
56
|
#endif
|
54
57
|
|
@@ -104,12 +107,20 @@ typedef void *EGLSurface;
|
|
104
107
|
#include "SDL_egl.h"
|
105
108
|
#endif
|
106
109
|
|
110
|
+
#if defined(SDL_VIDEO_DRIVER_OS2)
|
111
|
+
#define INCL_WIN
|
112
|
+
#include <os2.h>
|
113
|
+
#endif
|
114
|
+
#endif /* SDL_PROTOTYPES_ONLY */
|
115
|
+
|
116
|
+
|
107
117
|
#include "begin_code.h"
|
108
118
|
/* Set up for C function definitions, even when using C++ */
|
109
119
|
#ifdef __cplusplus
|
110
120
|
extern "C" {
|
111
121
|
#endif
|
112
122
|
|
123
|
+
#if !defined(SDL_PROTOTYPES_ONLY)
|
113
124
|
/**
|
114
125
|
* These are the various supported windowing subsystems
|
115
126
|
*/
|
@@ -122,11 +133,12 @@ typedef enum
|
|
122
133
|
SDL_SYSWM_COCOA,
|
123
134
|
SDL_SYSWM_UIKIT,
|
124
135
|
SDL_SYSWM_WAYLAND,
|
125
|
-
SDL_SYSWM_MIR,
|
136
|
+
SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
|
126
137
|
SDL_SYSWM_WINRT,
|
127
138
|
SDL_SYSWM_ANDROID,
|
128
139
|
SDL_SYSWM_VIVANTE,
|
129
|
-
SDL_SYSWM_OS2
|
140
|
+
SDL_SYSWM_OS2,
|
141
|
+
SDL_SYSWM_HAIKU
|
130
142
|
} SDL_SYSWM_TYPE;
|
131
143
|
|
132
144
|
/**
|
@@ -179,6 +191,16 @@ struct SDL_SysWMmsg
|
|
179
191
|
int dummy;
|
180
192
|
/* No Vivante window events yet */
|
181
193
|
} vivante;
|
194
|
+
#endif
|
195
|
+
#if defined(SDL_VIDEO_DRIVER_OS2)
|
196
|
+
struct
|
197
|
+
{
|
198
|
+
BOOL fFrame; /**< TRUE if hwnd is a frame window */
|
199
|
+
HWND hwnd; /**< The window receiving the message */
|
200
|
+
ULONG msg; /**< The message identifier */
|
201
|
+
MPARAM mp1; /**< The first first message parameter */
|
202
|
+
MPARAM mp2; /**< The second first message parameter */
|
203
|
+
} os2;
|
182
204
|
#endif
|
183
205
|
/* Can't have an empty union */
|
184
206
|
int dummy;
|
@@ -257,11 +279,11 @@ struct SDL_SysWMinfo
|
|
257
279
|
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
|
258
280
|
} wl;
|
259
281
|
#endif
|
260
|
-
#if defined(SDL_VIDEO_DRIVER_MIR)
|
282
|
+
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
|
261
283
|
struct
|
262
284
|
{
|
263
|
-
|
264
|
-
|
285
|
+
void *connection; /**< Mir display server connection */
|
286
|
+
void *surface; /**< Mir surface */
|
265
287
|
} mir;
|
266
288
|
#endif
|
267
289
|
|
@@ -273,6 +295,14 @@ struct SDL_SysWMinfo
|
|
273
295
|
} android;
|
274
296
|
#endif
|
275
297
|
|
298
|
+
#if defined(SDL_VIDEO_DRIVER_OS2)
|
299
|
+
struct
|
300
|
+
{
|
301
|
+
HWND hwnd; /**< The window handle */
|
302
|
+
HWND hwndFrame; /**< The frame window handle */
|
303
|
+
} os2;
|
304
|
+
#endif
|
305
|
+
|
276
306
|
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
277
307
|
struct
|
278
308
|
{
|