gosu 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +108 -14
  3. data/dependencies/SDL/include/SDL_assert.h +81 -50
  4. data/dependencies/SDL/include/SDL_atomic.h +135 -35
  5. data/dependencies/SDL/include/SDL_audio.h +960 -355
  6. data/dependencies/SDL/include/SDL_bits.h +11 -6
  7. data/dependencies/SDL/include/SDL_blendmode.h +91 -14
  8. data/dependencies/SDL/include/SDL_clipboard.h +30 -7
  9. data/dependencies/SDL/include/SDL_config.h +277 -27
  10. data/dependencies/SDL/include/SDL_config_android.h +13 -38
  11. data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
  12. data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
  13. data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
  14. data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
  15. data/dependencies/SDL/include/SDL_config_psp.h +16 -37
  16. data/dependencies/SDL/include/SDL_config_windows.h +28 -91
  17. data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
  18. data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
  19. data/dependencies/SDL/include/SDL_copying.h +1 -1
  20. data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
  21. data/dependencies/SDL/include/SDL_egl.h +906 -280
  22. data/dependencies/SDL/include/SDL_endian.h +101 -47
  23. data/dependencies/SDL/include/SDL_error.h +70 -19
  24. data/dependencies/SDL/include/SDL_events.h +387 -79
  25. data/dependencies/SDL/include/SDL_filesystem.h +73 -64
  26. data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
  27. data/dependencies/SDL/include/SDL_gesture.h +36 -6
  28. data/dependencies/SDL/include/SDL_haptic.h +304 -210
  29. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  30. data/dependencies/SDL/include/SDL_hints.h +1286 -897
  31. data/dependencies/SDL/include/SDL_joystick.h +577 -130
  32. data/dependencies/SDL/include/SDL_keyboard.h +162 -63
  33. data/dependencies/SDL/include/SDL_keycode.h +7 -5
  34. data/dependencies/SDL/include/SDL_loadso.h +42 -8
  35. data/dependencies/SDL/include/SDL_locale.h +34 -32
  36. data/dependencies/SDL/include/SDL_log.h +212 -19
  37. data/dependencies/SDL/include/SDL_main.h +72 -17
  38. data/dependencies/SDL/include/SDL_messagebox.h +70 -23
  39. data/dependencies/SDL/include/SDL_metal.h +27 -32
  40. data/dependencies/SDL/include/SDL_misc.h +19 -15
  41. data/dependencies/SDL/include/SDL_mouse.h +262 -110
  42. data/dependencies/SDL/include/SDL_mutex.h +286 -66
  43. data/dependencies/SDL/include/SDL_name.h +1 -1
  44. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  45. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  46. data/dependencies/SDL/include/SDL_opengles2.h +2 -2
  47. data/dependencies/SDL/include/SDL_pixels.h +199 -34
  48. data/dependencies/SDL/include/SDL_platform.h +39 -2
  49. data/dependencies/SDL/include/SDL_power.h +23 -10
  50. data/dependencies/SDL/include/SDL_quit.h +1 -1
  51. data/dependencies/SDL/include/SDL_rect.h +78 -28
  52. data/dependencies/SDL/include/SDL_render.h +1204 -472
  53. data/dependencies/SDL/include/SDL_revision.h +2 -2
  54. data/dependencies/SDL/include/SDL_rwops.h +605 -33
  55. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  56. data/dependencies/SDL/include/SDL_sensor.h +76 -42
  57. data/dependencies/SDL/include/SDL_shape.h +38 -27
  58. data/dependencies/SDL/include/SDL_stdinc.h +96 -24
  59. data/dependencies/SDL/include/SDL_surface.h +571 -139
  60. data/dependencies/SDL/include/SDL_system.h +339 -101
  61. data/dependencies/SDL/include/SDL_syswm.h +50 -20
  62. data/dependencies/SDL/include/SDL_test.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_assert.h +2 -2
  64. data/dependencies/SDL/include/SDL_test_common.h +23 -6
  65. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_font.h +3 -3
  68. data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
  69. data/dependencies/SDL/include/SDL_test_harness.h +6 -6
  70. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  71. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  72. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  73. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  74. data/dependencies/SDL/include/SDL_test_random.h +2 -2
  75. data/dependencies/SDL/include/SDL_thread.h +226 -128
  76. data/dependencies/SDL/include/SDL_timer.h +129 -22
  77. data/dependencies/SDL/include/SDL_touch.h +48 -8
  78. data/dependencies/SDL/include/SDL_types.h +1 -1
  79. data/dependencies/SDL/include/SDL_version.h +72 -46
  80. data/dependencies/SDL/include/SDL_video.h +1266 -460
  81. data/dependencies/SDL/include/SDL_vulkan.h +100 -161
  82. data/dependencies/SDL/include/begin_code.h +22 -1
  83. data/dependencies/SDL/include/close_code.h +1 -1
  84. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  85. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  86. data/dependencies/SDL_sound/SDL_sound.c +83 -7
  87. data/dependencies/SDL_sound/SDL_sound.h +4 -4
  88. data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
  89. data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
  90. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
  91. data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
  92. data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
  93. data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
  94. data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
  95. data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
  96. data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
  97. data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
  98. data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
  99. data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
  100. data/dependencies/SDL_sound/dr_flac.h +618 -220
  101. data/dependencies/SDL_sound/dr_mp3.h +263 -94
  102. data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
  103. data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
  104. data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
  105. data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
  106. data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
  107. data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
  108. data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
  109. data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
  110. data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
  111. data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
  112. data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
  113. data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
  114. data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
  115. data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
  116. data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
  117. data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
  118. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
  119. data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
  120. data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
  121. data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
  122. data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
  123. data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
  124. data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
  125. data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
  126. data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
  127. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
  128. data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
  129. data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
  130. data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
  131. data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
  132. data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
  133. data/dependencies/SDL_sound/stb_vorbis.h +508 -325
  134. data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
  135. data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
  136. data/dependencies/mojoAL/mojoal.c +4594 -0
  137. data/ext/gosu/extconf.rb +29 -30
  138. data/include/Gosu/Audio.hpp +70 -85
  139. data/include/Gosu/Color.hpp +19 -11
  140. data/include/Gosu/Font.hpp +40 -44
  141. data/include/Gosu/Graphics.hpp +58 -71
  142. data/include/Gosu/GraphicsBase.hpp +26 -33
  143. data/include/Gosu/Image.hpp +56 -62
  144. data/include/Gosu/ImageData.hpp +23 -27
  145. data/include/Gosu/Inspection.hpp +1 -4
  146. data/include/Gosu/TextInput.hpp +34 -40
  147. data/include/Gosu/Version.hpp +1 -1
  148. data/include/Gosu/Window.hpp +71 -70
  149. data/lib/SDL2.dll +0 -0
  150. data/lib/gosu/compat.rb +24 -37
  151. data/lib/gosu.rb +2 -2
  152. data/lib64/SDL2.dll +0 -0
  153. data/src/Audio.cpp +86 -86
  154. data/src/AudioFile.hpp +6 -6
  155. data/src/AudioFileAudioToolbox.cpp +1 -1
  156. data/src/AudioFileSDLSound.cpp +1 -1
  157. data/src/AudioImpl.hpp +5 -5
  158. data/src/BitmapIO.cpp +0 -20
  159. data/src/BlockAllocator.cpp +2 -1
  160. data/src/Channel.cpp +22 -20
  161. data/src/Color.cpp +12 -9
  162. data/src/EmptyImageData.hpp +15 -17
  163. data/src/FileUnix.cpp +1 -1
  164. data/src/FileWin.cpp +1 -1
  165. data/src/Font.cpp +48 -53
  166. data/src/Graphics.cpp +135 -143
  167. data/src/Image.cpp +41 -42
  168. data/src/Input.cpp +1 -1
  169. data/src/InputUIKit.cpp +1 -1
  170. data/src/LargeImageData.cpp +108 -101
  171. data/src/LargeImageData.hpp +17 -15
  172. data/src/Log.hpp +6 -6
  173. data/src/Macro.cpp +35 -37
  174. data/src/Macro.hpp +11 -11
  175. data/src/Math.cpp +8 -1
  176. data/src/Resolution.cpp +12 -7
  177. data/src/RubyGosu.cxx +5 -5
  178. data/src/TexChunk.cpp +50 -41
  179. data/src/TexChunk.hpp +22 -22
  180. data/src/Text.cpp +37 -37
  181. data/src/TextBuilder.cpp +60 -57
  182. data/src/TextBuilder.hpp +20 -20
  183. data/src/TextInput.cpp +127 -135
  184. data/src/TrueTypeFont.cpp +107 -107
  185. data/src/TrueTypeFont.hpp +39 -38
  186. data/src/TrueTypeFontApple.cpp +19 -22
  187. data/src/TrueTypeFontUnix.cpp +21 -26
  188. data/src/TrueTypeFontWin.cpp +30 -30
  189. data/src/Window.cpp +95 -86
  190. data/src/WindowUIKit.cpp +46 -49
  191. metadata +7 -17
  192. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  193. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  194. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  195. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  196. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  197. data/dependencies/al_soft/AL/alext.h +0 -585
  198. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  199. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  200. data/dependencies/al_soft/AL/efx.h +0 -762
  201. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  202. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  203. data/lib/OpenAL32.dll +0 -0
  204. data/lib64/OpenAL32.dll +0 -0
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2022 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
@@ -49,59 +49,54 @@ typedef void *SDL_MetalView;
49
49
  /* @{ */
