ruby2d 0.9.2 → 0.10.0

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.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/assets/README.md +7 -8
  3. data/assets/Rakefile +85 -0
  4. data/assets/include/SDL2/SDL.h +4 -1
  5. data/assets/include/SDL2/SDL_assert.h +3 -1
  6. data/assets/include/SDL2/SDL_atomic.h +20 -2
  7. data/assets/include/SDL2/SDL_audio.h +47 -14
  8. data/assets/include/SDL2/SDL_bits.h +10 -1
  9. data/assets/include/SDL2/SDL_blendmode.h +10 -7
  10. data/assets/include/SDL2/SDL_clipboard.h +1 -1
  11. data/assets/include/SDL2/SDL_config.h +24 -390
  12. data/assets/include/SDL2/SDL_config_android.h +182 -0
  13. data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
  14. data/assets/include/SDL2/SDL_config_macosx.h +266 -0
  15. data/assets/include/SDL2/SDL_config_minimal.h +85 -0
  16. data/assets/include/SDL2/SDL_config_os2.h +188 -0
  17. data/assets/include/SDL2/SDL_config_pandora.h +135 -0
  18. data/assets/include/SDL2/SDL_config_psp.h +165 -0
  19. data/assets/include/SDL2/SDL_config_windows.h +288 -0
  20. data/assets/include/SDL2/SDL_config_winrt.h +243 -0
  21. data/assets/include/SDL2/SDL_config_wiz.h +149 -0
  22. data/assets/include/SDL2/SDL_copying.h +20 -0
  23. data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
  24. data/assets/include/SDL2/SDL_egl.h +4 -1
  25. data/assets/include/SDL2/SDL_endian.h +6 -3
  26. data/assets/include/SDL2/SDL_error.h +38 -2
  27. data/assets/include/SDL2/SDL_events.h +67 -28
  28. data/assets/include/SDL2/SDL_filesystem.h +1 -1
  29. data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
  30. data/assets/include/SDL2/SDL_gesture.h +1 -1
  31. data/assets/include/SDL2/SDL_haptic.h +10 -1
  32. data/assets/include/SDL2/SDL_hints.h +460 -17
  33. data/assets/include/SDL2/SDL_image.h +2 -2
  34. data/assets/include/SDL2/SDL_joystick.h +115 -24
  35. data/assets/include/SDL2/SDL_keyboard.h +1 -1
  36. data/assets/include/SDL2/SDL_keycode.h +11 -9
  37. data/assets/include/SDL2/SDL_loadso.h +1 -1
  38. data/assets/include/SDL2/SDL_locale.h +101 -0
  39. data/assets/include/SDL2/SDL_log.h +3 -3
  40. data/assets/include/SDL2/SDL_main.h +28 -16
  41. data/assets/include/SDL2/SDL_messagebox.h +6 -4
  42. data/assets/include/SDL2/SDL_metal.h +117 -0
  43. data/assets/include/SDL2/SDL_misc.h +75 -0
  44. data/assets/include/SDL2/SDL_mouse.h +1 -1
  45. data/assets/include/SDL2/SDL_mutex.h +1 -1
  46. data/assets/include/SDL2/SDL_name.h +1 -1
  47. data/assets/include/SDL2/SDL_opengl.h +1 -1
  48. data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
  49. data/assets/include/SDL2/SDL_opengles.h +1 -1
  50. data/assets/include/SDL2/SDL_opengles2.h +1 -1
  51. data/assets/include/SDL2/SDL_pixels.h +27 -18
  52. data/assets/include/SDL2/SDL_platform.h +1 -1
  53. data/assets/include/SDL2/SDL_power.h +1 -1
  54. data/assets/include/SDL2/SDL_quit.h +1 -1
  55. data/assets/include/SDL2/SDL_rect.h +29 -3
  56. data/assets/include/SDL2/SDL_render.h +230 -3
  57. data/assets/include/SDL2/SDL_revision.h +2 -2
  58. data/assets/include/SDL2/SDL_rwops.h +51 -22
  59. data/assets/include/SDL2/SDL_scancode.h +2 -2
  60. data/assets/include/SDL2/SDL_sensor.h +28 -12
  61. data/assets/include/SDL2/SDL_shape.h +1 -1
  62. data/assets/include/SDL2/SDL_stdinc.h +44 -4
  63. data/assets/include/SDL2/SDL_surface.h +12 -2
  64. data/assets/include/SDL2/SDL_system.h +50 -4
  65. data/assets/include/SDL2/SDL_syswm.h +39 -9
  66. data/assets/include/SDL2/SDL_test.h +1 -1
  67. data/assets/include/SDL2/SDL_test_assert.h +1 -1
  68. data/assets/include/SDL2/SDL_test_common.h +32 -2
  69. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  70. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  71. data/assets/include/SDL2/SDL_test_font.h +1 -1
  72. data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
  73. data/assets/include/SDL2/SDL_test_harness.h +1 -1
  74. data/assets/include/SDL2/SDL_test_images.h +1 -1
  75. data/assets/include/SDL2/SDL_test_log.h +1 -1
  76. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  77. data/assets/include/SDL2/SDL_test_memory.h +3 -3
  78. data/assets/include/SDL2/SDL_test_random.h +1 -1
  79. data/assets/include/SDL2/SDL_thread.h +34 -11
  80. data/assets/include/SDL2/SDL_timer.h +1 -1
  81. data/assets/include/SDL2/SDL_touch.h +17 -1
  82. data/assets/include/SDL2/SDL_types.h +1 -1
  83. data/assets/include/SDL2/SDL_version.h +2 -2
  84. data/assets/include/SDL2/SDL_video.h +11 -5
  85. data/assets/include/SDL2/SDL_vulkan.h +9 -11
  86. data/assets/include/SDL2/begin_code.h +8 -9
  87. data/assets/include/SDL2/close_code.h +4 -1
  88. data/assets/macos/lib/libFLAC.a +0 -0
  89. data/assets/macos/lib/libSDL2.a +0 -0
  90. data/assets/macos/lib/libSDL2_image.a +0 -0
  91. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  92. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  93. data/assets/macos/lib/libfreetype.a +0 -0
  94. data/assets/macos/lib/libjpeg.a +0 -0
  95. data/assets/macos/lib/libmpg123.a +0 -0
  96. data/assets/macos/lib/libogg.a +0 -0
  97. data/assets/macos/lib/libpng16.a +0 -0
  98. data/assets/macos/lib/libtiff.a +0 -0
  99. data/assets/macos/lib/libvorbis.a +0 -0
  100. data/assets/macos/lib/libvorbisfile.a +0 -0
  101. data/assets/macos/lib/libwebp.a +0 -0
  102. data/assets/mingw/bin/SDL2.dll +0 -0
  103. data/assets/mingw/bin/SDL2_image.dll +0 -0
  104. data/assets/mingw/bin/libpng16-16.dll +0 -0
  105. data/assets/mingw/bin/libtiff-5.dll +0 -0
  106. data/assets/mingw/bin/libwebp-7.dll +0 -0
  107. data/assets/mingw/lib/libSDL2.a +0 -0
  108. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  109. data/assets/mingw/lib/libSDL2_image.a +0 -0
  110. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  111. data/assets/mingw/lib/libSDL2_test.a +0 -0
  112. data/assets/mingw/lib/libSDL2main.a +0 -0
  113. data/bin/ruby2d +2 -1
  114. data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
  115. data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
  116. data/ext/ruby2d/extconf.rb +6 -36
  117. data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +106 -85
  118. data/{assets/linux/simple2d/src → ext/ruby2d}/gl2.c +35 -20
  119. data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +146 -58
  120. data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +41 -26
  121. data/{assets/linux/simple2d/src → ext/ruby2d}/image.c +16 -16
  122. data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
  123. data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
  124. data/ext/ruby2d/ruby2d.c +427 -290
  125. data/ext/ruby2d/ruby2d.h +789 -0
  126. data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
  127. data/ext/ruby2d/sound.c +118 -0
  128. data/{assets/linux/simple2d/src → ext/ruby2d}/sprite.c +16 -16
  129. data/{assets/linux/simple2d/src → ext/ruby2d}/text.c +22 -22
  130. data/ext/ruby2d/tileset.c +30 -0
  131. data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +71 -60
  132. data/lib/ruby2d.rb +5 -2
  133. data/lib/ruby2d/circle.rb +18 -2
  134. data/lib/ruby2d/cli/build.rb +3 -8
  135. data/lib/ruby2d/cli/colorize.rb +10 -0
  136. data/lib/ruby2d/dsl.rb +16 -9
  137. data/lib/ruby2d/entity.rb +17 -0
  138. data/lib/ruby2d/font.rb +4 -3
  139. data/lib/ruby2d/image.rb +24 -1
  140. data/lib/ruby2d/line.rb +20 -0
  141. data/lib/ruby2d/music.rb +5 -0
  142. data/lib/ruby2d/pixel.rb +17 -0
  143. data/lib/ruby2d/quad.rb +18 -0
  144. data/lib/ruby2d/rectangle.rb +11 -2
  145. data/lib/ruby2d/renderable.rb +4 -8
  146. data/lib/ruby2d/sound.rb +5 -0
  147. data/lib/ruby2d/sprite.rb +35 -3
  148. data/lib/ruby2d/square.rb +9 -0
  149. data/lib/ruby2d/text.rb +22 -1
  150. data/lib/ruby2d/tileset.rb +69 -0
  151. data/lib/ruby2d/triangle.rb +16 -0
  152. data/lib/ruby2d/version.rb +1 -1
  153. data/lib/ruby2d/window.rb +249 -22
  154. metadata +41 -27
  155. data/assets/include/simple2d.h +0 -735
  156. data/assets/linux/simple2d/Makefile +0 -250
  157. data/assets/linux/simple2d/bin/simple2d.sh +0 -1249
  158. data/assets/linux/simple2d/include/simple2d.h +0 -735
  159. data/assets/linux/simple2d/src/sound.c +0 -56
  160. data/assets/macos/lib/libsimple2d.a +0 -0
  161. data/assets/mingw/lib/libsimple2d.a +0 -0
  162. data/lib/ruby2d/colorize.rb +0 -10
