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
@@ -61,7 +61,7 @@ extern "C" {
61
61
  * at the VERBOSE level and all other categories are enabled at the
62
62
  * CRITICAL level.
63
63
  */
64
- enum
64
+ typedef enum
65
65
  {
66
66
  SDL_LOG_CATEGORY_APPLICATION,
67
67
  SDL_LOG_CATEGORY_ERROR,
@@ -94,7 +94,7 @@ enum
94
94
  };
95
95
  */
96
96
  SDL_LOG_CATEGORY_CUSTOM
97
- };
97
+ } SDL_LogCategory;
98
98
 
99
99
  /**
100
100
  * \brief The predefined log priorities
@@ -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
@@ -55,6 +55,10 @@
55
55
  /* On iOS SDL provides a main function that creates an application delegate
56
56
  and starts the iOS application run loop.
57
57
 
58
+ If you link with SDL dynamically on iOS, the main function can't be in a
59
+ shared library, so you need to link with libSDLmain.a, which includes a
60
+ stub main function that calls into the shared library to start execution.
61
+
58
62
  See src/video/uikit/SDL_uikitappdelegate.m for more details.
59
63
  */
60
64
  #define SDL_MAIN_NEEDED
@@ -82,12 +86,6 @@
82
86
  #endif
83
87
  #endif /* SDL_MAIN_HANDLED */
84
88
 
85
- #ifdef __cplusplus
86
- #define C_LINKAGE "C"
87
- #else
88
- #define C_LINKAGE
89
- #endif /* __cplusplus */
90
-
91
89
  #ifndef SDLMAIN_DECLSPEC
92
90
  #define SDLMAIN_DECLSPEC
93
91
  #endif
@@ -111,17 +109,18 @@
111
109
  #define main SDL_main
112
110
  #endif
113
111
 
114
- /**
115
- * The prototype for the application's main() function
116
- */
117
- extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
118
-
119
-
120
112
  #include "begin_code.h"
121
113
  #ifdef __cplusplus
122
114
  extern "C" {
123
115
  #endif
124
116
 
117
+ /**
118
+ * The prototype for the application's main() function
119
+ */
120
+ typedef int (*SDL_main_func)(int argc, char *argv[]);
121
+ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
122
+
123
+
125
124
  /**
126
125
  * This is called by the real SDL main function to let the rest of the
127
126
  * library know that initialization was done properly.
@@ -136,8 +135,7 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
136
135
  /**
137
136
  * This can be called to set the application class at startup
138
137
  */
139
- extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
140
- void *hInst);
138
+ extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
141
139
  extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
142
140
 
143
141
  #endif /* __WIN32__ */
@@ -153,10 +151,24 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
153
151
  * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
154
152
  * information on the failure.
155
153
  */
156
- extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
154
+ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
157
155
 
158
156
  #endif /* __WINRT__ */
159
157
 
158
+ #if defined(__IPHONEOS__)
159
+
160
+ /**
161
+ * \brief Initializes and launches an SDL application.
162
+ *
163
+ * \param argc The argc parameter from the application's main() function
164
+ * \param argv The argv parameter from the application's main() function
165
+ * \param mainFunction The SDL app's C-style main().
166
+ * \return the return value from mainFunction
167
+ */
168
+ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
169
+
170
+ #endif /* __IPHONEOS__ */
171
+
160
172
 
161
173
  #ifdef __cplusplus
162
174
  }
