ruby2d 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/assets/README.md +7 -8
  3. data/assets/Rakefile +85 -0
  4. data/assets/include/SDL2/SDL.h +4 -1
  5. data/assets/include/SDL2/SDL_assert.h +3 -1
  6. data/assets/include/SDL2/SDL_atomic.h +20 -2
  7. data/assets/include/SDL2/SDL_audio.h +47 -14
  8. data/assets/include/SDL2/SDL_bits.h +10 -1
  9. data/assets/include/SDL2/SDL_blendmode.h +10 -7
  10. data/assets/include/SDL2/SDL_clipboard.h +1 -1
  11. data/assets/include/SDL2/SDL_config.h +24 -390
  12. data/assets/include/SDL2/SDL_config_android.h +182 -0
  13. data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
  14. data/assets/include/SDL2/SDL_config_macosx.h +266 -0
  15. data/assets/include/SDL2/SDL_config_minimal.h +85 -0
  16. data/assets/include/SDL2/SDL_config_os2.h +188 -0
  17. data/assets/include/SDL2/SDL_config_pandora.h +135 -0
  18. data/assets/include/SDL2/SDL_config_psp.h +165 -0
  19. data/assets/include/SDL2/SDL_config_windows.h +288 -0
  20. data/assets/include/SDL2/SDL_config_winrt.h +243 -0
  21. data/assets/include/SDL2/SDL_config_wiz.h +149 -0
  22. data/assets/include/SDL2/SDL_copying.h +20 -0
  23. data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
  24. data/assets/include/SDL2/SDL_egl.h +4 -1
  25. data/assets/include/SDL2/SDL_endian.h +6 -3
  26. data/assets/include/SDL2/SDL_error.h +38 -2
  27. data/assets/include/SDL2/SDL_events.h +67 -28
  28. data/assets/include/SDL2/SDL_filesystem.h +1 -1
  29. data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
  30. data/assets/include/SDL2/SDL_gesture.h +1 -1
  31. data/assets/include/SDL2/SDL_haptic.h +10 -1
  32. data/assets/include/SDL2/SDL_hints.h +460 -17
  33. data/assets/include/SDL2/SDL_image.h +2 -2
  34. data/assets/include/SDL2/SDL_joystick.h +115 -24
  35. data/assets/include/SDL2/SDL_keyboard.h +1 -1
  36. data/assets/include/SDL2/SDL_keycode.h +11 -9
  37. data/assets/include/SDL2/SDL_loadso.h +1 -1
  38. data/assets/include/SDL2/SDL_locale.h +101 -0
  39. data/assets/include/SDL2/SDL_log.h +3 -3
  40. data/assets/include/SDL2/SDL_main.h +28 -16
  41. data/assets/include/SDL2/SDL_messagebox.h +6 -4
  42. data/assets/include/SDL2/SDL_metal.h +117 -0
  43. data/assets/include/SDL2/SDL_misc.h +75 -0
  44. data/assets/include/SDL2/SDL_mouse.h +1 -1
  45. data/assets/include/SDL2/SDL_mutex.h +1 -1
  46. data/assets/include/SDL2/SDL_name.h +1 -1
  47. data/assets/include/SDL2/SDL_opengl.h +1 -1
  48. data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
  49. data/assets/include/SDL2/SDL_opengles.h +1 -1
  50. data/assets/include/SDL2/SDL_opengles2.h +1 -1
  51. data/assets/include/SDL2/SDL_pixels.h +27 -18
  52. data/assets/include/SDL2/SDL_platform.h +1 -1
  53. data/assets/include/SDL2/SDL_power.h +1 -1
  54. data/assets/include/SDL2/SDL_quit.h +1 -1
  55. data/assets/include/SDL2/SDL_rect.h +29 -3
  56. data/assets/include/SDL2/SDL_render.h +230 -3
  57. data/assets/include/SDL2/SDL_revision.h +2 -2
  58. data/assets/include/SDL2/SDL_rwops.h +51 -22
  59. data/assets/include/SDL2/SDL_scancode.h +2 -2
  60. data/assets/include/SDL2/SDL_sensor.h +28 -12
  61. data/assets/include/SDL2/SDL_shape.h +1 -1
  62. data/assets/include/SDL2/SDL_stdinc.h +44 -4
  63. data/assets/include/SDL2/SDL_surface.h +12 -2
  64. data/assets/include/SDL2/SDL_system.h +50 -4
  65. data/assets/include/SDL2/SDL_syswm.h +39 -9
  66. data/assets/include/SDL2/SDL_test.h +1 -1
  67. data/assets/include/SDL2/SDL_test_assert.h +1 -1
  68. data/assets/include/SDL2/SDL_test_common.h +32 -2
  69. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  70. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  71. data/assets/include/SDL2/SDL_test_font.h +1 -1
  72. data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
  73. data/assets/include/SDL2/SDL_test_harness.h +1 -1
  74. data/assets/include/SDL2/SDL_test_images.h +1 -1
  75. data/assets/include/SDL2/SDL_test_log.h +1 -1
  76. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  77. data/assets/include/SDL2/SDL_test_memory.h +3 -3
  78. data/assets/include/SDL2/SDL_test_random.h +1 -1
  79. data/assets/include/SDL2/SDL_thread.h +34 -11
  80. data/assets/include/SDL2/SDL_timer.h +1 -1
  81. data/assets/include/SDL2/SDL_touch.h +17 -1
  82. data/assets/include/SDL2/SDL_types.h +1 -1
  83. data/assets/include/SDL2/SDL_version.h +2 -2
  84. data/assets/include/SDL2/SDL_video.h +11 -5
  85. data/assets/include/SDL2/SDL_vulkan.h +9 -11
  86. data/assets/include/SDL2/begin_code.h +8 -9
  87. data/assets/include/SDL2/close_code.h +4 -1
  88. data/assets/macos/lib/libFLAC.a +0 -0
  89. data/assets/macos/lib/libSDL2.a +0 -0
  90. data/assets/macos/lib/libSDL2_image.a +0 -0
  91. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  92. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  93. data/assets/macos/lib/libfreetype.a +0 -0
  94. data/assets/macos/lib/libjpeg.a +0 -0
  95. data/assets/macos/lib/libmpg123.a +0 -0
  96. data/assets/macos/lib/libogg.a +0 -0
  97. data/assets/macos/lib/libpng16.a +0 -0
  98. data/assets/macos/lib/libtiff.a +0 -0
  99. data/assets/macos/lib/libvorbis.a +0 -0
  100. data/assets/macos/lib/libvorbisfile.a +0 -0
  101. data/assets/macos/lib/libwebp.a +0 -0
  102. data/assets/mingw/bin/SDL2.dll +0 -0
  103. data/assets/mingw/bin/SDL2_image.dll +0 -0
  104. data/assets/mingw/bin/libpng16-16.dll +0 -0
  105. data/assets/mingw/bin/libtiff-5.dll +0 -0
  106. data/assets/mingw/bin/libwebp-7.dll +0 -0
  107. data/assets/mingw/lib/libSDL2.a +0 -0
  108. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  109. data/assets/mingw/lib/libSDL2_image.a +0 -0
  110. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  111. data/assets/mingw/lib/libSDL2_test.a +0 -0
  112. data/assets/mingw/lib/libSDL2main.a +0 -0
  113. data/bin/ruby2d +2 -1
  114. data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
  115. data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
  116. data/ext/ruby2d/extconf.rb +6 -36
  117. data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +106 -85
  118. data/{assets/linux/simple2d/src → ext/ruby2d}/gl2.c +35 -20
  119. data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +146 -58
  120. data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +41 -26
  121. data/{assets/linux/simple2d/src → ext/ruby2d}/image.c +16 -16
  122. data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
  123. data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
  124. data/ext/ruby2d/ruby2d.c +427 -290
  125. data/ext/ruby2d/ruby2d.h +789 -0
  126. data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
  127. data/ext/ruby2d/sound.c +118 -0
  128. data/{assets/linux/simple2d/src → ext/ruby2d}/sprite.c +16 -16
  129. data/{assets/linux/simple2d/src → ext/ruby2d}/text.c +22 -22
  130. data/ext/ruby2d/tileset.c +30 -0
  131. data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +71 -60
  132. data/lib/ruby2d.rb +5 -2
  133. data/lib/ruby2d/circle.rb +18 -2
  134. data/lib/ruby2d/cli/build.rb +3 -8
  135. data/lib/ruby2d/cli/colorize.rb +10 -0
  136. data/lib/ruby2d/dsl.rb +16 -9
  137. data/lib/ruby2d/entity.rb +17 -0
  138. data/lib/ruby2d/font.rb +4 -3
  139. data/lib/ruby2d/image.rb +24 -1
  140. data/lib/ruby2d/line.rb +20 -0
  141. data/lib/ruby2d/music.rb +5 -0
  142. data/lib/ruby2d/pixel.rb +17 -0
  143. data/lib/ruby2d/quad.rb +18 -0
  144. data/lib/ruby2d/rectangle.rb +11 -2
  145. data/lib/ruby2d/renderable.rb +4 -8
  146. data/lib/ruby2d/sound.rb +5 -0
  147. data/lib/ruby2d/sprite.rb +35 -3
  148. data/lib/ruby2d/square.rb +9 -0
  149. data/lib/ruby2d/text.rb +22 -1
  150. data/lib/ruby2d/tileset.rb +69 -0
  151. data/lib/ruby2d/triangle.rb +16 -0
  152. data/lib/ruby2d/version.rb +1 -1
  153. data/lib/ruby2d/window.rb +249 -22
  154. metadata +41 -27
  155. data/assets/include/simple2d.h +0 -735
  156. data/assets/linux/simple2d/Makefile +0 -250
  157. data/assets/linux/simple2d/bin/simple2d.sh +0 -1249
  158. data/assets/linux/simple2d/include/simple2d.h +0 -735
  159. data/assets/linux/simple2d/src/sound.c +0 -56
  160. data/assets/macos/lib/libsimple2d.a +0 -0
  161. data/assets/mingw/lib/libsimple2d.a +0 -0
  162. data/lib/ruby2d/colorize.rb +0 -10
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -140,11 +140,30 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
140
140
  */
