ruby2d 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/assets/README.md +20 -7
  3. data/assets/include/SDL2/SDL.h +135 -0
  4. data/assets/include/SDL2/SDL_assert.h +291 -0
  5. data/assets/include/SDL2/SDL_atomic.h +277 -0
  6. data/assets/include/SDL2/SDL_audio.h +826 -0
  7. data/assets/include/SDL2/SDL_bits.h +112 -0
  8. data/assets/include/SDL2/SDL_blendmode.h +120 -0
  9. data/assets/include/SDL2/SDL_clipboard.h +71 -0
  10. data/assets/include/SDL2/SDL_config.h +421 -0
  11. data/assets/include/SDL2/SDL_cpuinfo.h +188 -0
  12. data/assets/include/SDL2/SDL_egl.h +1673 -0
  13. data/assets/include/SDL2/SDL_endian.h +260 -0
  14. data/assets/include/SDL2/SDL_error.h +76 -0
  15. data/assets/include/SDL2/SDL_events.h +788 -0
  16. data/assets/include/SDL2/SDL_filesystem.h +136 -0
  17. data/assets/include/SDL2/SDL_gamecontroller.h +390 -0
  18. data/assets/include/SDL2/SDL_gesture.h +87 -0
  19. data/assets/include/SDL2/SDL_haptic.h +1238 -0
  20. data/assets/include/SDL2/SDL_hints.h +1135 -0
  21. data/assets/include/SDL2/SDL_image.h +161 -0
  22. data/assets/include/SDL2/SDL_joystick.h +408 -0
  23. data/assets/include/SDL2/SDL_keyboard.h +217 -0
  24. data/assets/include/SDL2/SDL_keycode.h +349 -0
  25. data/assets/include/SDL2/SDL_loadso.h +81 -0
  26. data/assets/include/SDL2/SDL_log.h +211 -0
  27. data/assets/include/SDL2/SDL_main.h +168 -0
  28. data/assets/include/SDL2/SDL_messagebox.h +144 -0
  29. data/assets/include/SDL2/SDL_mixer.h +651 -0
  30. data/assets/include/SDL2/SDL_mouse.h +302 -0
  31. data/assets/include/SDL2/SDL_mutex.h +251 -0
  32. data/assets/include/SDL2/SDL_name.h +33 -0
  33. data/assets/include/SDL2/SDL_opengl.h +2183 -0
  34. data/assets/include/SDL2/SDL_opengl_glext.h +11177 -0
  35. data/assets/include/SDL2/SDL_opengles.h +39 -0
  36. data/assets/include/SDL2/SDL_opengles2.h +52 -0
  37. data/assets/include/SDL2/SDL_opengles2_gl2.h +621 -0
  38. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +2050 -0
  39. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +30 -0
  40. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +282 -0
  41. data/assets/include/SDL2/SDL_pixels.h +470 -0
  42. data/assets/include/SDL2/SDL_platform.h +198 -0
  43. data/assets/include/SDL2/SDL_power.h +75 -0
  44. data/assets/include/SDL2/SDL_quit.h +58 -0
  45. data/assets/include/SDL2/SDL_rect.h +148 -0
  46. data/assets/include/SDL2/SDL_render.h +931 -0
  47. data/assets/include/SDL2/SDL_revision.h +2 -0
  48. data/assets/include/SDL2/SDL_rwops.h +254 -0
  49. data/assets/include/SDL2/SDL_scancode.h +413 -0
  50. data/assets/include/SDL2/SDL_sensor.h +251 -0
  51. data/assets/include/SDL2/SDL_shape.h +144 -0
  52. data/assets/include/SDL2/SDL_stdinc.h +607 -0
  53. data/assets/include/SDL2/SDL_surface.h +553 -0
  54. data/assets/include/SDL2/SDL_system.h +279 -0
  55. data/assets/include/SDL2/SDL_syswm.h +324 -0
  56. data/assets/include/SDL2/SDL_test.h +69 -0
  57. data/assets/include/SDL2/SDL_test_assert.h +105 -0
  58. data/assets/include/SDL2/SDL_test_common.h +188 -0
  59. data/assets/include/SDL2/SDL_test_compare.h +69 -0
  60. data/assets/include/SDL2/SDL_test_crc32.h +124 -0
  61. data/assets/include/SDL2/SDL_test_font.h +81 -0
  62. data/assets/include/SDL2/SDL_test_fuzzer.h +384 -0
  63. data/assets/include/SDL2/SDL_test_harness.h +134 -0
  64. data/assets/include/SDL2/SDL_test_images.h +78 -0
  65. data/assets/include/SDL2/SDL_test_log.h +67 -0
  66. data/assets/include/SDL2/SDL_test_md5.h +129 -0
  67. data/assets/include/SDL2/SDL_test_memory.h +63 -0
  68. data/assets/include/SDL2/SDL_test_random.h +115 -0
  69. data/assets/include/SDL2/SDL_thread.h +343 -0
  70. data/assets/include/SDL2/SDL_timer.h +115 -0
  71. data/assets/include/SDL2/SDL_touch.h +86 -0
  72. data/assets/include/SDL2/SDL_ttf.h +294 -0
  73. data/assets/include/SDL2/SDL_types.h +29 -0
  74. data/assets/include/SDL2/SDL_version.h +162 -0
  75. data/assets/include/SDL2/SDL_video.h +1276 -0
  76. data/assets/include/SDL2/SDL_vulkan.h +278 -0
  77. data/assets/include/SDL2/begin_code.h +167 -0
  78. data/assets/include/SDL2/close_code.h +37 -0
  79. data/assets/include/glew.h +23686 -0
  80. data/assets/include/simple2d.h +735 -0
  81. data/assets/ios/MRuby.framework/Headers/mrbconf.h +3 -5
  82. data/assets/ios/MRuby.framework/Headers/mruby.h +35 -32
  83. data/assets/ios/MRuby.framework/Headers/mruby/array.h +1 -0
  84. data/assets/ios/MRuby.framework/Headers/mruby/boxing_word.h +9 -1
  85. data/assets/ios/MRuby.framework/Headers/mruby/class.h +14 -11
  86. data/assets/ios/MRuby.framework/Headers/mruby/common.h +5 -0
  87. data/assets/ios/MRuby.framework/Headers/mruby/compile.h +4 -3
  88. data/assets/ios/MRuby.framework/Headers/mruby/debug.h +3 -2
  89. data/assets/ios/MRuby.framework/Headers/mruby/dump.h +2 -2
  90. data/assets/ios/MRuby.framework/Headers/mruby/hash.h +38 -5
  91. data/assets/ios/MRuby.framework/Headers/mruby/irep.h +17 -4
  92. data/assets/ios/MRuby.framework/Headers/mruby/object.h +4 -5
  93. data/assets/ios/MRuby.framework/Headers/mruby/opcode.h +47 -139
  94. data/assets/ios/MRuby.framework/Headers/mruby/ops.h +117 -0
  95. data/assets/ios/MRuby.framework/Headers/mruby/proc.h +4 -4
  96. data/assets/ios/MRuby.framework/Headers/mruby/string.h +11 -7
  97. data/assets/ios/MRuby.framework/Headers/mruby/throw.h +4 -4
  98. data/assets/ios/MRuby.framework/Headers/mruby/variable.h +2 -4
  99. data/assets/ios/MRuby.framework/Headers/mruby/version.h +6 -6
  100. data/assets/ios/MRuby.framework/MRuby +0 -0
  101. data/assets/ios/MyApp.xcodeproj/project.pbxproj +24 -18
  102. data/assets/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  103. data/assets/ios/main.c +1 -1
  104. data/assets/macos/lib/libFLAC.a +0 -0
  105. data/assets/macos/lib/libSDL2.a +0 -0
  106. data/assets/macos/lib/libSDL2_image.a +0 -0
  107. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  108. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  109. data/assets/macos/lib/libfreetype.a +0 -0
  110. data/assets/macos/lib/libjpeg.a +0 -0
  111. data/assets/macos/lib/libmpg123.a +0 -0
  112. data/assets/macos/lib/libogg.a +0 -0
  113. data/assets/macos/lib/libpng16.a +0 -0
  114. data/assets/macos/lib/libsimple2d.a +0 -0
  115. data/assets/macos/lib/libtiff.a +0 -0
  116. data/assets/macos/lib/libvorbis.a +0 -0
  117. data/assets/macos/lib/libvorbisfile.a +0 -0
  118. data/assets/macos/lib/libwebp.a +0 -0
  119. data/assets/mingw/bin/SDL2.dll +0 -0
  120. data/assets/mingw/bin/SDL2_image.dll +0 -0
  121. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  122. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  123. data/assets/mingw/bin/glew32.dll +0 -0
  124. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  125. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  126. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  127. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  128. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  129. data/assets/mingw/bin/libogg-0.dll +0 -0
  130. data/assets/mingw/bin/libopus-0.dll +0 -0
  131. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  132. data/assets/mingw/bin/libpng16-16.dll +0 -0
  133. data/assets/mingw/bin/libtiff-5.dll +0 -0
  134. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  135. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  136. data/assets/mingw/bin/libwebp-7.dll +0 -0
  137. data/assets/mingw/bin/zlib1.dll +0 -0
  138. data/assets/mingw/lib/libSDL2.a +0 -0
  139. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  140. data/assets/mingw/lib/libSDL2_image.a +0 -0
  141. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  142. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  143. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  144. data/assets/mingw/lib/libSDL2_test.a +0 -0
  145. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  146. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  147. data/assets/mingw/lib/libSDL2main.a +0 -0
  148. data/assets/mingw/lib/libglew32.a +0 -0
  149. data/assets/mingw/lib/libglew32.dll.a +0 -0
  150. data/assets/mingw/lib/libsimple2d.a +0 -0
  151. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +4 -0
  152. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +4 -0
  153. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +4 -0
  154. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +4 -0
  155. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +4 -0
  156. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +4 -0
  157. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +4 -0
  158. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +4 -0
  159. data/assets/tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json +7 -0
  160. data/assets/tvos/MRuby.framework/Headers/mrbconf.h +3 -5
  161. data/assets/tvos/MRuby.framework/Headers/mruby.h +35 -32
  162. data/assets/tvos/MRuby.framework/Headers/mruby/array.h +1 -0
  163. data/assets/tvos/MRuby.framework/Headers/mruby/boxing_word.h +9 -1
  164. data/assets/tvos/MRuby.framework/Headers/mruby/class.h +14 -11
  165. data/assets/tvos/MRuby.framework/Headers/mruby/common.h +5 -0
  166. data/assets/tvos/MRuby.framework/Headers/mruby/compile.h +4 -3
  167. data/assets/tvos/MRuby.framework/Headers/mruby/debug.h +3 -2
  168. data/assets/tvos/MRuby.framework/Headers/mruby/dump.h +2 -2
  169. data/assets/tvos/MRuby.framework/Headers/mruby/hash.h +38 -5
  170. data/assets/tvos/MRuby.framework/Headers/mruby/irep.h +17 -4
  171. data/assets/tvos/MRuby.framework/Headers/mruby/object.h +4 -5
  172. data/assets/tvos/MRuby.framework/Headers/mruby/opcode.h +47 -139
  173. data/assets/tvos/MRuby.framework/Headers/mruby/ops.h +117 -0
  174. data/assets/tvos/MRuby.framework/Headers/mruby/proc.h +4 -4
  175. data/assets/tvos/MRuby.framework/Headers/mruby/string.h +11 -7
  176. data/assets/tvos/MRuby.framework/Headers/mruby/throw.h +4 -4
  177. data/assets/tvos/MRuby.framework/Headers/mruby/variable.h +2 -4
  178. data/assets/tvos/MRuby.framework/Headers/mruby/version.h +6 -6
  179. data/assets/tvos/MRuby.framework/MRuby +0 -0
  180. data/assets/tvos/MyApp.xcodeproj/project.pbxproj +25 -19
  181. data/assets/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  182. data/assets/tvos/main.c +1 -1
  183. data/ext/ruby2d/extconf.rb +59 -50
  184. data/ext/ruby2d/ruby2d.c +0 -1
  185. data/lib/ruby2d.rb +1 -7
  186. data/lib/ruby2d/cli/launch.rb +1 -1
  187. data/lib/ruby2d/font.rb +32 -7
  188. data/lib/ruby2d/version.rb +1 -1
  189. metadata +132 -6
  190. data/assets/opal.js +0 -21637
  191. data/assets/simple2d.js +0 -1379
  192. data/assets/template.html +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0d000122e993678b9da511dd2dd84a53c2e2762cb9aec666c2410b89c0848b3