@@ -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
@@ -36,9 +36,11 @@ extern "C" {
36
36
  */
37
37
  typedef enum
38
38
  {
39
- SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
40
- SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
41
- SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
39
+ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
40
+ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
41
+ SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
42
+ SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
43
+ SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
42
44
  } SDL_MessageBoxFlags;
43
45
 
44
46
  /**
@@ -0,0 +1,117 @@
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_metal.h
24
+ *
25
+ * Header file for functions to creating Metal layers and views on SDL windows.
26
+ */
27
+
28
+ #ifndef SDL_metal_h_
29
+ #define SDL_metal_h_
30
+
31
+ #include "SDL_video.h"
32
+
33
+ #include "begin_code.h"
34
+ /* Set up for C function definitions, even when using C++ */
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /**
40
+ * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
41
+ *
42
+ * \note This can be cast directly to an NSView or UIView.
43
+ */
44
+ typedef void *SDL_MetalView;
45
+
46
+ /**
47
+ * \name Metal support functions
48
+ */
49
+ /* @{ */
50
+
51
+ /**
52
+ * \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
53
+ * specified window.
54
+ *
55
+ * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
56
+ * own. It is up to user code to do that.
57
+ *
58
+ * The returned handle can be casted directly to a NSView or UIView.
59
+ * To access the backing CAMetalLayer, call SDL_Metal_GetLayer().
60
+ *
61
+ * \note \a window must be created with the SDL_WINDOW_METAL flag.
62
+ *
63
+ * \sa SDL_Metal_DestroyView
64
+ * \sa SDL_Metal_GetLayer
65
+ */
66
+ extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
67
+
68
+ /**
69
+ * \brief Destroy an existing SDL_MetalView object.
70
+ *
71
+ * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
72
+ * called after SDL_CreateWindow.
73
+ *
74
+ * \sa SDL_Metal_CreateView
75
+ */
76
+ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
77
+
78
+ /**
79
+ * \brief Get a pointer to the backing CAMetalLayer for the given view.
80
+ *
81
+ * \sa SDL_MetalCreateView
82
+ */
83
+ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
84
+
85
+ /**
86
+ * \brief Get the size of a window's underlying drawable in pixels (for use
87
+ * with setting viewport, scissor & etc).
88
+ *
89
+ * \param window SDL_Window from which the drawable size should be queried
90
+ * \param w Pointer to variable for storing the width in pixels,
91
+ * may be NULL
92
+ * \param h Pointer to variable for storing the height in pixels,
93
+ * may be NULL
94
+ *
95
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
96
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
97
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
98
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
99
+ *
100
+ * \note On macOS high-DPI support must be enabled for an application by
101
+ * setting NSHighResolutionCapable to true in its Info.plist.
102
+ *
103
+ * \sa SDL_GetWindowSize()
104
+ * \sa SDL_CreateWindow()
105
+ */
106
+ extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
107
+ int *h);
108
+
109
+ /* @} *//* Metal support functions */
110
+
111
+ /* Ends C function definitions when using C++ */
112
+ #ifdef __cplusplus
113
+ }
114
+ #endif
115
+ #include "close_code.h"
116
+
117
+ #endif /* SDL_metal_h_ */
@@ -0,0 +1,75 @@
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_misc.h
24
+ *
25
+ * \brief Include file for SDL API functions that don't fit elsewhere.
26
+ */
27
+
28
+ #ifndef SDL_misc_h_
29
+ #define SDL_misc_h_
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ #include "begin_code.h"
34
+
35
+ /* Set up for C function definitions, even when using C++ */
36
+ #ifdef __cplusplus
37
+ extern "C" {
38
+ #endif
39
+
40
+ /**
41
+ * \brief Open an URL / URI in the browser or other
42
+ *
43
+ * Open a URL in a separate, system-provided application. How this works will
44
+ * vary wildly depending on the platform. This will likely launch what
45
+ * makes sense to handle a specific URL's protocol (a web browser for http://,
46
+ * etc), but it might also be able to launch file managers for directories
47
+ * and other things.
48
+ *
49
+ * What happens when you open a URL varies wildly as well: your game window
50
+ * may lose focus (and may or may not lose focus if your game was fullscreen
51
+ * or grabbing input at the time). On mobile devices, your app will likely
52
+ * move to the background or your process might be paused. Any given platform
53
+ * may or may not handle a given URL.
54
+ *
55
+ * If this is unimplemented (or simply unavailable) for a platform, this will
56
+ * fail with an error. A successful result does not mean the URL loaded, just
57
+ * that we launched something to handle it (or at least believe we did).
58
+ *
59
+ * All this to say: this function can be useful, but you should definitely
60
+ * test it on every platform you target.
61
+ *
62
+ * \param url A valid URL to open.
63
+ * \return 0 on success, or -1 on error.
64
+ */
65
+ extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
66
+
67
+ /* Ends C function definitions when using C++ */
68
+ #ifdef __cplusplus
69
+ }
70
+ #endif
71
+ #include "close_code.h"
72
+
73
+ #endif /* SDL_misc_h_ */
74
+
75
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -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
@@ -40,6 +40,9 @@ extern "C" {
40
40
  #ifndef WIN32_LEAN_AND_MEAN
41
41
  #define WIN32_LEAN_AND_MEAN 1
42
42
  #endif
43
+ #ifndef NOMINMAX /* don't define min() and max(). */
44
+ #define NOMINMAX
45
+ #endif
43
46
  #include <windows.h>
44
47
  #endif
45
48
 
@@ -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
@@ -48,7 +48,7 @@ extern "C" {
48
48
  /* @} */
49
49
 
50
50
  /** Pixel type. */
51
- enum
51
+ typedef enum
52
52
  {
53
53
  SDL_PIXELTYPE_UNKNOWN,
54
54
  SDL_PIXELTYPE_INDEX1,
@@ -62,18 +62,18 @@ enum
62
62
  SDL_PIXELTYPE_ARRAYU32,
63
63
  SDL_PIXELTYPE_ARRAYF16,
64
64
  SDL_PIXELTYPE_ARRAYF32
65
- };
65
+ } SDL_PixelType;
66
66
 
67
67
  /** Bitmap pixel order, high bit -> low bit. */
68
- enum
68
+ typedef enum
69
69
  {
70
70
  SDL_BITMAPORDER_NONE,
71
71
  SDL_BITMAPORDER_4321,
72
72
  SDL_BITMAPORDER_1234
73
- };
73
+ } SDL_BitmapOrder;
74
74
 
