ruby2d 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/GLES2/gl2.h +656 -0
  3. data/assets/include/GLES2/gl2ext.h +3949 -0
  4. data/assets/include/GLES2/gl2ext_angle.h +701 -0
  5. data/assets/include/GLES2/gl2platform.h +27 -0
  6. data/assets/include/GLES3/gl3.h +1192 -0
  7. data/assets/include/GLES3/gl31.h +1507 -0
  8. data/assets/include/GLES3/gl32.h +1808 -0
  9. data/assets/include/GLES3/gl3platform.h +27 -0
  10. data/assets/include/KHR/khrplatform.h +290 -0
  11. data/assets/include/SDL2/SDL.h +1 -0
  12. data/assets/include/SDL2/SDL_assert.h +4 -2
  13. data/assets/include/SDL2/SDL_atomic.h +20 -0
  14. data/assets/include/SDL2/SDL_audio.h +40 -4
  15. data/assets/include/SDL2/SDL_blendmode.h +4 -6
  16. data/assets/include/SDL2/SDL_clipboard.h +47 -0
  17. data/assets/include/SDL2/SDL_config.h +6 -2
  18. data/assets/include/SDL2/SDL_config_android.h +2 -0
  19. data/assets/include/SDL2/SDL_config_emscripten.h +2 -0
  20. data/assets/include/SDL2/SDL_config_iphoneos.h +3 -1
  21. data/assets/include/SDL2/SDL_config_macosx.h +3 -6
  22. data/assets/include/SDL2/SDL_config_minimal.h +18 -11
  23. data/assets/include/SDL2/SDL_config_ngage.h +89 -0
  24. data/assets/include/SDL2/SDL_config_os2.h +5 -3
  25. data/assets/include/SDL2/SDL_config_pandora.h +1 -0
  26. data/assets/include/SDL2/SDL_config_windows.h +71 -45
  27. data/assets/include/SDL2/SDL_config_wingdk.h +253 -0
  28. data/assets/include/SDL2/SDL_config_winrt.h +11 -49
  29. data/assets/include/SDL2/SDL_config_xbox.h +235 -0
  30. data/assets/include/SDL2/SDL_cpuinfo.h +39 -4
  31. data/assets/include/SDL2/SDL_egl.h +59 -9
  32. data/assets/include/SDL2/SDL_endian.h +34 -3
  33. data/assets/include/SDL2/SDL_events.h +32 -1
  34. data/assets/include/SDL2/SDL_filesystem.h +5 -1
  35. data/assets/include/SDL2/SDL_gamecontroller.h +78 -5
  36. data/assets/include/SDL2/SDL_guid.h +100 -0
  37. data/assets/include/SDL2/SDL_hints.h +645 -43
  38. data/assets/include/SDL2/SDL_image.h +2045 -33
  39. data/assets/include/SDL2/SDL_joystick.h +127 -7
  40. data/assets/include/SDL2/SDL_keyboard.h +38 -1
  41. data/assets/include/SDL2/SDL_keycode.h +6 -1
  42. data/assets/include/SDL2/SDL_log.h +2 -2
  43. data/assets/include/SDL2/SDL_main.h +42 -2
  44. data/assets/include/SDL2/SDL_metal.h +2 -1
  45. data/assets/include/SDL2/SDL_mixer.h +2529 -396
  46. data/assets/include/SDL2/SDL_mouse.h +12 -1
  47. data/assets/include/SDL2/SDL_opengl.h +0 -51
  48. data/assets/include/SDL2/SDL_opengl_glext.h +2260 -231
  49. data/assets/include/SDL2/SDL_opengles2_gl2.h +374 -339
  50. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +3479 -1496
  51. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +6 -9
  52. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +43 -14
  53. data/assets/include/SDL2/SDL_platform.h +32 -6
  54. data/assets/include/SDL2/SDL_rect.h +154 -2
  55. data/assets/include/SDL2/SDL_render.h +46 -17
  56. data/assets/include/SDL2/SDL_revision.h +4 -0
  57. data/assets/include/SDL2/SDL_rwops.h +1 -15
  58. data/assets/include/SDL2/SDL_scancode.h +46 -21
  59. data/assets/include/SDL2/SDL_sensor.h +24 -3
  60. data/assets/include/SDL2/SDL_stdinc.h +119 -8
  61. data/assets/include/SDL2/SDL_surface.h +3 -1
  62. data/assets/include/SDL2/SDL_system.h +66 -6
  63. data/assets/include/SDL2/SDL_syswm.h +2 -0
  64. data/assets/include/SDL2/SDL_test_common.h +1 -0
  65. data/assets/include/SDL2/SDL_test_font.h +90 -3
  66. data/assets/include/SDL2/SDL_thread.h +3 -3
  67. data/assets/include/SDL2/SDL_touch.h +8 -0
  68. data/assets/include/SDL2/SDL_ttf.h +2084 -155
  69. data/assets/include/SDL2/SDL_version.h +19 -3
  70. data/assets/include/SDL2/SDL_video.h +71 -9
  71. data/assets/include/SDL2/begin_code.h +4 -4
  72. data/assets/include/mrbconf.h +15 -17
  73. data/assets/include/mruby/array.h +8 -21
  74. data/assets/include/mruby/boxing_nan.h +115 -86
  75. data/assets/include/mruby/boxing_word.h +104 -78
  76. data/assets/include/mruby/common.h +6 -0
  77. data/assets/include/mruby/compile.h +3 -4
  78. data/assets/include/mruby/debug.h +4 -2
  79. data/assets/include/mruby/dump.h +5 -2
  80. data/assets/include/mruby/error.h +12 -2
  81. data/assets/include/mruby/gc.h +2 -0
  82. data/assets/include/mruby/hash.h +1 -3
  83. data/assets/include/mruby/irep.h +4 -4
  84. data/assets/include/mruby/numeric.h +21 -13
  85. data/assets/include/mruby/opcode.h +30 -0
  86. data/assets/include/mruby/ops.h +99 -101
  87. data/assets/include/mruby/presym/scanning.h +15 -9
  88. data/assets/include/mruby/proc.h +4 -2
  89. data/assets/include/mruby/string.h +3 -24
  90. data/assets/include/mruby/value.h +80 -40
  91. data/assets/include/mruby/variable.h +0 -15
  92. data/assets/include/mruby/version.h +5 -5
  93. data/assets/include/mruby.h +86 -16
  94. data/assets/macos/universal/bin/mrbc +0 -0
  95. data/assets/macos/universal/lib/libFLAC.a +0 -0
  96. data/assets/macos/universal/lib/libSDL2.a +0 -0
  97. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  98. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  99. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  100. data/assets/macos/universal/lib/libavif.a +0 -0
  101. data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
  102. data/assets/macos/universal/lib/libbrotlidec-static.a +0 -0
  103. data/assets/macos/universal/lib/libfreetype.a +0 -0
  104. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  105. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  106. data/assets/macos/universal/lib/libhwy.a +0 -0
  107. data/assets/macos/universal/lib/libjpeg.a +0 -0
  108. data/assets/macos/universal/lib/libjxl.a +0 -0
  109. data/assets/macos/universal/lib/libmodplug.a +0 -0
  110. data/assets/macos/universal/lib/libmpg123.a +0 -0
  111. data/assets/macos/universal/lib/libmruby.a +0 -0
  112. data/assets/macos/universal/lib/libogg.a +0 -0
  113. data/assets/macos/universal/lib/libpng.a +0 -0
  114. data/assets/macos/universal/lib/libtiff.a +0 -0
  115. data/assets/macos/universal/lib/libvorbis.a +0 -0
  116. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  117. data/assets/macos/universal/lib/libwebp.a +0 -0
  118. data/assets/macos/universal/lib/libzstd.a +0 -0
  119. data/assets/wasm/libmruby.a +0 -0
  120. data/assets/wasm/template.html +52 -4
  121. data/assets/windows/mingw-w64-ucrt-x86_64/bin/mrbc.exe +0 -0
  122. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  123. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
  124. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  125. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
  126. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  127. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
  128. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
  129. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
  130. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbz2.a +0 -0
  131. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
  132. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
  133. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  134. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libgraphite2.a +0 -0
  135. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
  136. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libhwy.a +0 -0
  137. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjbig.a +0 -0
  138. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
  139. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjxl.a +0 -0
  140. data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
  141. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
  142. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  143. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
  144. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
  145. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  146. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
  147. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng.a +0 -0
  148. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  149. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +1 -0
  150. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  151. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
  152. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
  153. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
  154. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
  155. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  156. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a +0 -0
  157. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  158. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  159. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  160. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  161. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  162. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  163. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  164. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  165. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  166. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  167. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  168. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  169. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  170. data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
  171. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  172. data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
  173. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  174. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  175. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  176. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  177. data/assets/windows/mingw-w64-x86_64/lib/libpng.a +0 -0
  178. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  179. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  180. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  181. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  182. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  183. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  184. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  185. data/ext/ruby2d/canvas.c +540 -0
  186. data/ext/ruby2d/extconf.rb +39 -21
  187. data/ext/ruby2d/gl.c +3 -3
  188. data/ext/ruby2d/image.c +7 -7
  189. data/ext/ruby2d/ruby2d.c +741 -24
  190. data/ext/ruby2d/ruby2d.h +66 -3
  191. data/ext/ruby2d/sound.c +16 -2
  192. data/lib/ruby2d/canvas.rb +315 -0
  193. data/lib/ruby2d/circle.rb +30 -15
  194. data/lib/ruby2d/cli/build.rb +11 -4
  195. data/lib/ruby2d/cli/enable_console.rb +3 -1
  196. data/lib/ruby2d/color.rb +133 -77
  197. data/lib/ruby2d/core.rb +32 -0
  198. data/lib/ruby2d/dsl.rb +38 -32
  199. data/lib/ruby2d/exceptions.rb +2 -1
  200. data/lib/ruby2d/font.rb +97 -62
  201. data/lib/ruby2d/image.rb +48 -27
  202. data/lib/ruby2d/line.rb +84 -45
  203. data/lib/ruby2d/music.rb +33 -23
  204. data/lib/ruby2d/pixel.rb +10 -9
  205. data/lib/ruby2d/pixmap.rb +39 -0
  206. data/lib/ruby2d/pixmap_atlas.rb +56 -0
  207. data/lib/ruby2d/quad.rb +98 -49
  208. data/lib/ruby2d/rectangle.rb +35 -36
  209. data/lib/ruby2d/renderable.rb +7 -6
  210. data/lib/ruby2d/sound.rb +23 -17
  211. data/lib/ruby2d/sprite.rb +181 -140
  212. data/lib/ruby2d/square.rb +21 -20
  213. data/lib/ruby2d/text.rb +47 -19
  214. data/lib/ruby2d/texture.rb +13 -3
  215. data/lib/ruby2d/tileset.rb +97 -44
  216. data/lib/ruby2d/triangle.rb +91 -42
  217. data/lib/ruby2d/version.rb +3 -1
  218. data/lib/ruby2d/vertices.rb +81 -45
  219. data/lib/ruby2d/window.rb +508 -371
  220. data/lib/ruby2d.rb +11 -29
  221. metadata +84 -16
  222. data/assets/include/SDL2/SDL_config_psp.h +0 -165
  223. data/assets/include/SDL2/SDL_config_wiz.h +0 -154
  224. data/assets/include/glew.h +0 -23686
  225. data/assets/macos/universal/lib/libpng16.a +0 -0
  226. data/assets/wasm/build_config.rb +0 -13
  227. data/assets/windows/glew/README.md +0 -10
  228. data/assets/windows/glew/glew.h +0 -23686
  229. data/assets/windows/glew/libglew32.a +0 -0
  230. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  231. data/lib/ruby2d/entity.rb +0 -17