50
50
 
51
51
  /**
52
- * \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
53
- * specified window.
52
+ * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
53
+ * window.
54
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.
55
+ * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on
56
+ * its own. It is up to user code to do that.
57
57
  *
58
- * The returned handle can be casted directly to a NSView or UIView.
59
- * To access the backing CAMetalLayer, call SDL_Metal_GetLayer().
58
+ * The returned handle can be casted directly to a NSView or UIView. To access
59
+ * the backing CAMetalLayer, call SDL_Metal_GetLayer().
60
60
  *
61
- * \note \a window must be created with the SDL_WINDOW_METAL flag.
61
+ * \since This function is available since SDL 2.0.12.
62
62
  *
63
- * \sa SDL_Metal_DestroyView
64
- * \sa SDL_Metal_GetLayer
63
+ * \sa SDL_Metal_DestroyView
64
+ * \sa SDL_Metal_GetLayer
65
65
  */
66
66
  extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
67
67
 
68
68
  /**
69
- * \brief Destroy an existing SDL_MetalView object.
69
+ * Destroy an existing SDL_MetalView object.
70
70
  *
71
- * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
72
- * called after SDL_CreateWindow.
71
+ * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
72
+ * called after SDL_CreateWindow.
73
73
  *
74
- * \sa SDL_Metal_CreateView
74
+ * \since This function is available since SDL 2.0.12.
75
+ *
76
+ * \sa SDL_Metal_CreateView
75
77
  */