4
- data.tar.gz: 7cdbf45866165115566642aae3af535b222cfe05a3aeec82f7cc565f4b8f1179
3
+ metadata.gz: b30ea1ff20b4c8f0a377f23a481902d8f219000c025906ede50f9b4e2930cf90
4
+ data.tar.gz: 8e4c9d37c1ea89aab64bff957392a6a1496f82422ec358af6dd39721f16f8900
5
5
  SHA512:
6
- metadata.gz: 62aae16a50902e30da1647ea49b545aaa164cae20ac85d6b74eb9f18071eafa712b1b5460550413371cc9485cb1888fec2f9b4757c86b58f2ad15ce5d092775b
7
- data.tar.gz: 98741f6e78b577d64fb8b63ab98a938d3388dae0d3d9389cd0793dc48611fc95c753f0d3b37ae35ce671f326fb246df9866c2e7e8788e9be46dd758c8bbaa0f7
6
+ metadata.gz: 0a0dc8b6388864aaf602e84f7c744917df00a43c93237620fb64d2a4a070617c4f0edd69f4b1cd86af0a5d2d7edc26ab38d4f0e243146b89b578f6181a9eb4a8
7
+ data.tar.gz: 3c00be89805e859e286b859c575f173b742b8a6ec333d08ffb50521691c8fcc420aa873e6fc2605d9c2c64eeff60664f0d7aad4b784c25efc5676b5f6b2b989e
@@ -1,9 +1,22 @@
1
1
  # Assets for the Ruby 2D gem