@@ -1,20 +1,17 @@
1
1
  #ifndef __gl2platform_h_
2
2
  #define __gl2platform_h_
3
3
 
4
- /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
5
-
6
4
  /*
7
- * This document is licensed under the SGI Free Software B License Version
8
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9
- */
5
+ ** Copyright 2017-2020 The Khronos Group Inc.
6
+ ** SPDX-License-Identifier: Apache-2.0
7
+ */
10
8
 
11
9
  /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12
10
  *
13
11
  * Adopters may modify khrplatform.h and this file to suit their platform.
14
- * You are encouraged to submit all modifications to the Khronos group so that
15
- * they can be included in future versions of this file. Please submit changes
16
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17
- * by filing a bug against product "OpenGL-ES" component "Registry".
12
+ * Please contribute modifications back to Khronos as pull requests on the
13
+ * public github repository:
14
+ * https://github.com/KhronosGroup/OpenGL-Registry
18
15
  */
19
16
 
20
17
  /*#include <KHR/khrplatform.h>*/
@@ -2,7 +2,7 @@
2
2
  #define __khrplatform_h_
3
3
 
4
4
  /*
5
- ** Copyright (c) 2008-2009 The Khronos Group Inc.
5
+ ** Copyright (c) 2008-2018 The Khronos Group Inc.
6
6
  **
7
7
  ** Permission is hereby granted, free of charge, to any person obtaining a
8
8
  ** copy of this software and/or associated documentation files (the
@@ -26,18 +26,16 @@
26
26
 
27
27
  /* Khronos platform-specific types and definitions.
28
28
  *
29
- * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
29
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
30
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
31
+ * The last semantic modification to khrplatform.h was at commit ID:
32
+ * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
30
33
  *
31
34
  * Adopters may modify this file to suit their platform. Adopters are
32
35
  * encouraged to submit platform specific modifications to the Khronos
33
36
  * group so that they can be included in future versions of this file.
34
- * Please submit changes by sending them to the public Khronos Bugzilla
35
- * (http://khronos.org/bugzilla) by filing a bug against product
36
- * "Khronos (general)" component "Registry".
37
- *
38
- * A predefined template which fills in some of the bug fields can be
39
- * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
40
- * must create a Bugzilla login first.
37
+ * Please submit changes by filing pull requests or issues on
38
+ * the EGL Registry repository linked above.
41
39
  *
42
40
  *
43
41
  * See the Implementer's Guidelines for information about where this file
@@ -92,15 +90,25 @@
92
90
  * int arg2) KHRONOS_APIATTRIBUTES;
93
91
  */