76
78
  extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
77
79
 
78
80
  /**
79
- * \brief Get a pointer to the backing CAMetalLayer for the given view.
81
+ * Get a pointer to the backing CAMetalLayer for the given view.
82
+ *
83
+ * \since This function is available since SDL 2.0.14.
80
84
  *
81
- * \sa SDL_MetalCreateView
85
+ * \sa SDL_MetalCreateView
82
86
  */
83
87
  extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
84
88
 
85
89
  /**
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
90
+ * Get the size of a window's underlying drawable in pixels (for use with
91
+ * setting viewport, scissor & etc).
94
92
  *
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.
93
+ * \param window SDL_Window from which the drawable size should be queried
94
+ * \param w Pointer to variable for storing the width in pixels, may be NULL
99
95
  *
100
- * \note On macOS high-DPI support must be enabled for an application by
101
- * setting NSHighResolutionCapable to true in its Info.plist.
96
+ * \since This function is available since SDL 2.0.14.
102
97
  *
103
- * \sa SDL_GetWindowSize()
104
- * \sa SDL_CreateWindow()
98
+ * \sa SDL_GetWindowSize
99
+ * \sa SDL_CreateWindow
105
100
  */
106
101
  extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
107
102
  int *h);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2022 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
@@ -38,29 +38,33 @@ extern "C" {
38
38
  #endif
39
39
 
40
40
  /**
41
- * \brief Open an URL / URI in the browser or other
41
+ * Open a URL/URI in the browser or other appropriate external application.
42
42
  *
43
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.
44
+ * vary wildly depending on the platform. This will likely launch what makes
45
+ * 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 and
47
+ * other things.
48
48
  *
49
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.
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
54
  *
55
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).
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
58
  *
59
59
  * All this to say: this function can be useful, but you should definitely
60
- * test it on every platform you target.
60
+ * test it on every platform you target.
61
61
  *
62
- * \param url A valid URL to open.
63
- * \return 0 on success, or -1 on error.
62
+ * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for
63
+ * local files, if supported.
64
+ * \returns 0 on success, or -1 on error; call SDL_GetError() for more
65
+ * information.
66
+ *
67
+ * \since This function is available since SDL 2.0.14.
64
68
  */
65
69
  extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
66
70
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2022 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
@@ -72,150 +72,240 @@ typedef enum
72
72
  /* Function prototypes */
73
73
 
74
74
  /**
75
- * \brief Get the window which currently has mouse focus.
75
+ * Get the window which currently has mouse focus.
76
+ *
77
+ * \returns the window with mouse focus.
78
+ *
79
+ * \since This function is available since SDL 2.0.0.
76
80
  */
77
81
  extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
78
82
 
79
83
  /**
80
- * \brief Retrieve the current state of the mouse.
84
+ * Retrieve the current state of the mouse.
85
+ *
86
+ * The current button state is returned as a button bitmask, which can be
87
+ * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the
88
+ * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the
89
+ * mouse cursor position relative to the focus window. You can pass NULL for
90
+ * either `x` or `y`.
91
+ *
92
+ * \param x the x coordinate of the mouse cursor position relative to the
93
+ * focus window
94
+ * \param y the y coordinate of the mouse cursor position relative to the
95
+ * focus window
96
+ * \returns a 32-bit button bitmask of the current button state.
81
97
  *
82
- * The current button state is returned as a button bitmask, which can
83
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
84
- * mouse cursor position relative to the focus window for the currently
85
- * selected mouse. You can pass NULL for either x or y.
98
+ * \since This function is available since SDL 2.0.0.
99
+ *
100
+ * \sa SDL_GetGlobalMouseState
101
+ * \sa SDL_GetRelativeMouseState
102
+ * \sa SDL_PumpEvents
86
103
  */
87
104
  extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
88
105
 
89
106
  /**
90
- * \brief Get the current state of the mouse, in relation to the desktop
91
- *
92
- * This works just like SDL_GetMouseState(), but the coordinates will be
93
- * reported relative to the top-left of the desktop. This can be useful if
94
- * you need to track the mouse outside of a specific window and
95
- * SDL_CaptureMouse() doesn't fit your needs. For example, it could be
96
- * useful if you need to track the mouse while dragging a window, where
97
- * coordinates relative to a window might not be in sync at all times.
98
- *
99
- * \note SDL_GetMouseState() returns the mouse position as SDL understands
100
- * it from the last pump of the event queue. This function, however,
101
- * queries the OS for the current mouse position, and as such, might
102
- * be a slightly less efficient function. Unless you know what you're
103
- * doing and have a good reason to use this function, you probably want
104
- * SDL_GetMouseState() instead.
105
- *
106
- * \param x Returns the current X coord, relative to the desktop. Can be NULL.
107
- * \param y Returns the current Y coord, relative to the desktop. Can be NULL.
108
- * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
109
- *
110
- * \sa SDL_GetMouseState
107
+ * Get the current state of the mouse in relation to the desktop.
108
+ *
109
+ * This works similarly to SDL_GetMouseState(), but the coordinates will be
110
+ * reported relative to the top-left of the desktop. This can be useful if you
111
+ * need to track the mouse outside of a specific window and SDL_CaptureMouse()
112
+ * doesn't fit your needs. For example, it could be useful if you need to
113
+ * track the mouse while dragging a window, where coordinates relative to a
114
+ * window might not be in sync at all times.
115
+ *
116
+ * Note: SDL_GetMouseState() returns the mouse position as SDL understands it
117
+ * from the last pump of the event queue. This function, however, queries the
118
+ * OS for the current mouse position, and as such, might be a slightly less
119
+ * efficient function. Unless you know what you're doing and have a good
120
+ * reason to use this function, you probably want SDL_GetMouseState() instead.
121
+ *
122
+ * \param x filled in with the current X coord relative to the desktop; can be
123
+ * NULL
124
+ * \param y filled in with the current Y coord relative to the desktop; can be
125
+ * NULL
126
+ * \returns the current button state as a bitmask which can be tested using
127
+ * the SDL_BUTTON(X) macros.
128
+ *
129
+ * \since This function is available since SDL 2.0.4.
130
+ *
131
+ * \sa SDL_CaptureMouse
111
132
  */
112
133
  extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
113
134
 
114
135
  /**
115
- * \brief Retrieve the relative state of the mouse.
136
+ * Retrieve the relative state of the mouse.
137
+ *
138
+ * The current button state is returned as a button bitmask, which can be
139
+ * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the
140
+ * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the
141
+ * mouse deltas since the last call to SDL_GetRelativeMouseState() or since
142
+ * event initialization. You can pass NULL for either `x` or `y`.
143
+ *
144
+ * \param x a pointer filled with the last recorded x coordinate of the mouse
145
+ * \param y a pointer filled with the last recorded y coordinate of the mouse
146
+ * \returns a 32-bit button bitmask of the relative button state.
116
147
  *
117
- * The current button state is returned as a button bitmask, which can
118
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
119
- * mouse deltas since the last call to SDL_GetRelativeMouseState().
148
+ * \since This function is available since SDL 2.0.0.
149
+ *
150
+ * \sa SDL_GetMouseState
120
151
  */
121
152
  extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
122
153
 
123
154
  /**
124
- * \brief Moves the mouse to the given position within the window.
155
+ * Move the mouse cursor to the given position within the window.
156
+ *
157
+ * This function generates a mouse motion event.
158
+ *
159
+ * Note that this function will appear to succeed, but not actually move the
160
+ * mouse when used over Microsoft Remote Desktop.
125
161
  *
126
- * \param window The window to move the mouse into, or NULL for the current mouse focus
127
- * \param x The x coordinate within the window
128
- * \param y The y coordinate within the window
162
+ * \param window the window to move the mouse into, or NULL for the current
163
+ * mouse focus
164
+ * \param x the x coordinate within the window
165
+ * \param y the y coordinate within the window
129
166
  *
130
- * \note This function generates a mouse motion event
167
+ * \since This function is available since SDL 2.0.0.
168
+ *
169
+ * \sa SDL_WarpMouseGlobal
131
170
  */
132
171
  extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
133
172
  int x, int y);