@@ -0,0 +1,149 @@
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
+ #ifndef SDL_config_wiz_h_
23
+ #define SDL_config_wiz_h_
24
+ #define SDL_config_h_
25
+
26
+ /* This is a set of defines to configure the SDL features */
27
+
28
+ /* General platform specific identifiers */
29
+ #include "SDL_platform.h"
30
+
31
+ #define SDL_BYTEORDER 1234
32
+
33
+ #define STDC_HEADERS 1
34
+ #define HAVE_ALLOCA_H 1
35
+ #define HAVE_CTYPE_H 1
36
+ #define HAVE_ICONV_H 1
37
+ #define HAVE_INTTYPES_H 1
38
+ #define HAVE_LIMITS_H 1
39
+ #define HAVE_MALLOC_H 1
40
+ #define HAVE_MATH_H 1
41
+ #define HAVE_MEMORY_H 1
42
+ #define HAVE_SIGNAL_H 1
43
+ #define HAVE_STDARG_H 1
44
+ #define HAVE_STDINT_H 1
45
+ #define HAVE_STDIO_H 1
46
+ #define HAVE_STDLIB_H 1
47
+ #define HAVE_STRINGS_H 1
48
+ #define HAVE_STRING_H 1
49
+ #define HAVE_SYS_TYPES_H 1
50
+
51
+ #define HAVE_MALLOC 1
52
+ #define HAVE_CALLOC 1
53
+ #define HAVE_REALLOC 1
54
+ #define HAVE_FREE 1
55
+ #define HAVE_ALLOCA 1
56
+ #define HAVE_GETENV 1
57
+ #define HAVE_SETENV 1
58
+ #define HAVE_PUTENV 1
59
+ #define HAVE_UNSETENV 1
60
+ #define HAVE_QSORT 1
61
+ #define HAVE_ABS 1
62
+ #define HAVE_BCOPY 1
63
+ #define HAVE_MEMSET 1
64
+ #define HAVE_MEMCPY 1
65
+ #define HAVE_MEMMOVE 1
66
+ #define HAVE_STRLEN 1
67
+ #define HAVE_STRCHR 1
68
+ #define HAVE_STRRCHR 1
69
+ #define HAVE_STRSTR 1
70
+ #define HAVE_STRTOK_R 1
71
+ #define HAVE_STRTOL 1
72
+ #define HAVE_STRTOUL 1
73
+ #define HAVE_STRTOLL 1
74
+ #define HAVE_STRTOULL 1
75
+ #define HAVE_ATOI 1
76
+ #define HAVE_ATOF 1
77
+ #define HAVE_STRCMP 1
78
+ #define HAVE_STRNCMP 1
79
+ #define HAVE_STRCASECMP 1
80
+ #define HAVE_STRNCASECMP 1
81
+ #define HAVE_VSSCANF 1
82
+ #define HAVE_VSNPRINTF 1
83
+ #define HAVE_M_PI 1
84
+ #define HAVE_ACOS 1
85
+ #define HAVE_ACOSF 1
86
+ #define HAVE_ASIN 1
87
+ #define HAVE_ASINF 1
88
+ #define HAVE_ATAN 1
89
+ #define HAVE_ATANF 1
90
+ #define HAVE_ATAN2 1
91
+ #define HAVE_ATAN2F 1
92
+ #define HAVE_CEIL 1
93
+ #define HAVE_CEILF 1
94
+ #define HAVE_COPYSIGN 1
95
+ #define HAVE_COPYSIGNF 1
96
+ #define HAVE_COS 1
97
+ #define HAVE_COSF 1
98
+ #define HAVE_EXP 1
99
+ #define HAVE_EXPF 1
100
+ #define HAVE_FABS 1
101
+ #define HAVE_FABSF 1
102
+ #define HAVE_FLOOR 1
103
+ #define HAVE_FLOORF 1
104
+ #define HAVE_FMOD 1
105
+ #define HAVE_FMODF 1
106
+ #define HAVE_LOG 1
107
+ #define HAVE_LOGF 1
108
+ #define HAVE_LOG10 1
109
+ #define HAVE_LOG10F 1
110
+ #define HAVE_POW 1
111
+ #define HAVE_POWF 1
112
+ #define HAVE_SCALBN 1
113
+ #define HAVE_SCALBNF 1
114
+ #define HAVE_SIN 1
115
+ #define HAVE_SINF 1
116
+ #define HAVE_SQRT 1
117
+ #define HAVE_SQRTF 1
118
+ #define HAVE_TAN 1
119
+ #define HAVE_TANF 1
120
+ #define HAVE_TRUNC 1
121
+ #define HAVE_TRUNCF 1
122
+ #define HAVE_SIGACTION 1
123
+ #define HAVE_SETJMP 1
124
+ #define HAVE_NANOSLEEP 1
125
+ #define HAVE_POW 1
126
+
127
+ #define SDL_AUDIO_DRIVER_DUMMY 1
128
+ #define SDL_AUDIO_DRIVER_OSS 1
129
+
130
+ #define SDL_INPUT_LINUXEV 1
131
+ #define SDL_JOYSTICK_LINUX 1
132
+ #define SDL_JOYSTICK_VIRTUAL 1
133
+ #define SDL_HAPTIC_LINUX 1
134
+
135
+ #define SDL_SENSOR_DUMMY 1
136
+
137
+ #define SDL_LOADSO_DLOPEN 1
138
+
139
+ #define SDL_THREAD_PTHREAD 1
140
+ #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
141
+
142
+ #define SDL_TIMER_UNIX 1
143
+
144
+ #define SDL_VIDEO_DRIVER_DUMMY 1
145
+ #define SDL_VIDEO_DRIVER_PANDORA 1
146
+ #define SDL_VIDEO_RENDER_OGL_ES 1
147
+ #define SDL_VIDEO_OPENGL_ES 1
148
+
149
+ #endif /* SDL_config_wiz_h_ */
@@ -0,0 +1,20 @@
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
+ */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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
@@ -41,24 +41,43 @@
41
41
  #else