141
141
  int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
142
142
 
143
+
144
+ /**
145
+ * \brief Logs command line usage info.
146
+ *
147
+ * This logs the appropriate command line options for the subsystems in use
148
+ * plus other common options, and then any application-specific options.
149
+ * This uses the SDL_Log() function and splits up output to be friendly to
150
+ * 80-character-wide terminals.
151
+ *
152
+ * \param state The common state describing the test window for the app.
153
+ * \param argv0 argv[0], as passed to main/SDL_main.
154
+ * \param options an array of strings for application specific options. The last element of the array should be NULL.
155
+ */
156
+ void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
157
+
143
158
  /**
144
159
  * \brief Returns common usage information
145
160
  *
146
- * \param state The common state describing the test window to create.
161
+ * You should (probably) be using SDLTest_CommonLogUsage() instead, but this
162
+ * function remains for binary compatibility. Strings returned from this
163
+ * function are valid until SDLTest_CommonQuit() is called, in which case
164
+ * those strings' memory is freed and can no longer be used.
147
165
  *
166
+ * \param state The common state describing the test window to create.
148
167
  * \returns String with usage information
149
168
  */
150
169
  const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
@@ -158,6 +177,17 @@ const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
158
177
  */
159
178
  SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
160
179
 
180
+ /**
181
+ * \brief Easy argument handling when test app doesn't need any custom args.
182
+ *
183
+ * \param state The common state describing the test window to create.
184
+ * \param argc argc, as supplied to SDL_main
185
+ * \param argv argv, as supplied to SDL_main
186
+ *
187
+ * \returns False if app should quit, true otherwise.
188
+ */
189
+ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
190
+
161
191
  /**
162
192
  * \brief Common event handler for test windows.
163
193
  *
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -42,14 +42,14 @@ extern "C" {
42
42
  *
43
43
  * \note This should be called before any other SDL functions for complete tracking coverage
44
44
  */