75
75
  /** Packed component order, high bit -> low bit. */
76
- enum
76
+ typedef enum
77
77
  {
78
78
  SDL_PACKEDORDER_NONE,
79
79
  SDL_PACKEDORDER_XRGB,
@@ -84,12 +84,12 @@ enum
84
84
  SDL_PACKEDORDER_BGRX,
85
85
  SDL_PACKEDORDER_ABGR,
86
86
  SDL_PACKEDORDER_BGRA
87
- };
87
+ } SDL_PackedOrder;
88
88
 
89
89
  /** Array component order, low byte -> high byte. */
90
90
  /* !!! FIXME: in 2.1, make these not overlap differently with
91
91
  !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
92
- enum
92
+ typedef enum
93
93
  {
94
94
  SDL_ARRAYORDER_NONE,
95
95
  SDL_ARRAYORDER_RGB,
@@ -98,10 +98,10 @@ enum
98
98
  SDL_ARRAYORDER_BGR,
99
99
  SDL_ARRAYORDER_BGRA,
100
100
  SDL_ARRAYORDER_ABGR
101
- };
101
+ } SDL_ArrayOrder;
102
102
 
103
103
  /** Packed component layout. */
104
- enum
104
+ typedef enum
105
105
  {
106
106
  SDL_PACKEDLAYOUT_NONE,
107
107
  SDL_PACKEDLAYOUT_332,
@@ -112,7 +112,7 @@ enum
112
112
  SDL_PACKEDLAYOUT_8888,
113
113
  SDL_PACKEDLAYOUT_2101010,
114
114
  SDL_PACKEDLAYOUT_1010102
115
- };
115
+ } SDL_PackedLayout;
116
116
 
117
117
  #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
118
118
 
@@ -168,7 +168,7 @@ enum
168
168
  ((format) && (SDL_PIXELFLAG(format) != 1))
169
169
 
170
170
  /* Note: If you modify this list, update SDL_GetPixelFormatName() */
171
- enum
171
+ typedef enum
172
172
  {
173
173
  SDL_PIXELFORMAT_UNKNOWN,
174
174
  SDL_PIXELFORMAT_INDEX1LSB =
@@ -188,15 +188,22 @@ enum
188
188
  SDL_PIXELFORMAT_RGB332 =
189
189
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
190
190
  SDL_PACKEDLAYOUT_332, 8, 1),
191
- SDL_PIXELFORMAT_RGB444 =
191
+ SDL_PIXELFORMAT_XRGB4444 =
192
192
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
193
193
  SDL_PACKEDLAYOUT_4444, 12, 2),
194
- SDL_PIXELFORMAT_RGB555 =
194
+ SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
195
+ SDL_PIXELFORMAT_XBGR4444 =
196
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
197
+ SDL_PACKEDLAYOUT_4444, 12, 2),
198
+ SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
199
+ SDL_PIXELFORMAT_XRGB1555 =
195
200
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
196
201
  SDL_PACKEDLAYOUT_1555, 15, 2),
197
- SDL_PIXELFORMAT_BGR555 =
202
+ SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
203
+ SDL_PIXELFORMAT_XBGR1555 =
198
204
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
199
205
  SDL_PACKEDLAYOUT_1555, 15, 2),
206
+ SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
200
207
  SDL_PIXELFORMAT_ARGB4444 =
201
208
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
202
209
  SDL_PACKEDLAYOUT_4444, 16, 2),
@@ -233,15 +240,17 @@ enum
233
240
  SDL_PIXELFORMAT_BGR24 =
234
241
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
235
242
  24, 3),
236
- SDL_PIXELFORMAT_RGB888 =
243
+ SDL_PIXELFORMAT_XRGB8888 =
237
244
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
238
245
  SDL_PACKEDLAYOUT_8888, 24, 4),
246
+ SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
239
247
  SDL_PIXELFORMAT_RGBX8888 =
240
248
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
241
249
  SDL_PACKEDLAYOUT_8888, 24, 4),
242
- SDL_PIXELFORMAT_BGR888 =
250
+ SDL_PIXELFORMAT_XBGR8888 =
243
251
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
244
252
  SDL_PACKEDLAYOUT_8888, 24, 4),
253
+ SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
245
254
  SDL_PIXELFORMAT_BGRX8888 =
246
255
  SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
247
256
  SDL_PACKEDLAYOUT_8888, 24, 4),
@@ -290,7 +299,7 @@ enum
290
299
  SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
291
300
  SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
292
301
  SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
293
- };
302
+ } SDL_PixelFormatEnum;
294
303
 
295
304
  typedef struct SDL_Color
296
305
  {