134
173
 
135
174
  /**
136
- * \brief Moves the mouse to the given position in global screen space.
175
+ * Move the mouse to the given position in global screen space.
176
+ *
177
+ * This function generates a mouse motion event.
178
+ *
179
+ * A failure of this function usually means that it is unsupported by a
180
+ * platform.
181
+ *
182
+ * Note that this function will appear to succeed, but not actually move the
183
+ * mouse when used over Microsoft Remote Desktop.
137
184
  *
138
- * \param x The x coordinate
139
- * \param y The y coordinate
140
- * \return 0 on success, -1 on error (usually: unsupported by a platform).
185
+ * \param x the x coordinate
186
+ * \param y the y coordinate
187
+ * \returns 0 on success or a negative error code on failure; call
188
+ * SDL_GetError() for more information.
141
189
  *
142
- * \note This function generates a mouse motion event
190
+ * \since This function is available since SDL 2.0.4.
191
+ *
192
+ * \sa SDL_WarpMouseInWindow
143
193
  */
144
194
  extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
145
195
 
146
196
  /**
147
- * \brief Set relative mouse mode.
197
+ * Set relative mouse mode.
198
+ *
199
+ * While the mouse is in relative mode, the cursor is hidden, and the driver
200
+ * will try to report continuous motion in the current window. Only relative
201
+ * motion events will be delivered, the mouse position will not change.
202
+ *
203
+ * Note that this function will not be able to provide continuous relative
204
+ * motion when used over Microsoft Remote Desktop, instead motion is limited
205
+ * to the bounds of the screen.
148
206
  *
149
- * \param enabled Whether or not to enable relative mode
207
+ * This function will flush any pending mouse motion.
150
208
  *
151
- * \return 0 on success, or -1 if relative mode is not supported.
209
+ * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable.
210
+ * \returns 0 on success or a negative error code on failure; call
211
+ * SDL_GetError() for more information.
152
212
  *
153
- * While the mouse is in relative mode, the cursor is hidden, and the
154
- * driver will try to report continuous motion in the current window.
155
- * Only relative motion events will be delivered, the mouse position
156
- * will not change.
213
+ * If relative mode is not supported, this returns -1.
157
214
  *
158
- * \note This function will flush any pending mouse motion.
215
+ * \since This function is available since SDL 2.0.0.
159
216
  *
160
- * \sa SDL_GetRelativeMouseMode()
217
+ * \sa SDL_GetRelativeMouseMode
161
218
  */
