gosu 0.15.0 → 1.0.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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/COPYING +1 -1
  4. data/dependencies/SDL/include/SDL.h +138 -0
  5. data/dependencies/SDL/include/SDL_assert.h +293 -0
  6. data/dependencies/SDL/include/SDL_atomic.h +295 -0
  7. data/dependencies/SDL/include/SDL_audio.h +859 -0
  8. data/dependencies/SDL/include/SDL_bits.h +121 -0
  9. data/dependencies/SDL/include/SDL_blendmode.h +123 -0
  10. data/dependencies/SDL/include/SDL_clipboard.h +71 -0
  11. data/dependencies/SDL/include/SDL_config.h +55 -0
  12. data/dependencies/SDL/include/SDL_config_android.h +182 -0
  13. data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
  14. data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
  15. data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
  16. data/dependencies/SDL/include/SDL_config_os2.h +188 -0
  17. data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
  18. data/dependencies/SDL/include/SDL_config_psp.h +165 -0
  19. data/dependencies/SDL/include/SDL_config_windows.h +288 -0
  20. data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
  21. data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
  22. data/dependencies/SDL/include/SDL_copying.h +20 -0
  23. data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
  24. data/dependencies/SDL/include/SDL_egl.h +1676 -0
  25. data/dependencies/SDL/include/SDL_endian.h +263 -0
  26. data/dependencies/SDL/include/SDL_error.h +112 -0
  27. data/dependencies/SDL/include/SDL_events.h +827 -0
  28. data/dependencies/SDL/include/SDL_filesystem.h +136 -0
  29. data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
  30. data/dependencies/SDL/include/SDL_gesture.h +87 -0
  31. data/dependencies/SDL/include/SDL_haptic.h +1247 -0
  32. data/dependencies/SDL/include/SDL_hints.h +1578 -0
  33. data/dependencies/SDL/include/SDL_joystick.h +499 -0
  34. data/dependencies/SDL/include/SDL_keyboard.h +217 -0
  35. data/dependencies/SDL/include/SDL_keycode.h +351 -0
  36. data/dependencies/SDL/include/SDL_loadso.h +81 -0
  37. data/dependencies/SDL/include/SDL_locale.h +101 -0
  38. data/dependencies/SDL/include/SDL_log.h +211 -0
  39. data/dependencies/SDL/include/SDL_main.h +180 -0
  40. data/dependencies/SDL/include/SDL_messagebox.h +146 -0
  41. data/dependencies/SDL/include/SDL_metal.h +117 -0
  42. data/dependencies/SDL/include/SDL_misc.h +75 -0
  43. data/dependencies/SDL/include/SDL_mouse.h +302 -0
  44. data/dependencies/SDL/include/SDL_mutex.h +251 -0
  45. data/dependencies/SDL/include/SDL_name.h +33 -0
  46. data/dependencies/SDL/include/SDL_opengl.h +2183 -0
  47. data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
  48. data/dependencies/SDL/include/SDL_opengles.h +39 -0
  49. data/dependencies/SDL/include/SDL_opengles2.h +52 -0
  50. data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
  51. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
  52. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
  53. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
  54. data/dependencies/SDL/include/SDL_pixels.h +479 -0
  55. data/dependencies/SDL/include/SDL_platform.h +198 -0
  56. data/dependencies/SDL/include/SDL_power.h +75 -0
  57. data/dependencies/SDL/include/SDL_quit.h +58 -0
  58. data/dependencies/SDL/include/SDL_rect.h +174 -0
  59. data/dependencies/SDL/include/SDL_render.h +1158 -0
  60. data/dependencies/SDL/include/SDL_revision.h +2 -0
  61. data/dependencies/SDL/include/SDL_rwops.h +283 -0
  62. data/dependencies/SDL/include/SDL_scancode.h +413 -0
  63. data/dependencies/SDL/include/SDL_sensor.h +267 -0
  64. data/dependencies/SDL/include/SDL_shape.h +144 -0
  65. data/dependencies/SDL/include/SDL_stdinc.h +647 -0
  66. data/dependencies/SDL/include/SDL_surface.h +563 -0
  67. data/dependencies/SDL/include/SDL_system.h +325 -0
  68. data/dependencies/SDL/include/SDL_syswm.h +354 -0
  69. data/dependencies/SDL/include/SDL_test.h +69 -0
  70. data/dependencies/SDL/include/SDL_test_assert.h +105 -0
  71. data/dependencies/SDL/include/SDL_test_common.h +218 -0
  72. data/dependencies/SDL/include/SDL_test_compare.h +69 -0
  73. data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
  74. data/dependencies/SDL/include/SDL_test_font.h +81 -0
  75. data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
  76. data/dependencies/SDL/include/SDL_test_harness.h +134 -0
  77. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  78. data/dependencies/SDL/include/SDL_test_log.h +67 -0
  79. data/dependencies/SDL/include/SDL_test_md5.h +129 -0
  80. data/dependencies/SDL/include/SDL_test_memory.h +63 -0
  81. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  82. data/dependencies/SDL/include/SDL_thread.h +366 -0
  83. data/dependencies/SDL/include/SDL_timer.h +115 -0
  84. data/dependencies/SDL/include/SDL_touch.h +102 -0
  85. data/dependencies/SDL/include/SDL_types.h +29 -0
  86. data/dependencies/SDL/include/SDL_version.h +162 -0
  87. data/dependencies/SDL/include/SDL_video.h +1282 -0
  88. data/dependencies/SDL/include/SDL_vulkan.h +276 -0
  89. data/dependencies/SDL/include/begin_code.h +166 -0
  90. data/dependencies/SDL/include/close_code.h +40 -0
  91. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  92. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  93. data/dependencies/SDL_sound/SDL_sound.c +795 -0
  94. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  95. data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
  96. data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
  97. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
  98. data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
  99. data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
  100. data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
  101. data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
  102. data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
  103. data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
  104. data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
  105. data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
  106. data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
  107. data/dependencies/SDL_sound/dr_flac.h +5906 -0
  108. data/dependencies/SDL_sound/dr_mp3.h +2832 -0
  109. data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
  110. data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
  111. data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
  112. data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
  113. data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
  114. data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
  115. data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
  116. data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
  117. data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
  118. data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
  119. data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
  120. data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
  121. data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
  122. data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
  123. data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
  124. data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
  125. data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
  126. data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
  127. data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
  128. data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
  129. data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
  130. data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
  131. data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
  132. data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
  133. data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
  134. data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
  135. data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
  136. data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
  137. data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
  138. data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
  139. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
  140. data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
  141. data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
  142. data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
  143. data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
  144. data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
  145. data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +128 -23
  146. data/dependencies/al_soft/AL/al.h +655 -0
  147. data/dependencies/al_soft/AL/alc.h +270 -0
  148. data/dependencies/al_soft/AL/alext.h +585 -0
  149. data/dependencies/al_soft/AL/efx-creative.h +3 -0
  150. data/dependencies/al_soft/AL/efx-presets.h +402 -0
  151. data/dependencies/al_soft/AL/efx.h +762 -0
  152. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  153. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  154. data/{src → dependencies/stb}/stb_image.h +476 -176
  155. data/{src → dependencies/stb}/stb_image_write.h +253 -131
  156. data/{src → dependencies/stb}/stb_truetype.h +262 -104
  157. data/{src → dependencies/utf8proc}/utf8proc.c +47 -29
  158. data/{src → dependencies/utf8proc}/utf8proc.h +46 -24
  159. data/{src → dependencies/utf8proc}/utf8proc_data.h +10043 -9609
  160. data/ext/gosu/extconf.rb +53 -39
  161. data/{Gosu → include/Gosu}/Audio.hpp +6 -8
  162. data/include/Gosu/Bitmap.hpp +100 -0
  163. data/{Gosu → include/Gosu}/Buttons.hpp +104 -44
  164. data/include/Gosu/Channel.h +25 -0
  165. data/include/Gosu/Color.h +38 -0
  166. data/{Gosu → include/Gosu}/Color.hpp +0 -0
  167. data/{Gosu → include/Gosu}/Directories.hpp +0 -0
  168. data/include/Gosu/Font.h +36 -0
  169. data/{Gosu → include/Gosu}/Font.hpp +1 -1
  170. data/{Gosu → include/Gosu}/Fwd.hpp +0 -5
  171. data/include/Gosu/Gosu.h +82 -0
  172. data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
  173. data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
  174. data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
  175. data/{Gosu → include/Gosu}/IO.hpp +0 -0
  176. data/include/Gosu/Image.h +54 -0
  177. data/{Gosu → include/Gosu}/Image.hpp +7 -6
  178. data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
  179. data/{Gosu → include/Gosu}/Input.hpp +39 -51
  180. data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
  181. data/{Gosu → include/Gosu}/Math.hpp +0 -0
  182. data/{Gosu → include/Gosu}/Platform.hpp +0 -0
  183. data/include/Gosu/Sample.h +19 -0
  184. data/include/Gosu/Song.h +24 -0
  185. data/{Gosu → include/Gosu}/Text.hpp +0 -0
  186. data/include/Gosu/TextInput.h +30 -0
  187. data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
  188. data/{Gosu → include/Gosu}/Timing.hpp +0 -0
  189. data/{Gosu → include/Gosu}/Utility.hpp +15 -4
  190. data/{Gosu → include/Gosu}/Version.hpp +2 -2
  191. data/include/Gosu/Window.h +63 -0
  192. data/{Gosu → include/Gosu}/Window.hpp +23 -25
  193. data/lib/OpenAL32.dll +0 -0
  194. data/lib/SDL2.dll +0 -0
  195. data/lib/gosu.rb +0 -3
  196. data/lib/gosu/patches.rb +0 -23
  197. data/lib/gosu/preview.rb +1 -3
  198. data/lib/gosu/swig_patches.rb +3 -2
  199. data/lib64/OpenAL32.dll +0 -0
  200. data/lib64/SDL2.dll +0 -0
  201. data/rdoc/gosu.rb +98 -22
  202. data/src/Audio.cpp +50 -224
  203. data/src/AudioFile.hpp +20 -37
  204. data/src/AudioFileAudioToolbox.cpp +237 -0
  205. data/src/AudioFileSDLSound.cpp +147 -0
  206. data/src/AudioImpl.cpp +3 -12
  207. data/src/AudioImpl.hpp +3 -1
  208. data/src/Bitmap.cpp +85 -83
  209. data/src/BitmapIO.cpp +52 -58
  210. data/src/ChannelWrapper.cpp +50 -0
  211. data/src/ColorWrapper.cpp +126 -0
  212. data/src/Constants.cpp +338 -0
  213. data/src/Font.cpp +4 -1
  214. data/src/FontWrapper.cpp +74 -0
  215. data/src/GosuWrapper.cpp +251 -0
  216. data/src/Graphics.cpp +7 -4
  217. data/src/Image.cpp +13 -16
  218. data/src/ImageWrapper.cpp +168 -0
  219. data/src/Input.cpp +412 -164
  220. data/src/LargeImageData.cpp +2 -1
  221. data/src/MarkupParser.cpp +2 -1
  222. data/src/RubyGosu.cxx +912 -172
  223. data/src/RubyGosu.h +4 -2
  224. data/src/SampleWrapper.cpp +30 -0
  225. data/src/SongWrapper.cpp +52 -0
  226. data/src/TexChunk.cpp +1 -1
  227. data/src/Text.cpp +1 -0
  228. data/src/TextBuilder.cpp +3 -1
  229. data/src/TextInputWrapper.cpp +101 -0
  230. data/src/Texture.cpp +1 -1
  231. data/src/TrueTypeFont.cpp +2 -1
  232. data/src/Utility.cpp +11 -7
  233. data/src/Window.cpp +30 -39
  234. data/src/WindowWrapper.cpp +317 -0
  235. metadata +212 -43
  236. data/Gosu/AutoLink.hpp +0 -14
  237. data/Gosu/Bitmap.hpp +0 -113
  238. data/lib/gosu/zen.rb +0 -89
  239. data/src/AudioToolboxFile.hpp +0 -210
  240. data/src/OggFile.hpp +0 -92
  241. data/src/SndFile.hpp +0 -174
  242. data/src/WinMain.cpp +0 -64
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ba5fe75439828dc20ce57aaeca27e464ae1aba262f743febf5405fc6fac738b
4
- data.tar.gz: 7f7b333a69fb3435ebc09c3c6b2c7ebd647f68cdc2b689d85a13bd6e66583241
3
+ metadata.gz: 9c9b393a63015707256dca78e9079b01dbc004d85b89c6bf68d021085f65a905
4
+ data.tar.gz: 60396892082e2fa81a7ab03f8662fe00630745f84b1e0a47e9abcd7bed5c7692
5
5
  SHA512:
6
- metadata.gz: 266afe66c7524c6b0efaca9c7c0eef37494c33f27bc896c2d6777ef8bbe86d2238ebb1c4866ad6a599f9e3d9a56a8304fe2c47b8c58e6295707152571828c5a6
7
- data.tar.gz: '0038955bca0bbaa7bc374aa389abc4416786fe900b6eb9011db60194c1129b9823bdc6df896f4a929fde5258f0d0ddac746e0d8f44b3bff8617e3dacaedc89dc'
6
+ metadata.gz: fb477140be8f524abfeb3694277bd815690c4c0ae432ac011956a43640f49309aca3c0a9b3619c17cc83461ae5c9c9b6fb1bfa155e72f1be19b4f166e23b3022
7
+ data.tar.gz: 24707e94f193a4fe949a447a01b732057860eb271a8a0d61ba6c45a0b1b5da8c2894ffc65d3ff3fe2b97fe7e8b9c5b38b9995d4d443d014fe6059f520f900393
@@ -0,0 +1 @@
1
+ rdoc/gosu.rb - README.md COPYING
data/COPYING CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2001-2019 Julian Raschke, Jan Lücker and all contributors.
1
+ Copyright (C) 2001-2020 Julian Raschke, Jan Lücker and all contributors.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a
4
4
  copy of this software and associated documentation files (the "Software"),