42
42
  #include <intrin.h>
43
43
  #ifndef _WIN64
44
+ #ifndef __MMX__
44
45
  #define __MMX__
46
+ #endif
47
+ #ifndef __3dNOW__
45
48
  #define __3dNOW__
46
49
  #endif
50
+ #endif
51
+ #ifndef __SSE__
47
52
  #define __SSE__
53
+ #endif
54
+ #ifndef __SSE2__
48
55
  #define __SSE2__
56
+ #endif
49
57
  #endif /* __clang__ */
50
58
  #elif defined(__MINGW64_VERSION_MAJOR)
51
59
  #include <intrin.h>
52
60
  #else
53
- #ifdef __ALTIVEC__
54
- #if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
61
+ /* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
62
+ #if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
55
63
  #include <altivec.h>
56
- #undef pixel
57
- #undef bool
58
- #endif
59
64
  #endif
60
- #if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H)
61
- #include <arm_neon.h>
65
+ #if !defined(SDL_DISABLE_ARM_NEON_H)
66
+ # if defined(__ARM_NEON)
67
+ # include <arm_neon.h>
68
+ # elif defined(__WINDOWS__) || defined(__WINRT__)
69
+ /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
70
+ # if defined(_M_ARM)
71
+ # include <armintr.h>
72
+ # include <arm_neon.h>
73
+ # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
74
+ # endif
75
+ # if defined (_M_ARM64)
76
+ # include <arm64intr.h>
77
+ # include <arm64_neon.h>
78
+ # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
79
+ # endif
80
+ # endif
62
81
  #endif
63
82
  #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
64
83
  #include <mm3dnow.h>
@@ -167,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
167
186
  */