162
219
  extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
163
220
 
164
221
  /**
165
- * \brief Capture the mouse, to track input outside an SDL window.
222
+ * Capture the mouse and to track input outside an SDL window.
166
223
  *
167
- * \param enabled Whether or not to enable capturing
224
+ * Capturing enables your app to obtain mouse events globally, instead of just
225
+ * within your window. Not all video targets support this function. When
226
+ * capturing is enabled, the current window will get all mouse events, but
227
+ * unlike relative mode, no change is made to the cursor and it is not
228
+ * restrained to your window.
168
229
  *
169
- * Capturing enables your app to obtain mouse events globally, instead of
170
- * just within your window. Not all video targets support this function.
171
- * When capturing is enabled, the current window will get all mouse events,
172
- * but unlike relative mode, no change is made to the cursor and it is
173
- * not restrained to your window.
230
+ * This function may also deny mouse input to other windows--both those in
231
+ * your application and others on the system--so you should use this function
232
+ * sparingly, and in small bursts. For example, you might want to track the
233
+ * mouse while the user is dragging something, until the user releases a mouse
234
+ * button. It is not recommended that you capture the mouse for long periods
235
+ * of time, such as the entire time your app is running. For that, you should
236
+ * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending
237
+ * on your goals.
174
238
  *
175
- * This function may also deny mouse input to other windows--both those in
176
- * your application and others on the system--so you should use this
177
- * function sparingly, and in small bursts. For example, you might want to
178
- * track the mouse while the user is dragging something, until the user
179
- * releases a mouse button. It is not recommended that you capture the mouse
180
- * for long periods of time, such as the entire time your app is running.
239
+ * While captured, mouse events still report coordinates relative to the
240
+ * current (foreground) window, but those coordinates may be outside the
241
+ * bounds of the window (including negative values). Capturing is only allowed
242
+ * for the foreground window. If the window loses focus while capturing, the
243
+ * capture will be disabled automatically.
181
244
  *
182
- * While captured, mouse events still report coordinates relative to the
183
- * current (foreground) window, but those coordinates may be outside the
184
- * bounds of the window (including negative values). Capturing is only
185
- * allowed for the foreground window. If the window loses focus while
186
- * capturing, the capture will be disabled automatically.
245
+ * While capturing is enabled, the current window will have the
246
+ * `SDL_WINDOW_MOUSE_CAPTURE` flag set.
187
247
  *
188
- * While capturing is enabled, the current window will have the
189
- * SDL_WINDOW_MOUSE_CAPTURE flag set.
248
+ * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable.
249
+ * \returns 0 on success or -1 if not supported; call SDL_GetError() for more
250
+ * information.
190
251
  *
191
- * \return 0 on success, or -1 if not supported.
252
+ * \since This function is available since SDL 2.0.4.
253
+ *
254
+ * \sa SDL_GetGlobalMouseState
192
255
  */