45
- int SDLTest_TrackAllocations();
45
+ int SDLTest_TrackAllocations(void);
46
46
 
47
47
  /**
48
48
  * \brief Print a log of any outstanding allocations
49
49
  *
50
50
  * \note This can be called after SDL_Quit()
51
51
  */
52
- void SDLTest_LogAllocations();
52
+ void SDLTest_LogAllocations(void);
53
53
 
54
54
 
55
55
  /* Ends C function definitions when using C++ */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -54,6 +54,11 @@ typedef unsigned int SDL_TLSID;
54
54
  /**
55
55
  * The SDL thread priority.
56
56
  *
57
+ * SDL will make system changes as necessary in order to apply the thread priority.
58
+ * Code which attempts to control thread state related to priority should be aware
59
+ * that calling SDL_SetThreadPriority may alter such state.
60
+ * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior.
61
+ *
57
62
  * \note On many systems you require special privileges to set high or time critical priority.
58
63
  */
59
64
  typedef enum {
@@ -69,7 +74,7 @@ typedef enum {
69
74
  */
70
75
  typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
71
76
 
72
- #if defined(__WIN32__) && !defined(HAVE_LIBC)
77
+ #if defined(__WIN32__)
73
78
  /**
74
79
  * \file SDL_thread.h
75
80
  *
@@ -93,11 +98,18 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
93
98
  #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
94
99
  #include <process.h> /* _beginthreadex() and _endthreadex() */
95
100
 
96
- typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
101
+ typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread)
97
102
  (void *, unsigned, unsigned (__stdcall *func)(void *),
98
103
  void * /*arg*/, unsigned, unsigned * /* threadID */);
99
104
  typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
100
105
 
106
+ #ifndef SDL_beginthread
107
+ #define SDL_beginthread _beginthreadex
108
+ #endif
109
+ #ifndef SDL_endthread
110
+ #define SDL_endthread _endthreadex
111
+ #endif
112
+
101
113
  /**
102
114
  * Create a thread.
103
115
  */
@@ -118,12 +130,12 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
118
130
  */
119
131
  #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
120
132
  #undef SDL_CreateThread
121
- #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
133
+ #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
122
134
  #undef SDL_CreateThreadWithStackSize
123
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
135
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
124
136
  #else
125
- #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
126
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
137
+ #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
138
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread)
127
139
  #endif