94
92
 
93
+ #if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
94
+ # define KHRONOS_STATIC 1
95
+ #endif
96
+
95
97
  /*-------------------------------------------------------------------------
96
98
  * Definition of KHRONOS_APICALL
97
99
  *-------------------------------------------------------------------------
98
100
  * This precedes the return type of the function in the function prototype.
99
101
  */
100
- #if defined(_WIN32) && !defined(__SCITECH_SNAP__)
102
+ #if defined(KHRONOS_STATIC)
103
+ /* If the preprocessor constant KHRONOS_STATIC is defined, make the
104
+ * header compatible with static linking. */
105
+ # define KHRONOS_APICALL
106
+ #elif defined(_WIN32)
101
107
  # define KHRONOS_APICALL __declspec(dllimport)
102
108
  #elif defined (__SYMBIAN32__)
103
109
  # define KHRONOS_APICALL IMPORT_C
110
+ #elif defined(__ANDROID__)
111
+ # define KHRONOS_APICALL __attribute__((visibility("default")))
104
112
  #else
105
113
  # define KHRONOS_APICALL
106
114
  #endif
@@ -145,6 +153,20 @@ typedef int64_t khronos_int64_t;
145
153
  typedef uint64_t khronos_uint64_t;
146
154
  #define KHRONOS_SUPPORT_INT64 1
