SDL_mouse.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * # CategoryMouse
  20. *
  21. * SDL mouse handling.
  22. */
  23. #ifndef SDL_mouse_h_
  24. #define SDL_mouse_h_
  25. #include <SDL3/SDL_stdinc.h>
  26. #include <SDL3/SDL_error.h>
  27. #include <SDL3/SDL_surface.h>
  28. #include <SDL3/SDL_video.h>
  29. #include <SDL3/SDL_begin_code.h>
  30. /* Set up for C function definitions, even when using C++ */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /**
  35. * This is a unique ID for a mouse for the time it is connected to the system,
  36. * and is never reused for the lifetime of the application.
  37. *
  38. * If the mouse is disconnected and reconnected, it will get a new ID.
  39. *
  40. * The value 0 is an invalid ID.
  41. *
  42. * \since This datatype is available since SDL 3.1.3.
  43. */
  44. typedef Uint32 SDL_MouseID;
  45. /**
  46. * The structure used to identify an SDL cursor.
  47. *
  48. * This is opaque data.
  49. *
  50. * \since This struct is available since SDL 3.1.3.
  51. */
  52. typedef struct SDL_Cursor SDL_Cursor;
  53. /**
  54. * Cursor types for SDL_CreateSystemCursor().
  55. *
  56. * \since This enum is available since SDL 3.1.3.
  57. */
  58. typedef enum SDL_SystemCursor
  59. {
  60. SDL_SYSTEM_CURSOR_DEFAULT, /**< Default cursor. Usually an arrow. */
  61. SDL_SYSTEM_CURSOR_TEXT, /**< Text selection. Usually an I-beam. */
  62. SDL_SYSTEM_CURSOR_WAIT, /**< Wait. Usually an hourglass or watch or spinning ball. */
  63. SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair. */
  64. SDL_SYSTEM_CURSOR_PROGRESS, /**< Program is busy but still interactive. Usually it's WAIT with an arrow. */
  65. SDL_SYSTEM_CURSOR_NWSE_RESIZE, /**< Double arrow pointing northwest and southeast. */
  66. SDL_SYSTEM_CURSOR_NESW_RESIZE, /**< Double arrow pointing northeast and southwest. */
  67. SDL_SYSTEM_CURSOR_EW_RESIZE, /**< Double arrow pointing west and east. */
  68. SDL_SYSTEM_CURSOR_NS_RESIZE, /**< Double arrow pointing north and south. */
  69. SDL_SYSTEM_CURSOR_MOVE, /**< Four pointed arrow pointing north, south, east, and west. */
  70. SDL_SYSTEM_CURSOR_NOT_ALLOWED, /**< Not permitted. Usually a slashed circle or crossbones. */
  71. SDL_SYSTEM_CURSOR_POINTER, /**< Pointer that indicates a link. Usually a pointing hand. */
  72. SDL_SYSTEM_CURSOR_NW_RESIZE, /**< Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE. */
  73. SDL_SYSTEM_CURSOR_N_RESIZE, /**< Window resize top. May be NS_RESIZE. */
  74. SDL_SYSTEM_CURSOR_NE_RESIZE, /**< Window resize top-right. May be NESW_RESIZE. */
  75. SDL_SYSTEM_CURSOR_E_RESIZE, /**< Window resize right. May be EW_RESIZE. */
  76. SDL_SYSTEM_CURSOR_SE_RESIZE, /**< Window resize bottom-right. May be NWSE_RESIZE. */
  77. SDL_SYSTEM_CURSOR_S_RESIZE, /**< Window resize bottom. May be NS_RESIZE. */
  78. SDL_SYSTEM_CURSOR_SW_RESIZE, /**< Window resize bottom-left. May be NESW_RESIZE. */
  79. SDL_SYSTEM_CURSOR_W_RESIZE, /**< Window resize left. May be EW_RESIZE. */
  80. SDL_SYSTEM_CURSOR_COUNT
  81. } SDL_SystemCursor;
  82. /**
  83. * Scroll direction types for the Scroll event
  84. *
  85. * \since This enum is available since SDL 3.1.3.
  86. */
  87. typedef enum SDL_MouseWheelDirection
  88. {
  89. SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
  90. SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
  91. } SDL_MouseWheelDirection;
  92. /**
  93. * A bitmask of pressed mouse buttons, as reported by SDL_GetMouseState, etc.
  94. *
  95. * - Button 1: Left mouse button
  96. * - Button 2: Middle mouse button
  97. * - Button 3: Right mouse button
  98. * - Button 4: Side mouse button 1
  99. * - Button 5: Side mouse button 2
  100. *
  101. * \since This datatype is available since SDL 3.1.3.
  102. *
  103. * \sa SDL_GetMouseState
  104. * \sa SDL_GetGlobalMouseState
  105. * \sa SDL_GetRelativeMouseState
  106. */
  107. typedef Uint32 SDL_MouseButtonFlags;
  108. #define SDL_BUTTON_LEFT 1
  109. #define SDL_BUTTON_MIDDLE 2
  110. #define SDL_BUTTON_RIGHT 3
  111. #define SDL_BUTTON_X1 4
  112. #define SDL_BUTTON_X2 5
  113. #define SDL_BUTTON_MASK(X) (1u << ((X)-1))
  114. #define SDL_BUTTON_LMASK SDL_BUTTON_MASK(SDL_BUTTON_LEFT)
  115. #define SDL_BUTTON_MMASK SDL_BUTTON_MASK(SDL_BUTTON_MIDDLE)
  116. #define SDL_BUTTON_RMASK SDL_BUTTON_MASK(SDL_BUTTON_RIGHT)
  117. #define SDL_BUTTON_X1MASK SDL_BUTTON_MASK(SDL_BUTTON_X1)
  118. #define SDL_BUTTON_X2MASK SDL_BUTTON_MASK(SDL_BUTTON_X2)
  119. /* Function prototypes */
  120. /**
  121. * Return whether a mouse is currently connected.
  122. *
  123. * \returns true if a mouse is connected, false otherwise.
  124. *
  125. * \since This function is available since SDL 3.1.3.
  126. *
  127. * \sa SDL_GetMice
  128. */
  129. extern SDL_DECLSPEC bool SDLCALL SDL_HasMouse(void);
  130. /**
  131. * Get a list of currently connected mice.
  132. *
  133. * Note that this will include any device or virtual driver that includes
  134. * mouse functionality, including some game controllers, KVM switches, etc.
  135. * You should wait for input from a device before you consider it actively in
  136. * use.
  137. *
  138. * \param count a pointer filled in with the number of mice returned, may be
  139. * NULL.
  140. * \returns a 0 terminated array of mouse instance IDs or NULL on failure;
  141. * call SDL_GetError() for more information. This should be freed
  142. * with SDL_free() when it is no longer needed.
  143. *
  144. * \since This function is available since SDL 3.1.3.
  145. *
  146. * \sa SDL_GetMouseNameForID
  147. * \sa SDL_HasMouse
  148. */
  149. extern SDL_DECLSPEC SDL_MouseID * SDLCALL SDL_GetMice(int *count);
  150. /**
  151. * Get the name of a mouse.
  152. *
  153. * This function returns "" if the mouse doesn't have a name.
  154. *
  155. * \param instance_id the mouse instance ID.
  156. * \returns the name of the selected mouse, or NULL on failure; call
  157. * SDL_GetError() for more information.
  158. *
  159. * \since This function is available since SDL 3.1.3.
  160. *
  161. * \sa SDL_GetMice
  162. */
  163. extern SDL_DECLSPEC const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id);
  164. /**
  165. * Get the window which currently has mouse focus.
  166. *
  167. * \returns the window with mouse focus.
  168. *
  169. * \since This function is available since SDL 3.1.3.
  170. */
  171. extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
  172. /**
  173. * Retrieve the current state of the mouse.
  174. *
  175. * The current button state is returned as a button bitmask, which can be
  176. * tested using the SDL_BUTTON_MASK(X) macro (where `X` is generally 1 for the
  177. * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the
  178. * mouse cursor position relative to the focus window. You can pass NULL for
  179. * either `x` or `y`.
  180. *
  181. * \param x the x coordinate of the mouse cursor position relative to the
  182. * focus window.
  183. * \param y the y coordinate of the mouse cursor position relative to the
  184. * focus window.
  185. * \returns a 32-bit button bitmask of the current button state.
  186. *
  187. * \since This function is available since SDL 3.1.3.
  188. *
  189. * \sa SDL_GetGlobalMouseState
  190. * \sa SDL_GetRelativeMouseState
  191. */
  192. extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetMouseState(float *x, float *y);
  193. /**
  194. * Get the current state of the mouse in relation to the desktop.
  195. *
  196. * This works similarly to SDL_GetMouseState(), but the coordinates will be
  197. * reported relative to the top-left of the desktop. This can be useful if you
  198. * need to track the mouse outside of a specific window and SDL_CaptureMouse()
  199. * doesn't fit your needs. For example, it could be useful if you need to
  200. * track the mouse while dragging a window, where coordinates relative to a
  201. * window might not be in sync at all times.
  202. *
  203. * Note: SDL_GetMouseState() returns the mouse position as SDL understands it
  204. * from the last pump of the event queue. This function, however, queries the
  205. * OS for the current mouse position, and as such, might be a slightly less
  206. * efficient function. Unless you know what you're doing and have a good
  207. * reason to use this function, you probably want SDL_GetMouseState() instead.
  208. *
  209. * \param x filled in with the current X coord relative to the desktop; can be
  210. * NULL.
  211. * \param y filled in with the current Y coord relative to the desktop; can be
  212. * NULL.
  213. * \returns the current button state as a bitmask which can be tested using
  214. * the SDL_BUTTON_MASK(X) macros.
  215. *
  216. * \since This function is available since SDL 3.1.3.
  217. *
  218. * \sa SDL_CaptureMouse
  219. * \sa SDL_GetMouseState
  220. */
  221. extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetGlobalMouseState(float *x, float *y);
  222. /**
  223. * Retrieve the relative state of the mouse.
  224. *
  225. * The current button state is returned as a button bitmask, which can be
  226. * tested using the `SDL_BUTTON_MASK(X)` macros (where `X` is generally 1 for
  227. * the left, 2 for middle, 3 for the right button), and `x` and `y` are set to
  228. * the mouse deltas since the last call to SDL_GetRelativeMouseState() or
  229. * since event initialization. You can pass NULL for either `x` or `y`.
  230. *
  231. * \param x a pointer filled with the last recorded x coordinate of the mouse.
  232. * \param y a pointer filled with the last recorded y coordinate of the mouse.
  233. * \returns a 32-bit button bitmask of the relative button state.
  234. *
  235. * \since This function is available since SDL 3.1.3.
  236. *
  237. * \sa SDL_GetMouseState
  238. */
  239. extern SDL_DECLSPEC SDL_MouseButtonFlags SDLCALL SDL_GetRelativeMouseState(float *x, float *y);
  240. /**
  241. * Move the mouse cursor to the given position within the window.
  242. *
  243. * This function generates a mouse motion event if relative mode is not
  244. * enabled. If relative mode is enabled, you can force mouse events for the
  245. * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint.
  246. *
  247. * Note that this function will appear to succeed, but not actually move the
  248. * mouse when used over Microsoft Remote Desktop.
  249. *
  250. * \param window the window to move the mouse into, or NULL for the current
  251. * mouse focus.
  252. * \param x the x coordinate within the window.
  253. * \param y the y coordinate within the window.
  254. *
  255. * \since This function is available since SDL 3.1.3.
  256. *
  257. * \sa SDL_WarpMouseGlobal
  258. */
  259. extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
  260. float x, float y);
  261. /**
  262. * Move the mouse to the given position in global screen space.
  263. *
  264. * This function generates a mouse motion event.
  265. *
  266. * A failure of this function usually means that it is unsupported by a
  267. * platform.
  268. *
  269. * Note that this function will appear to succeed, but not actually move the
  270. * mouse when used over Microsoft Remote Desktop.
  271. *
  272. * \param x the x coordinate.
  273. * \param y the y coordinate.
  274. * \returns true on success or false on failure; call SDL_GetError() for more
  275. * information.
  276. *
  277. * \since This function is available since SDL 3.1.3.
  278. *
  279. * \sa SDL_WarpMouseInWindow
  280. */
  281. extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y);
  282. /**
  283. * Set relative mouse mode for a window.
  284. *
  285. * While the window has focus and relative mouse mode is enabled, the cursor
  286. * is hidden, the mouse position is constrained to the window, and SDL will
  287. * report continuous relative mouse motion even if the mouse is at the edge of
  288. * the window.
  289. *
  290. * This function will flush any pending mouse motion for this window.
  291. *
  292. * \param window the window to change.
  293. * \param enabled true to enable relative mode, false to disable.
  294. * \returns true on success or false on failure; call SDL_GetError() for more
  295. * information.
  296. *
  297. * \since This function is available since SDL 3.1.3.
  298. *
  299. * \sa SDL_GetWindowRelativeMouseMode
  300. */
  301. extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled);
  302. /**
  303. * Query whether relative mouse mode is enabled for a window.
  304. *
  305. * \param window the window to query.
  306. * \returns true if relative mode is enabled for a window or false otherwise.
  307. *
  308. * \since This function is available since SDL 3.1.3.
  309. *
  310. * \sa SDL_SetWindowRelativeMouseMode
  311. */
  312. extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window);
  313. /**
  314. * Capture the mouse and to track input outside an SDL window.
  315. *
  316. * Capturing enables your app to obtain mouse events globally, instead of just
  317. * within your window. Not all video targets support this function. When
  318. * capturing is enabled, the current window will get all mouse events, but
  319. * unlike relative mode, no change is made to the cursor and it is not
  320. * restrained to your window.
  321. *
  322. * This function may also deny mouse input to other windows--both those in
  323. * your application and others on the system--so you should use this function
  324. * sparingly, and in small bursts. For example, you might want to track the
  325. * mouse while the user is dragging something, until the user releases a mouse
  326. * button. It is not recommended that you capture the mouse for long periods
  327. * of time, such as the entire time your app is running. For that, you should
  328. * probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(),
  329. * depending on your goals.
  330. *
  331. * While captured, mouse events still report coordinates relative to the
  332. * current (foreground) window, but those coordinates may be outside the
  333. * bounds of the window (including negative values). Capturing is only allowed
  334. * for the foreground window. If the window loses focus while capturing, the
  335. * capture will be disabled automatically.
  336. *
  337. * While capturing is enabled, the current window will have the
  338. * `SDL_WINDOW_MOUSE_CAPTURE` flag set.
  339. *
  340. * Please note that SDL will attempt to "auto capture" the mouse while the
  341. * user is pressing a button; this is to try and make mouse behavior more
  342. * consistent between platforms, and deal with the common case of a user
  343. * dragging the mouse outside of the window. This means that if you are
  344. * calling SDL_CaptureMouse() only to deal with this situation, you do not
  345. * have to (although it is safe to do so). If this causes problems for your
  346. * app, you can disable auto capture by setting the
  347. * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero.
  348. *
  349. * \param enabled true to enable capturing, false to disable.
  350. * \returns true on success or false on failure; call SDL_GetError() for more
  351. * information.
  352. *
  353. * \since This function is available since SDL 3.1.3.
  354. *
  355. * \sa SDL_GetGlobalMouseState
  356. */
  357. extern SDL_DECLSPEC bool SDLCALL SDL_CaptureMouse(bool enabled);
  358. /**
  359. * Create a cursor using the specified bitmap data and mask (in MSB format).
  360. *
  361. * `mask` has to be in MSB (Most Significant Bit) format.
  362. *
  363. * The cursor width (`w`) must be a multiple of 8 bits.
  364. *
  365. * The cursor is created in black and white according to the following:
  366. *
  367. * - data=0, mask=1: white
  368. * - data=1, mask=1: black
  369. * - data=0, mask=0: transparent
  370. * - data=1, mask=0: inverted color if possible, black if not.
  371. *
  372. * Cursors created with this function must be freed with SDL_DestroyCursor().
  373. *
  374. * If you want to have a color cursor, or create your cursor from an
  375. * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can
  376. * hide the cursor and draw your own as part of your game's rendering, but it
  377. * will be bound to the framerate.
  378. *
  379. * Also, SDL_CreateSystemCursor() is available, which provides several
  380. * readily-available system cursors to pick from.
  381. *
  382. * \param data the color value for each pixel of the cursor.
  383. * \param mask the mask value for each pixel of the cursor.
  384. * \param w the width of the cursor.
  385. * \param h the height of the cursor.
  386. * \param hot_x the x-axis offset from the left of the cursor image to the
  387. * mouse x position, in the range of 0 to `w` - 1.
  388. * \param hot_y the y-axis offset from the top of the cursor image to the
  389. * mouse y position, in the range of 0 to `h` - 1.
  390. * \returns a new cursor with the specified parameters on success or NULL on
  391. * failure; call SDL_GetError() for more information.
  392. *
  393. * \since This function is available since SDL 3.1.3.
  394. *
  395. * \sa SDL_CreateColorCursor
  396. * \sa SDL_CreateSystemCursor
  397. * \sa SDL_DestroyCursor
  398. * \sa SDL_SetCursor
  399. */
  400. extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data,
  401. const Uint8 * mask,
  402. int w, int h, int hot_x,
  403. int hot_y);
  404. /**
  405. * Create a color cursor.
  406. *
  407. * If this function is passed a surface with alternate representations, the
  408. * surface will be interpreted as the content to be used for 100% display
  409. * scale, and the alternate representations will be used for high DPI
  410. * situations. For example, if the original surface is 32x32, then on a 2x
  411. * macOS display or 200% display scale on Windows, a 64x64 version of the
  412. * image will be used, if available. If a matching version of the image isn't
  413. * available, the closest larger size image will be downscaled to the
  414. * appropriate size and be used instead, if available. Otherwise, the closest
  415. * smaller image will be upscaled and be used instead.
  416. *
  417. * \param surface an SDL_Surface structure representing the cursor image.
  418. * \param hot_x the x position of the cursor hot spot.
  419. * \param hot_y the y position of the cursor hot spot.
  420. * \returns the new cursor on success or NULL on failure; call SDL_GetError()
  421. * for more information.
  422. *
  423. * \since This function is available since SDL 3.1.3.
  424. *
  425. * \sa SDL_CreateCursor
  426. * \sa SDL_CreateSystemCursor
  427. * \sa SDL_DestroyCursor
  428. * \sa SDL_SetCursor
  429. */
  430. extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
  431. int hot_x,
  432. int hot_y);
  433. /**
  434. * Create a system cursor.
  435. *
  436. * \param id an SDL_SystemCursor enum value.
  437. * \returns a cursor on success or NULL on failure; call SDL_GetError() for
  438. * more information.
  439. *
  440. * \since This function is available since SDL 3.1.3.
  441. *
  442. * \sa SDL_DestroyCursor
  443. */
  444. extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
  445. /**
  446. * Set the active cursor.
  447. *
  448. * This function sets the currently active cursor to the specified one. If the
  449. * cursor is currently visible, the change will be immediately represented on
  450. * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if
  451. * this is desired for any reason.
  452. *
  453. * \param cursor a cursor to make active.
  454. * \returns true on success or false on failure; call SDL_GetError() for more
  455. * information.
  456. *
  457. * \since This function is available since SDL 3.1.3.
  458. *
  459. * \sa SDL_GetCursor
  460. */
  461. extern SDL_DECLSPEC bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
  462. /**
  463. * Get the active cursor.
  464. *
  465. * This function returns a pointer to the current cursor which is owned by the
  466. * library. It is not necessary to free the cursor with SDL_DestroyCursor().
  467. *
  468. * \returns the active cursor or NULL if there is no mouse.
  469. *
  470. * \since This function is available since SDL 3.1.3.
  471. *
  472. * \sa SDL_SetCursor
  473. */
  474. extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
  475. /**
  476. * Get the default cursor.
  477. *
  478. * You do not have to call SDL_DestroyCursor() on the return value, but it is
  479. * safe to do so.
  480. *
  481. * \returns the default cursor on success or NULL on failuree; call
  482. * SDL_GetError() for more information.
  483. *
  484. * \since This function is available since SDL 3.1.3.
  485. */
  486. extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_GetDefaultCursor(void);
  487. /**
  488. * Free a previously-created cursor.
  489. *
  490. * Use this function to free cursor resources created with SDL_CreateCursor(),
  491. * SDL_CreateColorCursor() or SDL_CreateSystemCursor().
  492. *
  493. * \param cursor the cursor to free.
  494. *
  495. * \since This function is available since SDL 3.1.3.
  496. *
  497. * \sa SDL_CreateColorCursor
  498. * \sa SDL_CreateCursor
  499. * \sa SDL_CreateSystemCursor
  500. */
  501. extern SDL_DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor *cursor);
  502. /**
  503. * Show the cursor.
  504. *
  505. * \returns true on success or false on failure; call SDL_GetError() for more
  506. * information.
  507. *
  508. * \since This function is available since SDL 3.1.3.
  509. *
  510. * \sa SDL_CursorVisible
  511. * \sa SDL_HideCursor
  512. */
  513. extern SDL_DECLSPEC bool SDLCALL SDL_ShowCursor(void);
  514. /**
  515. * Hide the cursor.
  516. *
  517. * \returns true on success or false on failure; call SDL_GetError() for more
  518. * information.
  519. *
  520. * \since This function is available since SDL 3.1.3.
  521. *
  522. * \sa SDL_CursorVisible
  523. * \sa SDL_ShowCursor
  524. */
  525. extern SDL_DECLSPEC bool SDLCALL SDL_HideCursor(void);
  526. /**
  527. * Return whether the cursor is currently being shown.
  528. *
  529. * \returns `true` if the cursor is being shown, or `false` if the cursor is
  530. * hidden.
  531. *
  532. * \since This function is available since SDL 3.1.3.
  533. *
  534. * \sa SDL_HideCursor
  535. * \sa SDL_ShowCursor
  536. */
  537. extern SDL_DECLSPEC bool SDLCALL SDL_CursorVisible(void);
  538. /* Ends C function definitions when using C++ */
  539. #ifdef __cplusplus
  540. }
  541. #endif
  542. #include <SDL3/SDL_close_code.h>
  543. #endif /* SDL_mouse_h_ */