SDL_mouse.h 21 KB

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