147
155
  #define KHRONOS_SUPPORT_FLOAT 1
156
+ /*
157
+ * To support platform where unsigned long cannot be used interchangeably with
158
+ * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
159
+ * Ideally, we could just use (u)intptr_t everywhere, but this could result in
160
+ * ABI breakage if khronos_uintptr_t is changed from unsigned long to
161
+ * unsigned long long or similar (this results in different C++ name mangling).
162
+ * To avoid changes for existing platforms, we restrict usage of intptr_t to
163
+ * platforms where the size of a pointer is larger than the size of long.
164
+ */
165
+ #if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
166
+ #if __SIZEOF_POINTER__ > __SIZEOF_LONG__
167
+ #define KHRONOS_USE_INTPTR_T
168
+ #endif
169
+ #endif
148
170
 
149
171
  #elif defined(__VMS ) || defined(__sgi)
150
172
 
@@ -223,18 +245,25 @@ typedef signed short int khronos_int16_t;
223
245
  typedef unsigned short int khronos_uint16_t;
224
246
 
225
247
  /*
226
- * Types that differ between LLP64 and LP64 architectures - in LLP64,
248
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
227
249
  * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
228
250
  * to be the only LLP64 architecture in current use.
229
251
  */
230
- #ifdef _WIN64
252
+ #ifdef KHRONOS_USE_INTPTR_T
253
+ typedef intptr_t khronos_intptr_t;
254
+ typedef uintptr_t khronos_uintptr_t;
255
+ #elif defined(_WIN64)
231
256
  typedef signed long long int khronos_intptr_t;
232
257
  typedef unsigned long long int khronos_uintptr_t;
233
- typedef signed long long int khronos_ssize_t;
234
- typedef unsigned long long int khronos_usize_t;
235
258
  #else
236
259
  typedef signed long int khronos_intptr_t;
237
260
  typedef unsigned long int khronos_uintptr_t;
261
+ #endif
262
+
263
+ #if defined(_WIN64)
264
+ typedef signed long long int khronos_ssize_t;
265
+ typedef unsigned long long int khronos_usize_t;
266
+ #else
238
267
  typedef signed long int khronos_ssize_t;