168
187
  extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
169
188
 
189
+ /**
190
+ * This function returns true if the CPU has ARM SIMD (ARMv6) features.
191
+ */
192
+ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
193
+
170
194
  /**
171
195
  * This function returns true if the CPU has NEON (ARM SIMD) features.
172
196
  */
@@ -177,6 +201,93 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
177
201
  */
178
202
  extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
179
203
 
204
+ /**
205
+ * \brief Report the alignment this system needs for SIMD allocations.
206
+ *
207
+ * This will return the minimum number of bytes to which a pointer must be
208
+ * aligned to be compatible with SIMD instructions on the current machine.
209
+ * For example, if the machine supports SSE only, it will return 16, but if
210
+ * it supports AVX-512F, it'll return 64 (etc). This only reports values for
211
+ * instruction sets SDL knows about, so if your SDL build doesn't have
212
+ * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
213
+ * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
214
+ * Plan accordingly.
215
+ */
216
+ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
217
+
218
+ /**
219
+ * \brief Allocate memory in a SIMD-friendly way.
220
+ *
221
+ * This will allocate a block of memory that is suitable for use with SIMD
222
+ * instructions. Specifically, it will be properly aligned and padded for
223
+ * the system's supported vector instructions.
224
+ *
225
+ * The memory returned will be padded such that it is safe to read or write
226
+ * an incomplete vector at the end of the memory block. This can be useful
227
+ * so you don't have to drop back to a scalar fallback at the end of your
228
+ * SIMD processing loop to deal with the final elements without overflowing
229
+ * the allocated buffer.
230
+ *
231
+ * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free()
232
+ * or delete[], etc.
233
+ *
234
+ * Note that SDL will only deal with SIMD instruction sets it is aware of;
235
+ * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors
236
+ * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't
237
+ * know that AVX-512 wants 64. To be clear: if you can't decide to use an
238
+ * instruction set with an SDL_Has*() function, don't use that instruction
239
+ * set with memory allocated through here.
240
+ *
241
+ * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
242
+ * out of memory.
243
+ *
244
+ * \param len The length, in bytes, of the block to allocated. The actual
245
+ * allocated block might be larger due to padding, etc.
246
+ * \return Pointer to newly-allocated block, NULL if out of memory.
247
+ *
248
+ * \sa SDL_SIMDAlignment
249
+ * \sa SDL_SIMDRealloc
250
+ * \sa SDL_SIMDFree
251
+ */
252
+ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
253
+
254
+ /**
255
+ * \brief Reallocate memory obtained from SDL_SIMDAlloc
256
+ *
257
+ * It is not valid to use this function on a pointer from anything but
258
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
259
+ * SDL_malloc, memalign, new[], etc.
260
+ *
261
+ * \param mem The pointer obtained from SDL_SIMDAlloc. This function also
262
+ * accepts NULL, at which point this function is the same as
263
+ * calling SDL_realloc with a NULL pointer.
264
+ * \param len The length, in bytes, of the block to allocated. The actual
265
+ * allocated block might be larger due to padding, etc. Passing 0
266
+ * will return a non-NULL pointer, assuming the system isn't out of
267
+ * memory.
268
+ * \return Pointer to newly-reallocated block, NULL if out of memory.
269
+ *
270
+ * \sa SDL_SIMDAlignment
271
+ * \sa SDL_SIMDAlloc
272
+ * \sa SDL_SIMDFree
273
+ */
274
+ extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
275
+
276
+ /**
277
+ * \brief Deallocate memory obtained from SDL_SIMDAlloc
278
+ *
279
+ * It is not valid to use this function on a pointer from anything but
280
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
281
+ * SDL_malloc, memalign, new[], etc.
282
+ *
283
+ * However, SDL_SIMDFree(NULL) is a legal no-op.
284
+ *
285
+ * \sa SDL_SIMDAlloc
286
+ * \sa SDL_SIMDRealloc
287
+ */
288
+ extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
289
+
290
+ /* vi: set ts=4 sw=4 expandtab: */
180
291
  /* Ends C function definitions when using C++ */