193
256
  extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
194
257
 
195
258
  /**
196
- * \brief Query whether relative mouse mode is enabled.
259
+ * Query whether relative mouse mode is enabled.
260
+ *
261
+ * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
197
262
  *
198
- * \sa SDL_SetRelativeMouseMode()
263
+ * \since This function is available since SDL 2.0.0.
264
+ *
265
+ * \sa SDL_SetRelativeMouseMode
199
266
  */
200
267
  extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
201
268
 
202
269
  /**
203
- * \brief Create a cursor, using the specified bitmap data and
204
- * mask (in MSB format).
205
- *
206
- * The cursor width must be a multiple of 8 bits.
207
- *
208
- * The cursor is created in black and white according to the following:
209
- * <table>
210
- * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
211
- * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
212
- * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
213
- * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
214
- * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
215
- * if not. </td></tr>
216
- * </table>
217
- *
218
- * \sa SDL_FreeCursor()
270
+ * Create a cursor using the specified bitmap data and mask (in MSB format).
271
+ *
272
+ * `mask` has to be in MSB (Most Significant Bit) format.
273
+ *
274
+ * The cursor width (`w`) must be a multiple of 8 bits.
275
+ *
276
+ * The cursor is created in black and white according to the following:
277
+ *
278
+ * - data=0, mask=1: white
279
+ * - data=1, mask=1: black
280
+ * - data=0, mask=0: transparent
281
+ * - data=1, mask=0: inverted color if possible, black if not.
282
+ *
283
+ * Cursors created with this function must be freed with SDL_FreeCursor().
284
+ *
285
+ * If you want to have a color cursor, or create your cursor from an
286
+ * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can
287
+ * hide the cursor and draw your own as part of your game's rendering, but it
288
+ * will be bound to the framerate.
289
+ *
290
+ * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which
291
+ * provides twelve readily available system cursors to pick from.
292
+ *
293
+ * \param data the color value for each pixel of the cursor
294
+ * \param mask the mask value for each pixel of the cursor
295
+ * \param w the width of the cursor
296
+ * \param h the height of the cursor
297
+ * \param hot_x the X-axis location of the upper left corner of the cursor
298
+ * relative to the actual mouse position
299
+ * \param hot_y the Y-axis location of the upper left corner of the cursor
300
+ * relative to the actual mouse position
301
+ * \returns a new cursor with the specified parameters on success or NULL on
302
+ * failure; call SDL_GetError() for more information.
303
+ *
304
+ * \since This function is available since SDL 2.0.0.
305
+ *
306
+ * \sa SDL_FreeCursor
307
+ * \sa SDL_SetCursor
308
+ * \sa SDL_ShowCursor
219
309
  */