239
268
  typedef unsigned long int khronos_usize_t;
240
269
  #endif
@@ -65,11 +65,15 @@
65
65
  #undef __LINUX__ /* do we need to do this? */
66
66
  #define __ANDROID__ 1
67
67
  #endif
68
+ #if defined(__NGAGE__)
69
+ #undef __NGAGE__
70
+ #define __NGAGE__ 1
71
+ #endif
68
72
 
69
73
  #if defined(__APPLE__)
70
74
  /* lets us know what version of Mac OS X we're compiling on */
71
- #include "AvailabilityMacros.h"
72
- #include "TargetConditionals.h"
75
+ #include <AvailabilityMacros.h>
76
+ #include <TargetConditionals.h>
73
77
 
74
78
  /* Fix building with older SDKs that don't define these
75
79
  See this for more information:
@@ -104,9 +108,9 @@
104
108
  /* if not compiling for iOS */
105
109
  #undef __MACOSX__
106
110
  #define __MACOSX__ 1
107
- #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
108
- # error SDL for Mac OS X only supports deploying on 10.6 and above.
109
- #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
111
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
112
+ # error SDL for Mac OS X only supports deploying on 10.7 and above.
113
+ #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */
110
114
  #endif /* TARGET_OS_IPHONE */
111
115
  #endif /* defined(__APPLE__) */
112
116
 
@@ -140,7 +144,7 @@
140
144
  #endif
141
145
 
142
146
  #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
143
- /* Try to find out if we're compiling for WinRT or non-WinRT */
147
+ /* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
144
148
  #if defined(_MSC_VER) && defined(__has_include)
145
149
  #if __has_include(<winapifamily.h>)
146
150
  #define HAVE_WINAPIFAMILY_H 1
@@ -165,6 +169,15 @@
165
169
  #if WINAPI_FAMILY_WINRT
166
170
  #undef __WINRT__
167
171
  #define __WINRT__ 1
172
+ #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
173
+ #undef __WINGDK__
174
+ #define __WINGDK__ 1
175
+ #elif defined(_GAMING_XBOX_XBOXONE)
176
+ #undef __XBOXONE__
177
+ #define __XBOXONE__ 1
178
+ #elif defined(_GAMING_XBOX_SCARLETT)
179
+ #undef __XBOXSERIES__
180
+ #define __XBOXSERIES__ 1
168
181
  #else
169
182
  #undef __WINDOWS__
170
183
  #define __WINDOWS__ 1
@@ -175,10 +188,18 @@
175
188
  #undef __WIN32__
176
189
  #define __WIN32__ 1
177
190
  #endif
191
+ /* This is to support generic "any GDK" separate from a platform-specific GDK */
192
+ #if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
193
+ #undef __GDK__
194
+ #define __GDK__ 1
195
+ #endif
178
196
  #if defined(__PSP__)
179
197
  #undef __PSP__
180
198
  #define __PSP__ 1
181
199
  #endif
200
+ #if defined(PS2)
201
+ #define __PS2__ 1
202
+ #endif
182
203
 
183
204
  /* The NACL compiler defines __native_client__ and __pnacl__
184
205
  * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
@@ -200,6 +221,11 @@
200
221
  #define __VITA__ 1
201
222
  #endif
202
223
 
224
+ #if defined(__3DS__)
225
+ #undef __3DS__
226
+ #define __3DS__ 1
227
+ #endif
228
+
203
229
  #include "begin_code.h"
204
230
  /* Set up for C function definitions, even when using C++ */
205
231
  #ifdef __cplusplus
@@ -54,8 +54,8 @@ typedef struct SDL_Point
54
54
  /**
55
55
  * The structure that defines a point (floating point)
56
56
  *
57
- * \sa SDL_EnclosePoints
58
- * \sa SDL_PointInRect
57
+ * \sa SDL_EncloseFPoints
58
+ * \sa SDL_PointInFRect
59
59
  */
60
60
  typedef struct SDL_FPoint