@@ -0,0 +1,138 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL.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_metal.h"
51
+ #include "SDL_mutex.h"
52
+ #include "SDL_power.h"
53
+ #include "SDL_render.h"
54
+ #include "SDL_rwops.h"
55
+ #include "SDL_sensor.h"
56
+ #include "SDL_shape.h"
57
+ #include "SDL_system.h"
58
+ #include "SDL_thread.h"
59
+ #include "SDL_timer.h"
60
+ #include "SDL_version.h"
61
+ #include "SDL_video.h"
62
+ #include "SDL_locale.h"
63
+ #include "SDL_misc.h"
64
+
65
+ #include "begin_code.h"
66
+ /* Set up for C function definitions, even when using C++ */
67
+ #ifdef __cplusplus
68
+ extern "C" {
69
+ #endif
70
+
71
+ /* As of version 0.5, SDL is loaded dynamically into the application */
72
+
73
+ /**
74
+ * \name SDL_INIT_*
75
+ *
76
+ * These are the flags which may be passed to SDL_Init(). You should
77
+ * specify the subsystems which you will be using in your application.
78
+ */
79
+ /* @{ */
80
+ #define SDL_INIT_TIMER 0x00000001u
81
+ #define SDL_INIT_AUDIO 0x00000010u
82
+ #define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
83
+ #define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
84
+ #define SDL_INIT_HAPTIC 0x00001000u
85
+ #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
86
+ #define SDL_INIT_EVENTS 0x00004000u
87
+ #define SDL_INIT_SENSOR 0x00008000u
88
+ #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
89
+ #define SDL_INIT_EVERYTHING ( \
90
+ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
91
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
92
+ )
93
+ /* @} */
94
+
95
+ /**
96
+ * This function initializes the subsystems specified by \c flags
97
+ */
98
+ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
99
+
100
+ /**
101
+ * This function initializes specific SDL subsystems
102
+ *
103
+ * Subsystem initialization is ref-counted, you must call
104
+ * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
105
+ * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
106
+ * If a subsystem is already loaded then this call will
107
+ * increase the ref-count and return.
108
+ */
109
+ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
110
+
111
+ /**
112
+ * This function cleans up specific SDL subsystems
113
+ */
114
+ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
115
+
116
+ /**
117
+ * This function returns a mask of the specified subsystems which have
118
+ * previously been initialized.
119
+ *
120
+ * If \c flags is 0, it returns a mask of all initialized subsystems.
121
+ */
122
+ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
123
+
124
+ /**
125
+ * This function cleans up all initialized subsystems. You should
126
+ * call it upon all exit conditions.
127
+ */
128
+ extern DECLSPEC void SDLCALL SDL_Quit(void);
129
+
130
+ /* Ends C function definitions when using C++ */
131
+ #ifdef __cplusplus
132
+ }
133
+ #endif
134
+ #include "close_code.h"
135
+
136
+ #endif /* SDL_h_ */
137
+
138
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,293 @@
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_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(__APPLE__) && defined(__arm64__) ) /* this might work on other ARM targets, but this is a known quantity... */
57
+ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
58
+ #elif defined(__386__) && defined(__WATCOMC__)
59
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
60
+ #elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
61
+ #include <signal.h>
62
+ #define SDL_TriggerBreakpoint() raise(SIGTRAP)
63
+ #else
64
+ /* How do we trigger breakpoints on this platform? */
65
+ #define SDL_TriggerBreakpoint()
66
+ #endif
67
+
68
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
69
+ # define SDL_FUNCTION __func__
70
+ #elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
71
+ # define SDL_FUNCTION __FUNCTION__
72
+ #else
73
+ # define SDL_FUNCTION "???"
74
+ #endif
75
+ #define SDL_FILE __FILE__
76
+ #define SDL_LINE __LINE__
77
+
78
+ /*
79
+ sizeof (x) makes the compiler still parse the expression even without
80
+ assertions enabled, so the code is always checked at compile time, but
81
+ doesn't actually generate code for it, so there are no side effects or
82
+ expensive checks at run time, just the constant size of what x WOULD be,
83
+ which presumably gets optimized out as unused.
84
+ This also solves the problem of...
85
+
86
+ int somevalue = blah();
87
+ SDL_assert(somevalue == 1);
88
+
89
+ ...which would cause compiles to complain that somevalue is unused if we
90
+ disable assertions.
91
+ */
92
+
93
+ /* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
94
+ this condition isn't constant. And looks like an owl's face! */
95
+ #ifdef _MSC_VER /* stupid /W4 warnings. */
96
+ #define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
97
+ #else
98
+ #define SDL_NULL_WHILE_LOOP_CONDITION (0)
99
+ #endif
100
+
101
+ #define SDL_disabled_assert(condition) \
102
+ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
103
+
104
+ typedef enum
105
+ {
106
+ SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
107
+ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
108
+ SDL_ASSERTION_ABORT, /**< Terminate the program. */
109
+ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
110
+ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
111
+ } SDL_AssertState;
112
+
113
+ typedef struct SDL_AssertData
114
+ {
115
+ int always_ignore;
116
+ unsigned int trigger_count;
117
+ const char *condition;
118
+ const char *filename;
119
+ int linenum;
120
+ const char *function;
121
+ const struct SDL_AssertData *next;
122
+ } SDL_AssertData;
123
+
124
+ #if (SDL_ASSERT_LEVEL > 0)
125
+
126
+ /* Never call this directly. Use the SDL_assert* macros. */
127
+ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
128
+ const char *,
129
+ const char *, int)
130
+ #if defined(__clang__)
131
+ #if __has_feature(attribute_analyzer_noreturn)
132
+ /* this tells Clang's static analysis that we're a custom assert function,
133
+ and that the analyzer should assume the condition was always true past this
134
+ SDL_assert test. */
135
+ __attribute__((analyzer_noreturn))
136
+ #endif
137
+ #endif
138
+ ;
139
+
140
+ /* the do {} while(0) avoids dangling else problems:
141
+ if (x) SDL_assert(y); else blah();
142
+ ... without the do/while, the "else" could attach to this macro's "if".
143
+ We try to handle just the minimum we need here in a macro...the loop,
144
+ the static vars, and break points. The heavy lifting is handled in
145
+ SDL_ReportAssertion(), in SDL_assert.c.
146
+ */
147
+ #define SDL_enabled_assert(condition) \
148
+ do { \
149
+ while ( !(condition) ) { \
150
+ static struct SDL_AssertData sdl_assert_data = { \
151
+ 0, 0, #condition, 0, 0, 0, 0 \
152
+ }; \
153
+ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
154
+ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
155
+ continue; /* go again. */ \
156
+ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
157
+ SDL_TriggerBreakpoint(); \
158
+ } \
159
+ break; /* not retrying. */ \
160
+ } \
161
+ } while (SDL_NULL_WHILE_LOOP_CONDITION)
162
+
163
+ #endif /* enabled assertions support code */
164
+
165
+ /* Enable various levels of assertions. */
166
+ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
167
+ # define SDL_assert(condition) SDL_disabled_assert(condition)
168
+ # define SDL_assert_release(condition) SDL_disabled_assert(condition)
169
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
170
+ #elif SDL_ASSERT_LEVEL == 1 /* release settings. */
171
+ # define SDL_assert(condition) SDL_disabled_assert(condition)
172
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
173
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
174
+ #elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
175
+ # define SDL_assert(condition) SDL_enabled_assert(condition)
176
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
177
+ # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
178
+ #elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
179
+ # define SDL_assert(condition) SDL_enabled_assert(condition)
180
+ # define SDL_assert_release(condition) SDL_enabled_assert(condition)
181
+ # define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
182
+ #else
183
+ # error Unknown assertion level.
184
+ #endif
185
+
186
+ /* this assertion is never disabled at any level. */
187
+ #define SDL_assert_always(condition) SDL_enabled_assert(condition)
188
+
189
+
190
+ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
191
+ const SDL_AssertData* data, void* userdata);
192
+
193
+ /**
194
+ * \brief Set an application-defined assertion handler.
195
+ *
196
+ * This allows an app to show its own assertion UI and/or force the
197
+ * response to an assertion failure. If the app doesn't provide this, SDL
198
+ * will try to do the right thing, popping up a system-specific GUI dialog,
199
+ * and probably minimizing any fullscreen windows.
200
+ *
201
+ * This callback may fire from any thread, but it runs wrapped in a mutex, so
202
+ * it will only fire from one thread at a time.
203
+ *
204
+ * Setting the callback to NULL restores SDL's original internal handler.
205
+ *
206
+ * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
207
+ *
208
+ * Return SDL_AssertState value of how to handle the assertion failure.
209
+ *
210
+ * \param handler Callback function, called when an assertion fails.
211
+ * \param userdata A pointer passed to the callback as-is.
212
+ */
213
+ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
214
+ SDL_AssertionHandler handler,
215
+ void *userdata);
216
+
217
+ /**
218
+ * \brief Get the default assertion handler.
219
+ *
220
+ * This returns the function pointer that is called by default when an
221
+ * assertion is triggered. This is an internal function provided by SDL,
222
+ * that is used for assertions when SDL_SetAssertionHandler() hasn't been
223
+ * used to provide a different function.
224
+ *
225
+ * \return The default SDL_AssertionHandler that is called when an assert triggers.
226
+ */
227
+ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
228
+
229
+ /**
230
+ * \brief Get the current assertion handler.
231
+ *
232
+ * This returns the function pointer that is called when an assertion is
233
+ * triggered. This is either the value last passed to
234
+ * SDL_SetAssertionHandler(), or if no application-specified function is
235
+ * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
236
+ *
237
+ * \param puserdata Pointer to a void*, which will store the "userdata"
238
+ * pointer that was passed to SDL_SetAssertionHandler().
239
+ * This value will always be NULL for the default handler.
240
+ * If you don't care about this data, it is safe to pass
241
+ * a NULL pointer to this function to ignore it.
242
+ * \return The SDL_AssertionHandler that is called when an assert triggers.
243
+ */
244
+ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
245
+
246
+ /**
247
+ * \brief Get a list of all assertion failures.
248
+ *
249
+ * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
250
+ * or the start of the program.
251
+ *
252
+ * The proper way to examine this data looks something like this:
253
+ *
254
+ * <code>
255
+ * const SDL_AssertData *item = SDL_GetAssertionReport();
256
+ * while (item) {
257
+ * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
258
+ * item->condition, item->function, item->filename,
259
+ * item->linenum, item->trigger_count,
260
+ * item->always_ignore ? "yes" : "no");
261
+ * item = item->next;
262
+ * }
263
+ * </code>
264
+ *
265
+ * \return List of all assertions.
266
+ * \sa SDL_ResetAssertionReport
267
+ */
268
+ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
269
+
270
+ /**
271
+ * \brief Reset the list of all assertion failures.
272
+ *
273
+ * Reset list of all assertions triggered.
274
+ *
275
+ * \sa SDL_GetAssertionReport
276
+ */
277
+ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
278
+
279
+
280
+ /* these had wrong naming conventions until 2.0.4. Please update your app! */
281
+ #define SDL_assert_state SDL_AssertState
282
+ #define SDL_assert_data SDL_AssertData
283
+
284
+
285
+ /* Ends C function definitions when using C++ */
286
+ #ifdef __cplusplus
287
+ }
288
+ #endif
289
+ #include "close_code.h"
290
+
291
+ #endif /* SDL_assert_h_ */
292
+
293
+ /* vi: set ts=4 sw=4 expandtab: */