220
310
  extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
221
311
  const Uint8 * mask,
@@ -223,60 +313,123 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
223
313
  int hot_y);
224
314
 
225
315
  /**
226
- * \brief Create a color cursor.
316
+ * Create a color cursor.
317
+ *
318
+ * \param surface an SDL_Surface structure representing the cursor image
319
+ * \param hot_x the x position of the cursor hot spot
320
+ * \param hot_y the y position of the cursor hot spot
321
+ * \returns the new cursor on success or NULL on failure; call SDL_GetError()
322
+ * for more information.
323
+ *
324
+ * \since This function is available since SDL 2.0.0.
227
325
  *
228
- * \sa SDL_FreeCursor()
326
+ * \sa SDL_CreateCursor
327
+ * \sa SDL_FreeCursor
229
328
  */
230
329
  extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
231
330
  int hot_x,
232
331
  int hot_y);
233
332
 
234
333
  /**
235
- * \brief Create a system cursor.
334
+ * Create a system cursor.
236
335
  *
237
- * \sa SDL_FreeCursor()
336
+ * \param id an SDL_SystemCursor enum value
337
+ * \returns a cursor on success or NULL on failure; call SDL_GetError() for
338
+ * more information.
339
+ *
340
+ * \since This function is available since SDL 2.0.0.
341
+ *
342
+ * \sa SDL_FreeCursor
238
343
  */