61
61
  {
@@ -71,6 +71,7 @@ typedef struct SDL_FPoint
71
71
  * \sa SDL_RectEquals
72
72
  * \sa SDL_HasIntersection
73
73
  * \sa SDL_IntersectRect
74
+ * \sa SDL_IntersectRectAndLine
74
75
  * \sa SDL_UnionRect
75
76
  * \sa SDL_EnclosePoints
76
77
  */
@@ -83,6 +84,16 @@ typedef struct SDL_Rect
83
84
 
84
85
  /**
85
86
  * A rectangle, with the origin at the upper left (floating point).
87
+ *
88
+ * \sa SDL_FRectEmpty
89
+ * \sa SDL_FRectEquals
90
+ * \sa SDL_FRectEqualsEpsilon
91
+ * \sa SDL_HasIntersectionF
92
+ * \sa SDL_IntersectFRect
93
+ * \sa SDL_IntersectFRectAndLine
94
+ * \sa SDL_UnionFRect
95
+ * \sa SDL_EncloseFPoints
96
+ * \sa SDL_PointInFRect
86
97
  */
87
98
  typedef struct SDL_FRect
88
99
  {
@@ -213,6 +224,147 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
213
224
  int *Y1, int *X2,
214
225
  int *Y2);
215
226
 
227
+
228
+ /* SDL_FRect versions... */
229
+
230
+ /**
231
+ * Returns true if point resides inside a rectangle.
232
+ */
233
+ SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r)
234
+ {
235
+ return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
236
+ (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
237
+ }
238
+
239
+ /**
240
+ * Returns true if the rectangle has no area.
241
+ */
242
+ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
243
+ {
244
+ return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE;
245
+ }
246
+
247
+ /**
248
+ * Returns true if the two rectangles are equal, within some given epsilon.
249
+ *
250
+ * \since This function is available since SDL 2.0.22.
251
+ */
252
+ SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
253
+ {
254
+ return (a && b && ((a == b) ||
255
+ ((SDL_fabsf(a->x - b->x) <= epsilon) &&
256
+ (SDL_fabsf(a->y - b->y) <= epsilon) &&
257
+ (SDL_fabsf(a->w - b->w) <= epsilon) &&
258
+ (SDL_fabsf(a->h - b->h) <= epsilon))))
259
+ ? SDL_TRUE : SDL_FALSE;
260
+ }
261
+
262
+ /**
263
+ * Returns true if the two rectangles are equal, using a default epsilon.
264
+ *
265
+ * \since This function is available since SDL 2.0.22.
266
+ */
267
+ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b)
268
+ {
269
+ return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON);
270
+ }
271
+
272
+ /**
273
+ * Determine whether two rectangles intersect with float precision.
274
+ *
275
+ * If either pointer is NULL the function will return SDL_FALSE.
276
+ *
277
+ * \param A an SDL_FRect structure representing the first rectangle
278
+ * \param B an SDL_FRect structure representing the second rectangle
279
+ * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
280
+ *
281
+ * \since This function is available since SDL 2.0.22.
282
+ *
283
+ * \sa SDL_IntersectRect
284
+ */
285
+ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A,
286
+ const SDL_FRect * B);
287
+
288
+ /**
289
+ * Calculate the intersection of two rectangles with float precision.
290
+ *
291
+ * If `result` is NULL then this function will return SDL_FALSE.
292
+ *
293
+ * \param A an SDL_FRect structure representing the first rectangle
294
+ * \param B an SDL_FRect structure representing the second rectangle
295
+ * \param result an SDL_FRect structure filled in with the intersection of
296
+ * rectangles `A` and `B`
297
+ * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
298
+ *
299
+ * \since This function is available since SDL 2.0.22.
300
+ *
301
+ * \sa SDL_HasIntersectionF
302
+ */
303
+ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A,
304
+ const SDL_FRect * B,
305
+ SDL_FRect * result);
306
+
307
+ /**
308
+ * Calculate the union of two rectangles with float precision.
309
+ *
310
+ * \param A an SDL_FRect structure representing the first rectangle
311
+ * \param B an SDL_FRect structure representing the second rectangle
312
+ * \param result an SDL_FRect structure filled in with the union of rectangles
313
+ * `A` and `B`
314
+ *
315
+ * \since This function is available since SDL 2.0.22.
316
+ */
317
+ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A,
318
+ const SDL_FRect * B,
319
+ SDL_FRect * result);
320
+
321
+ /**
322
+ * Calculate a minimal rectangle enclosing a set of points with float
323
+ * precision.
324
+ *
325
+ * If `clip` is not NULL then only points inside of the clipping rectangle are
326
+ * considered.
327
+ *
328
+ * \param points an array of SDL_FPoint structures representing points to be
329
+ * enclosed
330
+ * \param count the number of structures in the `points` array
331
+ * \param clip an SDL_FRect used for clipping or NULL to enclose all points
332
+ * \param result an SDL_FRect structure filled in with the minimal enclosing
333
+ * rectangle
334
+ * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
335
+ * points were outside of the clipping rectangle.
336
+ *
337
+ * \since This function is available since SDL 2.0.22.
338
+ */
339
+ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points,
340
+ int count,
341
+ const SDL_FRect * clip,
342
+ SDL_FRect * result);
343
+
344
+ /**
345
+ * Calculate the intersection of a rectangle and line segment with float
346
+ * precision.
347
+ *
348
+ * This function is used to clip a line segment to a rectangle. A line segment
349
+ * contained entirely within the rectangle or that does not intersect will
350
+ * remain unchanged. A line segment that crosses the rectangle at either or
351
+ * both ends will be clipped to the boundary of the rectangle and the new
352
+ * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
353
+ *
354
+ * \param rect an SDL_FRect structure representing the rectangle to intersect
355
+ * \param X1 a pointer to the starting X-coordinate of the line
356
+ * \param Y1 a pointer to the starting Y-coordinate of the line
357
+ * \param X2 a pointer to the ending X-coordinate of the line
358
+ * \param Y2 a pointer to the ending Y-coordinate of the line
359
+ * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
360
+ *
361
+ * \since This function is available since SDL 2.0.22.
362
+ */
363
+ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect *
364
+ rect, float *X1,
365
+ float *Y1, float *X2,
366
+ float *Y2);
367
+
216
368
  /* Ends C function definitions when using C++ */