181
292
  #ifdef __cplusplus
182
293
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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
@@ -390,6 +390,9 @@ typedef enum {
390
390
  #ifndef WIN32_LEAN_AND_MEAN
391
391
  #define WIN32_LEAN_AND_MEAN 1
392
392
  #endif
393
+ #ifndef NOMINMAX /* don't define min() and max(). */
394
+ #define NOMINMAX
395
+ #endif
393
396
  #include <windows.h>
394
397
 
395
398
  #if __WINRT__
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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
@@ -42,10 +42,13 @@
42
42
  #ifdef __linux__
43
43
  #include <endian.h>
44
44
  #define SDL_BYTEORDER __BYTE_ORDER
45
- #else /* __linux__ */
45
+ #elif defined(__OpenBSD__)
46
+ #include <endian.h>
47
+ #define SDL_BYTEORDER BYTE_ORDER
48
+ #else
46
49
  #if defined(__hppa__) || \
47
50
  defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
48
- (defined(__MIPS__) && defined(__MISPEB__)) || \
51
+ (defined(__MIPS__) && defined(__MIPSEB__)) || \
49
52
  defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
50
53
  defined(__sparc__)
51
54
  #define SDL_BYTEORDER SDL_BIG_ENDIAN
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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
@@ -37,9 +37,45 @@ extern "C" {
37
37
  #endif
38
38
 
39
39
  /* Public functions */
40
- /* SDL_SetError() unconditionally returns -1. */
40
+
41
+
42
+ /**
43
+ * \brief Set the error message for the current thread
44
+ *
45
+ * \return -1, there is no error handling for this function
46
+ */
41
47
  extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
48
+
49
+ /**
50
+ * \brief Get the last error message that was set
51
+ *
52
+ * SDL API functions may set error messages and then succeed, so you should
53
+ * only use the error value if a function fails.
54
+ *
55
+ * This returns a pointer to a static buffer for convenience and should not
56
+ * be called by multiple threads simultaneously.
57
+ *
58
+ * \return a pointer to the last error message that was set
59
+ */
42
60
  extern DECLSPEC const char *SDLCALL SDL_GetError(void);
61
+
62
+ /**
63
+ * \brief Get the last error message that was set for the current thread
64
+ *
65
+ * SDL API functions may set error messages and then succeed, so you should
66
+ * only use the error value if a function fails.
67
+ *
68
+ * \param errstr A buffer to fill with the last error message that was set
69
+ * for the current thread
70
+ * \param maxlen The size of the buffer pointed to by the errstr parameter
71
+ *
72
+ * \return errstr
73
+ */
74
+ extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
75
+
76
+ /**
77
+ * \brief Clear the error message for the current thread
78
+ */
43
79
  extern DECLSPEC void SDLCALL SDL_ClearError(void);
44
80
 
45
81
  /**
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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,8 @@ typedef enum
85
85
  Called on Android in onResume()
86
86
  */
87
87
 
88
+ SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */
89
+
88
90
  /* Display events */
89
91
  SDL_DISPLAYEVENT = 0x150, /**< Display state change */
90
92
 
@@ -123,6 +125,10 @@ typedef enum
123
125
  SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
124
126
  SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
125
127
  SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
128
+ SDL_CONTROLLERTOUCHPADDOWN, /**< Game controller touchpad was touched */
129
+ SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */
130
+ SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */
131
+ SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */
126
132
 
127
133
  /* Touch events */
128
134
  SDL_FINGERDOWN = 0x700,
@@ -413,6 +419,33 @@ typedef struct SDL_ControllerDeviceEvent
413
419
  Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
414
420
  } SDL_ControllerDeviceEvent;
415
421
 
422
+ /**
423
+ * \brief Game controller touchpad event structure (event.ctouchpad.*)
424
+ */
425
+ typedef struct SDL_ControllerTouchpadEvent
426
+ {
427
+ Uint32 type; /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */
428
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
429
+ SDL_JoystickID which; /**< The joystick instance id */
430
+ Sint32 touchpad; /**< The index of the touchpad */
431
+ Sint32 finger; /**< The index of the finger on the touchpad */
432
+ float x; /**< Normalized in the range 0...1 with 0 being on the left */
433
+ float y; /**< Normalized in the range 0...1 with 0 being at the top */
434
+ float pressure; /**< Normalized in the range 0...1 */
435
+ } SDL_ControllerTouchpadEvent;
436
+
437
+ /**
438
+ * \brief Game controller sensor event structure (event.csensor.*)
439
+ */
440
+ typedef struct SDL_ControllerSensorEvent
441
+ {
442
+ Uint32 type; /**< ::SDL_CONTROLLERSENSORUPDATE */
443
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
444
+ SDL_JoystickID which; /**< The joystick instance id */
445
+ Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
446
+ float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
447
+ } SDL_ControllerSensorEvent;
448
+
416
449
  /**
417
450
  * \brief Audio device event structure (event.adevice.*)
418
451
  */
@@ -442,6 +475,7 @@ typedef struct SDL_TouchFingerEvent
442
475
  float dx; /**< Normalized in the range -1...1 */
443
476
  float dy; /**< Normalized in the range -1...1 */
444
477
  float pressure; /**< Normalized in the range 0...1 */
478
+ Uint32 windowID; /**< The window underneath the finger, if any */
445
479
  } SDL_TouchFingerEvent;