128
140
 
129
141
  #elif defined(__OS2__)
@@ -132,13 +144,23 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
132
144
  * into a dll with Watcom's runtime statically linked.
133
145
  */
134
146
  #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
147
+
135
148
  #ifndef __EMX__
136
149
  #include <process.h>
137
150
  #else
138
151
  #include <stdlib.h>
139
152
  #endif
153
+
140
154
  typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
141
155
  typedef void (*pfnSDL_CurrentEndThread)(void);
156
+
157
+ #ifndef SDL_beginthread
158
+ #define SDL_beginthread _beginthread
159
+ #endif
160
+ #ifndef SDL_endthread
161
+ #define SDL_endthread _endthread
162
+ #endif
163
+
142
164
  extern DECLSPEC SDL_Thread *SDLCALL
143
165
  SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
144
166
  pfnSDL_CurrentBeginThread pfnBeginThread,
@@ -147,14 +169,15 @@ extern DECLSPEC SDL_Thread *SDLCALL
147
169
  SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
148
170
  pfnSDL_CurrentBeginThread pfnBeginThread,
149
171
  pfnSDL_CurrentEndThread pfnEndThread);
172
+
150
173
  #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
151
174
  #undef SDL_CreateThread
152
- #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
175
+ #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
153
176
  #undef SDL_CreateThreadWithStackSize
154
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
177
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
155
178
  #else
156
- #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
157
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
179
+ #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
180
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
158
181
  #endif
159
182
 