2
2
 
3
- This repo contains:
4
- - Xcode projects for iOS and tvOS, derived from the [Simple 2D deps](https://github.com/simple2d/deps/tree/master/xcode)
5
- - iOS and tvOS frameworks from [`mruby-frameworks`](https://github.com/ruby2d/mruby-frameworks)
6
- - [Simple2D.js](https://github.com/simple2d/simple2d.js)
7
- - The [Opal](http://opalrb.com) library generated using, for example, `opal --compile app.rb > app.js`
8
- - An [HTML template](template.html) for web-based apps
9
- - The [Ruby 2D logo](https://github.com/ruby2d/logo) icon
3
+ ## Contents
4
+
5
+ - [`include/`](include) C include headers for dependencies
6
+ - [`ios/`](ios) and [`tvos/`](tvos)
7
+ - Xcode projects for iOS and tvOS, derived from the [Simple 2D dependencies](https://github.com/simple2d/deps/tree/master/xcode)
8
+ - iOS and tvOS frameworks from [`mruby-frameworks`](https://github.com/ruby2d/mruby-frameworks)
9
+ - [`macos/`](macos) — Static library dependencies for macOS
10
+ - [`mingw/`](mingw) — Static and dynamic library dependencies for Windows / MinGW
11
+ - [`app.icns`](app.icns) — The [Ruby 2D logo](https://github.com/ruby2d/logo) icon
12
+
13
+ ## Updating
14
+
15
+ - From [simple2d/deps](https://github.com/simple2d/deps):
16
+ - Copy over SDL and GLEW headers to `include/`
17
+ - Copy over `macos/lib`, `mingw/lib`, and `mingw/bin`
18
+ - Copy over Xcode iOS and tvOS projects from `xcode/ios` and `xcode/tvos`
19
+ - Copy iOS and tvOS [MRuby frameworks](https://github.com/ruby2d/mruby-frameworks) to their respective project directories, add them to the Xcode projects (Target -> Build Phases -> Link Binary with Libraries) and the "Header Search Paths"; Rename Bundle Identifiers from "Simple2D.MyApp" to "Ruby2D.MyApp"
20
+ - From your local [Simple 2D](https://github.com/simple2d) project
21
+ - Copy `simple2d.h` to `include/`
22
+ - Copy the `libsimple2d.a` builds to their respective `macos/lib` and `mingw/lib` directories
@@ -0,0 +1,135 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL.h
24
+ *
25
+ * Main include header for the SDL library
26
+ */
27
+
28
+
29
+ #ifndef SDL_h_
30
+ #define SDL_h_
31
+
32
+ #include "SDL_main.h"
33
+ #include "SDL_stdinc.h"
34
+ #include "SDL_assert.h"
35
+ #include "SDL_atomic.h"
36
+ #include "SDL_audio.h"
37
+ #include "SDL_clipboard.h"
38
+ #include "SDL_cpuinfo.h"
39
+ #include "SDL_endian.h"
40
+ #include "SDL_error.h"
41
+ #include "SDL_events.h"
42
+ #include "SDL_filesystem.h"
43
+ #include "SDL_gamecontroller.h"
44
+ #include "SDL_haptic.h"
45
+ #include "SDL_hints.h"
46
+ #include "SDL_joystick.h"
47
+ #include "SDL_loadso.h"
48
+ #include "SDL_log.h"
49
+ #include "SDL_messagebox.h"
50
+ #include "SDL_mutex.h"
51
+ #include "SDL_power.h"
52
+ #include "SDL_render.h"
53
+ #include "SDL_rwops.h"
54
+ #include "SDL_sensor.h"
55
+ #include "SDL_shape.h"
56
+ #include "SDL_system.h"
57
+ #include "SDL_thread.h"
58
+ #include "SDL_timer.h"
59
+ #include "SDL_version.h"
60
+ #include "SDL_video.h"
61
+
62
+ #include "begin_code.h"
63
+ /* Set up for C function definitions, even when using C++ */
64
+ #ifdef __cplusplus
65
+ extern "C" {
66
+ #endif
67
+
68
+ /* As of version 0.5, SDL is loaded dynamically into the application */
69
+
70
+ /**
71
+ * \name SDL_INIT_*
72
+ *
73
+ * These are the flags which may be passed to SDL_Init(). You should
74
+ * specify the subsystems which you will be using in your application.
75
+ */
76
+ /* @{ */
77
+ #define SDL_INIT_TIMER 0x00000001u
78
+ #define SDL_INIT_AUDIO 0x00000010u
79
+ #define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
80
+ #define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
81
+ #define SDL_INIT_HAPTIC 0x00001000u
82
+ #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
83
+ #define SDL_INIT_EVENTS 0x00004000u
84
+ #define SDL_INIT_SENSOR 0x00008000u
85
+ #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
86
+ #define SDL_INIT_EVERYTHING ( \
87
+ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
88
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
89
+ )
90
+ /* @} */
91
+
92
+ /**
93
+ * This function initializes the subsystems specified by \c flags
94
+ */
95
+ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
96
+
97
+ /**
98
+ * This function initializes specific SDL subsystems
99
+ *
100
+ * Subsystem initialization is ref-counted, you must call
101
+ * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
102
+ * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
103
+ * If a subsystem is already loaded then this call will
104
+ * increase the ref-count and return.
105
+ */
106
+ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
107
+
108
+ /**
109
+ * This function cleans up specific SDL subsystems
110
+ */
111
+ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
112
+
113
+ /**
114
+ * This function returns a mask of the specified subsystems which have
115
+ * previously been initialized.
116
+ *
117
+ * If \c flags is 0, it returns a mask of all initialized subsystems.
118
+ */
119
+ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
120
+
121
+ /**
122
+ * This function cleans up all initialized subsystems. You should
123
+ * call it upon all exit conditions.
124
+ */
125
+ extern DECLSPEC void SDLCALL SDL_Quit(void);
126
+
127
+ /* Ends C function definitions when using C++ */
128
+ #ifdef __cplusplus
129
+ }
130
+ #endif
131
+ #include "close_code.h"
132
+
133
+ #endif /* SDL_h_ */
134
+
135
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,291 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 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_assert_h_
23
+ #define SDL_assert_h_
24
+
25
+ #include "SDL_config.h"
26
+
27
+ #include "begin_code.h"
28
+ /* Set up for C function definitions, even when using C++ */
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+
33
+ #ifndef SDL_ASSERT_LEVEL
34
+ #ifdef SDL_DEFAULT_ASSERT_LEVEL
35
+ #define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
36
+ #elif defined(_DEBUG) || defined(DEBUG) || \
37
+ (defined(__GNUC__) && !defined(__OPTIMIZE__))
38
+ #define SDL_ASSERT_LEVEL 2
39
+ #else
40
+ #define SDL_ASSERT_LEVEL 1
41
+ #endif
42
+ #endif /* SDL_ASSERT_LEVEL */
43
+
44
+ /*
45
+ These are macros and not first class functions so that the debugger breaks
46
+ on the assertion line and not in some random guts of SDL, and so each
47
+ assert can have unique static variables associated with it.
48
+ */
49
+
50
+ #if defined(_MSC_VER)
51
+ /* Don't include intrin.h here because it contains C++ code */
52
+ extern void __cdecl __debugbreak(void);
53
+ #define SDL_TriggerBreakpoint() __debugbreak()
54
+ #elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
55
+ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
56
+ #elif defined(__386__) && defined(__WATCOMC__)
57
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
58
+ #elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
59
+ #include <signal.h>
60
+ #define SDL_TriggerBreakpoint() raise(SIGTRAP)
61
+ #else
62
+ /* How do we trigger breakpoints on this platform? */
63
+ #define SDL_TriggerBreakpoint()
64
+ #endif
65
+
66
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
67
+ # define SDL_FUNCTION __func__
68
+ #elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
69
+ # define SDL_FUNCTION __FUNCTION__
70
+ #else
71
+ # define SDL_FUNCTION "???"
72
+ #endif
73
+ #define SDL_FILE __FILE__
74
+ #define SDL_LINE __LINE__
75
+
76
+ /*
77
+ sizeof (x) makes the compiler still parse the expression even without
78
+ assertions enabled, so the code is always checked at compile time, but
79
+ doesn't actually generate code for it, so there are no side effects or
80
+ expensive checks at run time, just the constant size of what x WOULD be,
81
+ which presumably gets optimized out as unused.
82
+ This also solves the problem of...
83
+
84
+ int somevalue = blah();
85
+ SDL_assert(somevalue == 1);
86
+
87
+ ...which would cause compiles to complain that somevalue is unused if we
88
+ disable assertions.
89
+ */
90
+
91
+ /* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
92
+ this condition isn't constant. And looks like an owl's face! */
93
+ #ifdef _MSC_VER /* stupid /W4 warnings. */
94
+ #define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
95
+ #else
96
+ #define SDL_NULL_WHILE_LOOP_CONDITION (0)
97
+ #endif
98
+
99
+ #define SDL_disabled_assert(condition) \
100
+ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
101
+
102
+ typedef enum
103
+ {
104
+ SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
105
+ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
106
+ SDL_ASSERTION_ABORT, /**< Terminate the program. */
107
+ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
108
+ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
109
+ } SDL_AssertState;
110
+
111
+ typedef struct SDL_AssertData
112
+ {
113
+ int always_ignore;
114
+ unsigned int trigger_count;
115
+ const char *condition;
116
+ const char *filename;
117
+ int linenum;
118
+ const char *function;
119
+ const struct SDL_AssertData *next;
120
+ } SDL_AssertData;
121
+
122
+ #if (SDL_ASSERT_LEVEL > 0)
123
+
124
+ /* Never call this directly. Use the SDL_assert* macros. */
125
+ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
126
+ const char *,
127
+ const char *, int)
128
+ #if defined(__clang__)
129
+ #if __has_feature(attribute_analyzer_noreturn)
130
+ /* this tells Clang's static analysis that we're a custom assert function,
131
+ and that the analyzer should assume the condition was always true past this
132
+ SDL_assert test. */
133
+ __attribute__((analyzer_noreturn))
134
+ #endif
135
+ #endif
136
+ ;
137
+
138
+ /* the do {} while(0) avoids dangling else problems:
139
+ if (x) SDL_assert(y); else blah();
140
+ ... without the do/while, the "else" could attach to this macro's "if".
141
+ We try to handle just the minimum we need here in a macro...the loop,
142
+ the static vars, and break points. The heavy lifting is handled in
143
+ SDL_ReportAssertion(), in SDL_assert.c.
144
+ */
145
+ #define SDL_enabled_assert(condition) \
146
+ do { \
147
+ while ( !(condition) ) { \
148
+ static struct SDL_AssertData sdl_assert_data = { \
149
+ 0, 0, #condition, 0, 0, 0, 0 \
150
+ }; \
151
+ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
152
+ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
153
+ continue; /* go again. */ \
154
+ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
155
+ SDL_TriggerBreakpoint(); \
156
+ } \
157
+ break; /* not retrying. */ \
158
+ } \
159
+ } while (SDL_NULL_WHILE_LOOP_CONDITION)
160
+
161
+ #endif /* enabled assertions support code */
162
+
163
+ /* Enable various levels of assertions. */
164
+ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
165
+ # define SDL_assert(condition) SDL_disabled_assert(condition)
166
+ # define SDL_assert_release(condition) SDL_disabled_assert(condition)
167
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
168
+ #elif SDL_ASSERT_LEVEL == 1 /* release settings. */
169
+ # define SDL_assert(condition) SDL_disabled_assert(condition)
170
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
171
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
172
+ #elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
173
+ # define SDL_assert(condition) SDL_enabled_assert(condition)
174
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
175
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
176
+ #elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
177
+ # define SDL_assert(condition) SDL_enabled_assert(condition)
178
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
179
+ # define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
180
+ #else
181
+ # error Unknown assertion level.
182
+ #endif
183
+
184
+ /* this assertion is never disabled at any level. */
185
+ #define SDL_assert_always(condition) SDL_enabled_assert(condition)
186
+
187
+
188
+ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
189
+ const SDL_AssertData* data, void* userdata);
190
+
191
+ /**
192
+ * \brief Set an application-defined assertion handler.
193
+ *
194
+ * This allows an app to show its own assertion UI and/or force the
195
+ * response to an assertion failure. If the app doesn't provide this, SDL
196
+ * will try to do the right thing, popping up a system-specific GUI dialog,
197
+ * and probably minimizing any fullscreen windows.
198
+ *
199
+ * This callback may fire from any thread, but it runs wrapped in a mutex, so
200
+ * it will only fire from one thread at a time.
201
+ *
202
+ * Setting the callback to NULL restores SDL's original internal handler.
203
+ *
204
+ * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
205
+ *
206
+ * Return SDL_AssertState value of how to handle the assertion failure.
207
+ *
208
+ * \param handler Callback function, called when an assertion fails.
209
+ * \param userdata A pointer passed to the callback as-is.
210
+ */
211
+ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
212
+ SDL_AssertionHandler handler,
213
+ void *userdata);
214
+
215
+ /**
216
+ * \brief Get the default assertion handler.
217
+ *
218
+ * This returns the function pointer that is called by default when an
219
+ * assertion is triggered. This is an internal function provided by SDL,
220
+ * that is used for assertions when SDL_SetAssertionHandler() hasn't been
221
+ * used to provide a different function.
222
+ *
223
+ * \return The default SDL_AssertionHandler that is called when an assert triggers.
224
+ */
225
+ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
226
+
227
+ /**
228
+ * \brief Get the current assertion handler.
229
+ *
230
+ * This returns the function pointer that is called when an assertion is
231
+ * triggered. This is either the value last passed to
232
+ * SDL_SetAssertionHandler(), or if no application-specified function is
233
+ * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
234
+ *
235
+ * \param puserdata Pointer to a void*, which will store the "userdata"
236
+ * pointer that was passed to SDL_SetAssertionHandler().
237
+ * This value will always be NULL for the default handler.
238
+ * If you don't care about this data, it is safe to pass
239
+ * a NULL pointer to this function to ignore it.
240
+ * \return The SDL_AssertionHandler that is called when an assert triggers.
241
+ */
242
+ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
243
+
244
+ /**
245
+ * \brief Get a list of all assertion failures.
246
+ *
247
+ * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
248
+ * or the start of the program.
249
+ *
250
+ * The proper way to examine this data looks something like this:
251
+ *
252
+ * <code>
253
+ * const SDL_AssertData *item = SDL_GetAssertionReport();
254
+ * while (item) {
255
+ * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
256
+ * item->condition, item->function, item->filename,
257
+ * item->linenum, item->trigger_count,
258
+ * item->always_ignore ? "yes" : "no");
259
+ * item = item->next;
260
+ * }
261
+ * </code>
262
+ *
263
+ * \return List of all assertions.
264
+ * \sa SDL_ResetAssertionReport
265
+ */
266
+ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
267
+
268
+ /**
269
+ * \brief Reset the list of all assertion failures.
270
+ *
271
+ * Reset list of all assertions triggered.
272
+ *
273
+ * \sa SDL_GetAssertionReport
274
+ */
275
+ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
276
+
277
+
278
+ /* these had wrong naming conventions until 2.0.4. Please update your app! */
279
+ #define SDL_assert_state SDL_AssertState
280
+ #define SDL_assert_data SDL_AssertData
281
+
282
+
283
+ /* Ends C function definitions when using C++ */
284
+ #ifdef __cplusplus
285
+ }
286
+ #endif
287
+ #include "close_code.h"
288
+
289
+ #endif /* SDL_assert_h_ */
290
+
291
+ /* vi: set ts=4 sw=4 expandtab: */