239
344
  extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
240
345
 
241
346
  /**
242
- * \brief Set the active cursor.
347
+ * Set the active cursor.
348
+ *
349
+ * This function sets the currently active cursor to the specified one. If the
350
+ * cursor is currently visible, the change will be immediately represented on
351
+ * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if
352
+ * this is desired for any reason.
353
+ *
354
+ * \param cursor a cursor to make active
355
+ *
356
+ * \since This function is available since SDL 2.0.0.
357
+ *
358
+ * \sa SDL_CreateCursor
359
+ * \sa SDL_GetCursor
360
+ * \sa SDL_ShowCursor
243
361
  */
244
362
  extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
245
363
 
246
364
  /**
247
- * \brief Return the active cursor.
365
+ * Get the active cursor.
366
+ *
367
+ * This function returns a pointer to the current cursor which is owned by the
368
+ * library. It is not necessary to free the cursor with SDL_FreeCursor().
369
+ *
370
+ * \returns the active cursor or NULL if there is no mouse.
371
+ *
372
+ * \since This function is available since SDL 2.0.0.
373
+ *
374
+ * \sa SDL_SetCursor
248
375
  */
249
376
  extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
250
377
 
251
378
  /**
252
- * \brief Return the default cursor.
379
+ * Get the default cursor.
380
+ *
381
+ * \returns the default cursor on success or NULL on failure.
382
+ *
383
+ * \since This function is available since SDL 2.0.0.
384
+ *
385
+ * \sa SDL_CreateSystemCursor
253
386
  */
254
387
  extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
255
388
 
256
389
  /**
257
- * \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
390
+ * Free a previously-created cursor.
391
+ *
392
+ * Use this function to free cursor resources created with SDL_CreateCursor(),
393
+ * SDL_CreateColorCursor() or SDL_CreateSystemCursor().
258
394
  *
259
- * \sa SDL_CreateCursor()
260
- * \sa SDL_CreateColorCursor()
261
- * \sa SDL_CreateSystemCursor()
395
+ * \param cursor the cursor to free
396
+ *
397
+ * \since This function is available since SDL 2.0.0.
398
+ *
399
+ * \sa SDL_CreateColorCursor
400
+ * \sa SDL_CreateCursor
401
+ * \sa SDL_CreateSystemCursor
262
402
  */
263
403
  extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
264
404
 
265
405
  /**
266
- * \brief Toggle whether or not the cursor is shown.
406
+ * Toggle whether or not the cursor is shown.
407
+ *
408
+ * The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE`
409
+ * displays the cursor and passing `SDL_DISABLE` hides it.
410
+ *
411
+ * The current state of the mouse cursor can be queried by passing
412
+ * `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned.
267
413
  *
268
- * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
269
- * state.
414
+ * \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it,
415
+ * `SDL_QUERY` to query the current state without changing it.
416
+ * \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the
417
+ * cursor is hidden, or a negative error code on failure; call
418
+ * SDL_GetError() for more information.
270
419
  *
271
- * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
420
+ * \since This function is available since SDL 2.0.0.
421
+ *
422
+ * \sa SDL_CreateCursor
423
+ * \sa SDL_SetCursor
272
424
  */
273
425
  extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
274
426
 
275
427
  /**
276
- * Used as a mask when testing buttons in buttonstate.
277
- * - Button 1: Left mouse button
278
- * - Button 2: Middle mouse button
279
- * - Button 3: Right mouse button
428
+ * Used as a mask when testing buttons in buttonstate.
429
+ *
430
+ * - Button 1: Left mouse button
431
+ * - Button 2: Middle mouse button
432
+ * - Button 3: Right mouse button
280
433
  */
281
434
  #define SDL_BUTTON(X) (1 << ((X)-1))
282
435
  #define SDL_BUTTON_LEFT 1
@@ -290,7 +443,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
290
443
  #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
291
444
  #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
292
445
 
293
-
294
446
  /* Ends C function definitions when using C++ */
295
447
  #ifdef __cplusplus
296
448
  }