446
480
 
447
481
 
@@ -556,33 +590,35 @@ typedef struct SDL_SysWMEvent
556
590
  */
557
591
  typedef union SDL_Event
558
592
  {
559
- Uint32 type; /**< Event type, shared with all events */
560
- SDL_CommonEvent common; /**< Common event data */
561
- SDL_DisplayEvent display; /**< Window event data */
562
- SDL_WindowEvent window; /**< Window event data */
563
- SDL_KeyboardEvent key; /**< Keyboard event data */
564
- SDL_TextEditingEvent edit; /**< Text editing event data */
565
- SDL_TextInputEvent text; /**< Text input event data */
566
- SDL_MouseMotionEvent motion; /**< Mouse motion event data */
567
- SDL_MouseButtonEvent button; /**< Mouse button event data */
568
- SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
569
- SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
570
- SDL_JoyBallEvent jball; /**< Joystick ball event data */
571
- SDL_JoyHatEvent jhat; /**< Joystick hat event data */
572
- SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
573
- SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
574
- SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
575
- SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
576
- SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
577
- SDL_AudioDeviceEvent adevice; /**< Audio device event data */
578
- SDL_SensorEvent sensor; /**< Sensor event data */
579
- SDL_QuitEvent quit; /**< Quit request event data */
580
- SDL_UserEvent user; /**< Custom event data */
581
- SDL_SysWMEvent syswm; /**< System dependent window event data */
582
- SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
583
- SDL_MultiGestureEvent mgesture; /**< Gesture event data */
584
- SDL_DollarGestureEvent dgesture; /**< Gesture event data */
585
- SDL_DropEvent drop; /**< Drag and drop event data */
593
+ Uint32 type; /**< Event type, shared with all events */
594
+ SDL_CommonEvent common; /**< Common event data */
595
+ SDL_DisplayEvent display; /**< Display event data */
596
+ SDL_WindowEvent window; /**< Window event data */
597
+ SDL_KeyboardEvent key; /**< Keyboard event data */
598
+ SDL_TextEditingEvent edit; /**< Text editing event data */
599
+ SDL_TextInputEvent text; /**< Text input event data */
600
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
601
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
602
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
603
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
604
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
605
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
606
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
607
+ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
608
+ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
609
+ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
610
+ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
611
+ SDL_ControllerTouchpadEvent ctouchpad; /**< Game Controller touchpad event data */
612
+ SDL_ControllerSensorEvent csensor; /**< Game Controller sensor event data */
613
+ SDL_AudioDeviceEvent adevice; /**< Audio device event data */
614
+ SDL_SensorEvent sensor; /**< Sensor event data */
615
+ SDL_QuitEvent quit; /**< Quit request event data */
616
+ SDL_UserEvent user; /**< Custom event data */
617
+ SDL_SysWMEvent syswm; /**< System dependent window event data */
618
+ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
619
+ SDL_MultiGestureEvent mgesture; /**< Gesture event data */
620
+ SDL_DollarGestureEvent dgesture; /**< Gesture event data */
621
+ SDL_DropEvent drop; /**< Drag and drop event data */
586
622
 
587
623
  /* This is necessary for ABI compatibility between Visual C++ and GCC
588
624
  Visual C++ will respect the push pack pragma and use 52 bytes for
@@ -594,6 +630,9 @@ typedef union SDL_Event
594
630
  Uint8 padding[56];
595
631
  } SDL_Event;
596
632
 
633
+ /* Make sure we haven't broken binary compatibility */
634
+ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56);
635
+
597
636
 
598
637
  /* Function prototypes */
599
638