217
369
  #ifdef __cplusplus
218
370
  }
@@ -261,6 +261,17 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *
261
261
  */
262
262
  extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
263
263
 
264
+ /**
265
+ * Get the window associated with a renderer.
266
+ *
267
+ * \param renderer the renderer to query
268
+ * \returns the window on success or NULL on failure; call SDL_GetError() for
269
+ * more information.
270
+ *
271
+ * \since This function is available since SDL 2.0.22.
272
+ */
273
+ extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer);
274
+
264
275
  /**
265
276
  * Get information about a rendering context.
266
277
  *
@@ -356,11 +367,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
356
367
  * \param texture the texture to query
357
368
  * \param format a pointer filled in with the raw format of the texture; the
358
369
  * actual format may differ, but pixel transfers will use this
359
- * format (one of the SDL_PixelFormatEnum values)
370
+ * format (one of the SDL_PixelFormatEnum values). This argument
371
+ * can be NULL if you don't need this information.
360
372
  * \param access a pointer filled in with the actual access to the texture
361
- * (one of the SDL_TextureAccess values)
362
- * \param w a pointer filled in with the width of the texture in pixels
363
- * \param h a pointer filled in with the height of the texture in pixels
373
+ * (one of the SDL_TextureAccess values). This argument can be
374
+ * NULL if you don't need this information.
375
+ * \param w a pointer filled in with the width of the texture in pixels. This
376
+ * argument can be NULL if you don't need this information.
377
+ * \param h a pointer filled in with the height of the texture in pixels. This
378
+ * argument can be NULL if you don't need this information.
364
379
  * \returns 0 on success or a negative error code on failure; call
365
380
  * SDL_GetError() for more information.
366
381
  *
@@ -810,9 +825,13 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in
810
825
  /**
811
826
  * Get device independent resolution for rendering.
812
827
  *
813
- * This may return 0 for `w` and `h` if the SDL_Renderer has never had its
814
- * logical size set by SDL_RenderSetLogicalSize() and never had a render
815
- * target set.
828
+ * When using the main rendering target (eg no target texture is set): this
829
+ * may return 0 for `w` and `h` if the SDL_Renderer has never had its logical
830
+ * size set by SDL_RenderSetLogicalSize(). Otherwise it returns the logical
831
+ * width and height.
832
+ *
833
+ * When using a target texture: Never return 0 for `w` and `h` at first. Then
834
+ * it returns the logical width and height that are set.
816
835
  *
817
836
  * \param renderer a rendering context
818
837
  * \param w an int to be filled with the width
@@ -985,7 +1004,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
985
1004
  * and logical renderer size set
986
1005
  *
987
1006
  * \param renderer the renderer from which the logical coordinates should be
988
- * calcualted
1007
+ * calculated
989
1008
  * \param windowX the real X coordinate in the window
990
1009
  * \param windowY the real Y coordinate in the window
991
1010
  * \param logicalX the pointer filled with the logical x coordinate
@@ -1002,19 +1021,23 @@ extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer * renderer,
1002
1021
  int windowX, int windowY,
1003
1022
  float *logicalX, float *logicalY);
1004
1023
 
1005
- /**
1006
- * Get real coordinates of point in window when given logical coordinates of point in renderer.
1007
- * Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set
1008
- *
1009
- * \param renderer the renderer from which the window coordinates should be calculated
1024
+
1025
+ /**
1026
+ * Get real coordinates of point in window when given logical coordinates of
1027
+ * point in renderer.
1028
+ *
1029
+ * Logical coordinates will differ from real coordinates when render is scaled
1030
+ * and logical renderer size set
1031
+ *
1032
+ * \param renderer the renderer from which the window coordinates should be
1033
+ * calculated
1010
1034
  * \param logicalX the logical x coordinate
1011
1035
  * \param logicalY the logical y coordinate
1012
1036
  * \param windowX the pointer filled with the real X coordinate in the window
1013
1037
  * \param windowY the pointer filled with the real Y coordinate in the window
1014
-
1015
- *
1038
+ *
1016
1039
  * \since This function is available since SDL 2.0.18.
1017
- *
1040
+ *
1018
1041
  * \sa SDL_RenderGetScale
1019
1042
  * \sa SDL_RenderSetScale
1020
1043
  * \sa SDL_RenderGetLogicalSize
@@ -1603,6 +1626,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
1603
1626
  * vertex array Color and alpha modulation is done per vertex
1604
1627
  * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1605
1628
  *
1629
+ * \param renderer The rendering context.
1606
1630
  * \param texture (optional) The SDL texture to use.
1607
1631
  * \param vertices Vertices.
1608
1632
  * \param num_vertices Number of vertices.
@@ -1627,6 +1651,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1627
1651
  * vertex arrays Color and alpha modulation is done per vertex
1628
1652
  * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1629
1653
  *
1654
+ * \param renderer The rendering context.
1630
1655
  * \param texture (optional) The SDL texture to use.
1631
1656
  * \param xy Vertex positions
1632
1657
  * \param xy_stride Byte size to move from one element to the next element
@@ -1658,7 +1683,8 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1658
1683
  * Read pixels from the current rendering target to an array of pixels.
1659
1684
  *
1660
1685
  * **WARNING**: This is a very slow operation, and should not be used
1661
- * frequently.
1686
+ * frequently. If you're using this on the main rendering target, it should be
1687
+ * called after rendering and before SDL_RenderPresent().
1662
1688
  *
1663
1689
  * `pitch` specifies the number of bytes between rows in the destination
1664
1690
  * `pixels` data. This allows you to write to a subrectangle or have padded
@@ -1739,6 +1765,9 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
1739
1765
  /**
1740
1766
  * Destroy the rendering context for a window and free associated textures.
1741
1767
  *
1768
+ * If `renderer` is NULL, this function will return immediately after setting
1769
+ * the SDL error message to "Invalid renderer". See SDL_GetError().
1770
+ *
1742
1771
  * \param renderer the rendering context
1743
1772
  *
1744
1773
  * \since This function is available since SDL 2.0.0.
@@ -1,2 +1,6 @@
1
+ #ifdef SDL_VENDOR_INFO
2
+ #define SDL_REVISION SDL_VENDOR_INFO
3
+ #else
1
4
  #define SDL_REVISION ""
5
+ #endif
2
6
  #define SDL_REVISION_NUMBER 0
@@ -45,9 +45,6 @@ extern "C" {
45
45
  #define SDL_RWOPS_JNIFILE 3U /**< Android asset */
46
46
  #define SDL_RWOPS_MEMORY 4U /**< Memory stream */
47
47
  #define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
48
- #if defined(__VITA__)
49
- #define SDL_RWOPS_VITAFILE 6U /**< Vita file */
50
- #endif
51
48
 
52
49
  /**
53
50
  * This is the read/write operation structure -- very basic.
@@ -101,7 +98,7 @@ typedef struct SDL_RWops
101
98
  {
102
99
  void *asset;
103
100
  } androidio;
104
- #elif defined(__WIN32__)
101
+ #elif defined(__WIN32__) || defined(__GDK__)
105
102
  struct
106
103
  {
107
104
  SDL_bool append;
@@ -113,17 +110,6 @@ typedef struct SDL_RWops
113
110
  size_t left;
114
111
  } buffer;
115
112
  } windowsio;
116
- #elif defined(__VITA__)
117
- struct
118
- {
119
- int h;
120
- struct
121
- {
122
- void *data;
123
- size_t size;
124
- size_t left;
125
- } buffer;
126
- } vitaio;
127
113
  #endif
128
114
 
129
115
  #ifdef HAVE_STDIO_H