160
183
  #else
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -41,6 +41,14 @@ extern "C" {
41
41
  typedef Sint64 SDL_TouchID;
42
42
  typedef Sint64 SDL_FingerID;
43
43
 
44
+ typedef enum
45
+ {
46
+ SDL_TOUCH_DEVICE_INVALID = -1,
47
+ SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
48
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
49
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */
50
+ } SDL_TouchDeviceType;
51
+
44
52
  typedef struct SDL_Finger
45
53
  {
46
54
  SDL_FingerID id;
@@ -52,6 +60,9 @@ typedef struct SDL_Finger
52
60
  /* Used as the device ID for mouse events simulated with touch input */
53
61
  #define SDL_TOUCH_MOUSEID ((Uint32)-1)
54
62
 
63
+ /* Used as the SDL_TouchID for touch events simulated with mouse input */
64
+ #define SDL_MOUSE_TOUCHID ((Sint64)-1)
65
+
55
66
 
56
67
  /* Function prototypes */
57
68
 
@@ -65,6 +76,11 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
65
76
  */
66
77
  extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
67
78
 
79
+ /**
80
+ * \brief Get the type of the given touch device.
81
+ */
82
+ extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
83
+
68
84
  /**
69
85
  * \brief Get the number of active fingers for a given touch device.
70
86
  */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -59,7 +59,7 @@ typedef struct SDL_version
59
59
  */
60
60
  #define SDL_MAJOR_VERSION 2
61
61
  #define SDL_MINOR_VERSION 0
62
- #define SDL_PATCHLEVEL 9
62
+ #define SDL_PATCHLEVEL 14
63
63
 
64
64
  /**
65
65
  * \brief Macro to determine SDL version program was compiled against.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -96,7 +96,6 @@ typedef struct SDL_Window SDL_Window;
96
96
  */
97
97
  typedef enum
98
98
  {
99
- /* !!! FIXME: change this to name = (1<<x). */
100
99
  SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
101
100
  SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
102
101
  SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
@@ -119,7 +118,8 @@ typedef enum
119
118
  SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
120
119
  SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
121
120
  SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
122
- SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
121
+ SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
122
+ SDL_WINDOW_METAL = 0x20000000 /**< window usable for Metal view */
123
123
  } SDL_WindowFlags;
124
124
 
125
125
  /**
@@ -175,7 +175,9 @@ typedef enum
175
175
  typedef enum
176
176
  {
177
177
  SDL_DISPLAYEVENT_NONE, /**< Never used */
178
- SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */
178
+ SDL_DISPLAYEVENT_ORIENTATION, /**< Display orientation has changed to data1 */
179
+ SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */
180
+ SDL_DISPLAYEVENT_DISCONNECTED /**< Display has been removed from the system */
179
181
  } SDL_DisplayEventID;
180
182
 
181
183
  typedef enum
@@ -485,7 +487,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
485
487
  * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
486
488
  * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
487
489
  * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
488
- * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
490
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN
491
+ * ::SDL_WINDOW_METAL.
489
492
  *
490
493
  * \return The created window, or NULL if window creation failed.
491
494
  *
@@ -504,6 +507,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
504
507
  * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
505
508
  * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
506
509
  *
510
+ * If SDL_WINDOW_METAL is specified on an OS that does not support Metal,
511
+ * SDL_CreateWindow() will fail.
512
+ *
507
513
  * \note On non-Apple devices, SDL requires you to either not link to the
508
514
  * Vulkan loader or link to a dynamic library version. This limitation
509
515
  * may be removed in a future version of SDL.
@@ -98,8 +98,8 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
98
98
  * applications to link with libvulkan (and historically MoltenVK was
99
99
  * provided as a static library). If it is not found then, on macOS, SDL
100
100
  * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
101
- * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order.
102
- * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications
101
+ * followed by \c libvulkan.dylib, in that order.
102
+ * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications
103
103
  * using a dynamic framework or .dylib must ensure it is included in its
104
104
  * application bundle.
105
105
  *
@@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
153
153
  * is smaller than the number of required extensions, \c SDL_FALSE will be
154
154
  * returned instead of \c SDL_TRUE, to indicate that not all the required
155
155
  * extensions were returned.
156
- *
156
+ *
157
157
  * \note If \c window is not NULL, it will be checked against its creation
158
158
  * flags to ensure that the Vulkan flag is present. This parameter
159
159
  * will be removed in a future major release.
@@ -204,10 +204,9 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
204
204
  *
205
205
  * \sa SDL_Vulkan_CreateSurface()
206
206
  */
207
- extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
208
- SDL_Window *window,
209
- unsigned int *pCount,
210
- const char **pNames);
207
+ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *window,
208
+ unsigned int *pCount,
209
+ const char **pNames);
211
210
 
212
211
  /**
213
212
  * \brief Create a Vulkan rendering surface for a window.
@@ -238,10 +237,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
238
237
  *
239
238
  * \sa SDL_Vulkan_GetInstanceExtensions()
240
239
  */
241
- extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
242
- SDL_Window *window,
243
- VkInstance instance,
244
- VkSurfaceKHR* surface);
240
+ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
241
+ VkInstance instance,
242
+ VkSurfaceKHR* surface);
245
243
 
246
244
  /**
247
245
  * \brief Get the size of a window's underlying drawable in pixels (for use