4#include <SDL3/SDL_mouse.h>
5#include "SDL3pp_stdinc.h"
6#include "SDL3pp_video.h"
65 SDL_SYSTEM_CURSOR_DEFAULT;
68 SDL_SYSTEM_CURSOR_TEXT;
76 SDL_SYSTEM_CURSOR_CROSSHAIR;
84 SDL_SYSTEM_CURSOR_NWSE_RESIZE;
88 SDL_SYSTEM_CURSOR_NESW_RESIZE;
92 SDL_SYSTEM_CURSOR_EW_RESIZE;
95 SDL_SYSTEM_CURSOR_NS_RESIZE;
106 SDL_SYSTEM_CURSOR_NOT_ALLOWED;
120 SDL_SYSTEM_CURSOR_N_RESIZE;
123 SDL_SYSTEM_CURSOR_NE_RESIZE;
127 SDL_SYSTEM_CURSOR_E_RESIZE;
130 SDL_SYSTEM_CURSOR_SE_RESIZE;
134 SDL_SYSTEM_CURSOR_S_RESIZE;
137 SDL_SYSTEM_CURSOR_SW_RESIZE;
141 SDL_SYSTEM_CURSOR_W_RESIZE;
334 void reset(SDL_Cursor* newResource = {})
336 SDL_DestroyCursor(
release(newResource));
355 constexpr explicit Cursor(SDL_Cursor* resource = {})
360 constexpr Cursor(
const Cursor& other) =
delete;
406 SDL_MOUSEWHEEL_NORMAL;
409 SDL_MOUSEWHEEL_FLIPPED;
436 return SDL_BUTTON_MASK(button);
509 return CheckError(SDL_GetMouseNameForID(instance_id));
556 return SDL_GetMouseState(x, y);
596 return SDL_GetGlobalMouseState(x, y);
634 return SDL_GetRelativeMouseState(x, y);
659 SDL_WarpMouseInWindow(
get(), x, y);
730 return SDL_GetWindowRelativeMouseMode(
get());
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:43
A SDL managed resource.
Definition SDL3pp_resource.h:17
constexpr SDL_Cursor * release(SDL_Cursor * newResource={})
Return contained resource and empties or replace value.
Definition SDL3pp_resource.h:60
constexpr Resource(T resource={})
Constructs the underlying resource.
Definition SDL3pp_resource.h:22
constexpr SDL_Cursor * get() const
Return contained resource;.
Definition SDL3pp_resource.h:57
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:206
constexpr SystemCursor SYSTEM_CURSOR_MOVE
Four pointed arrow pointing north, south, east, and west.
Definition SDL3pp_mouse.h:100
constexpr SystemCursor SYSTEM_CURSOR_POINTER
Pointer that indicates a link.
Definition SDL3pp_mouse.h:111
constexpr MouseWheelDirection MOUSEWHEEL_NORMAL
The scroll direction is normal.
Definition SDL3pp_mouse.h:405
SDL_SystemCursor SystemCursor
Cursor types for CursorBase.CursorBase().
Definition SDL3pp_mouse.h:62
constexpr SystemCursor SYSTEM_CURSOR_SE_RESIZE
Window resize bottom-right.
Definition SDL3pp_mouse.h:129
constexpr MouseButton BUTTON_RIGHT
Right button.
Definition SDL3pp_mouse.h:392
constexpr SystemCursor SYSTEM_CURSOR_W_RESIZE
Window resize left. May be EW_RESIZE.
Definition SDL3pp_mouse.h:140
constexpr MouseButton BUTTON_MIDDLE
Middle button.
Definition SDL3pp_mouse.h:390
CursorRef GetCursor()
Get the active cursor.
Definition SDL3pp_mouse.h:819
constexpr SystemCursor SYSTEM_CURSOR_NESW_RESIZE
Double arrow pointing northeast and southwest.
Definition SDL3pp_mouse.h:87
constexpr MouseWheelDirection MOUSEWHEEL_FLIPPED
The scroll direction is flipped / natural.
Definition SDL3pp_mouse.h:408
MouseButtonFlags GetRelativeMouseState(float *x, float *y)
Query SDL's cache for the synchronous mouse button state and accumulated mouse delta since last call.
Definition SDL3pp_mouse.h:632
constexpr MouseButtonFlags ButtonMask(MouseButton button)
Convert a button index to a button mask.
Definition SDL3pp_mouse.h:434
void CaptureMouse(bool enabled)
Capture the mouse and to track input outside an SDL window.
Definition SDL3pp_mouse.h:778
Uint32 MouseButtonFlags
A bitmask of pressed mouse buttons, as reported by GetMouseState, etc.
Definition SDL3pp_mouse.h:426
void WarpMouse(float x, float y)
Move the mouse cursor to the given position within the window.
Definition SDL3pp_mouse.h:657
constexpr SystemCursor SYSTEM_CURSOR_NW_RESIZE
Window resize top-left.
Definition SDL3pp_mouse.h:117
void WarpMouse(float x, float y)
Move the mouse to the given position in global screen space.
Definition SDL3pp_mouse.h:683
constexpr SystemCursor SYSTEM_CURSOR_CROSSHAIR
Crosshair.
Definition SDL3pp_mouse.h:75
MouseButtonFlags GetGlobalMouseState(float *x, float *y)
Query the platform for the asynchronous mouse button state and the desktop-relative platform-cursor p...
Definition SDL3pp_mouse.h:594
constexpr SystemCursor SYSTEM_CURSOR_NWSE_RESIZE
Double arrow pointing northwest and southeast.
Definition SDL3pp_mouse.h:83
constexpr SystemCursor SYSTEM_CURSOR_E_RESIZE
Window resize right. May be EW_RESIZE.
Definition SDL3pp_mouse.h:126
constexpr MouseButton BUTTON_X1
X1 button.
Definition SDL3pp_mouse.h:394
constexpr SystemCursor SYSTEM_CURSOR_NS_RESIZE
Double arrow pointing north and south.
Definition SDL3pp_mouse.h:94
const char * GetMouseNameForID(MouseID instance_id)
Get the name of a mouse.
Definition SDL3pp_mouse.h:507
constexpr SystemCursor SYSTEM_CURSOR_COUNT
COUNT.
Definition SDL3pp_mouse.h:143
SDL_MouseID MouseID
This is a unique ID for a mouse for the time it is connected to the system, and is never reused for t...
Definition SDL3pp_mouse.h:155
constexpr MouseButtonFlags BUTTON_RMASK
Right button mask.
Definition SDL3pp_mouse.h:445
constexpr SystemCursor SYSTEM_CURSOR_NOT_ALLOWED
Not permitted.
Definition SDL3pp_mouse.h:105
constexpr MouseButton BUTTON_LEFT
Left button.
Definition SDL3pp_mouse.h:388
MouseButtonFlags GetMouseState(float *x, float *y)
Query SDL's cache for the synchronous mouse button state and the window-relative SDL-cursor position.
Definition SDL3pp_mouse.h:554
constexpr MouseButtonFlags BUTTON_LMASK
Left button mask.
Definition SDL3pp_mouse.h:439
constexpr MouseButtonFlags BUTTON_X2MASK
X2 button mask.
Definition SDL3pp_mouse.h:451
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition SDL3pp_mouse.h:728
constexpr SystemCursor SYSTEM_CURSOR_WAIT
Wait.
Definition SDL3pp_mouse.h:73
Uint8 MouseButton
Represents a button index.
Definition SDL3pp_mouse.h:386
constexpr SystemCursor SYSTEM_CURSOR_SW_RESIZE
Window resize bottom-left.
Definition SDL3pp_mouse.h:136
constexpr SystemCursor SYSTEM_CURSOR_NE_RESIZE
Window resize top-right.
Definition SDL3pp_mouse.h:122
constexpr SystemCursor SYSTEM_CURSOR_DEFAULT
Default cursor. Usually an arrow.
Definition SDL3pp_mouse.h:64
constexpr MouseButtonFlags BUTTON_X1MASK
X1 button mask.
Definition SDL3pp_mouse.h:448
constexpr SystemCursor SYSTEM_CURSOR_EW_RESIZE
Double arrow pointing west and east.
Definition SDL3pp_mouse.h:91
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition SDL3pp_mouse.h:712
CursorRef GetDefaultCursor()
Get the default cursor.
Definition SDL3pp_mouse.h:834
WindowRef GetMouseFocus()
Get the window which currently has mouse focus.
Definition SDL3pp_mouse.h:521
bool CursorVisible()
Return whether the cursor is currently being shown.
Definition SDL3pp_mouse.h:880
constexpr MouseButtonFlags BUTTON_MMASK
Middle button mask.
Definition SDL3pp_mouse.h:442
constexpr SystemCursor SYSTEM_CURSOR_N_RESIZE
Window resize top. May be NS_RESIZE.
Definition SDL3pp_mouse.h:119
constexpr SystemCursor SYSTEM_CURSOR_S_RESIZE
Window resize bottom. May be NS_RESIZE.
Definition SDL3pp_mouse.h:133
SDL_MouseWheelDirection MouseWheelDirection
Scroll direction types for the Scroll event.
Definition SDL3pp_mouse.h:403
void SetCursor(CursorBase &cursor)
Set the active cursor.
Definition SDL3pp_mouse.h:800
OwnArray< MouseID > GetMice()
Get a list of currently connected mice.
Definition SDL3pp_mouse.h:485
constexpr SystemCursor SYSTEM_CURSOR_TEXT
Text selection. Usually an I-beam.
Definition SDL3pp_mouse.h:67
void HideCursor()
Hide the cursor.
Definition SDL3pp_mouse.h:865
constexpr MouseButton BUTTON_X2
X2 button.
Definition SDL3pp_mouse.h:396
void ShowCursor()
Show the cursor.
Definition SDL3pp_mouse.h:851
constexpr SystemCursor SYSTEM_CURSOR_PROGRESS
Program is busy but still interactive.
Definition SDL3pp_mouse.h:81
bool HasMouse()
Return whether a mouse is currently connected.
Definition SDL3pp_mouse.h:465
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
The structure used to identify an SDL cursor.
Definition SDL3pp_mouse.h:170
CursorBase(SystemCursor id)
Create a system cursor.
Definition SDL3pp_mouse.h:273
CursorBase(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, int hot_y)
Create a cursor using the specified bitmap data and mask (in MSB format).
Definition SDL3pp_mouse.h:217
CursorBase(SurfaceBase &surface, int hot_x, int hot_y)
Create a color cursor.
Definition SDL3pp_mouse.h:255
Handle to a non owned cursor.
Definition SDL3pp_mouse.h:288
constexpr CursorRef(CursorRef &&other)
Move constructor.
Definition SDL3pp_mouse.h:302
void reset(SDL_Cursor *newResource={})
Free a previously-created cursor.
Definition SDL3pp_mouse.h:334
CursorRef & operator=(CursorRef other)
Assignment operator.
Definition SDL3pp_mouse.h:315
constexpr ~CursorRef()=default
Default constructor.
constexpr CursorRef(const CursorRef &other)
Copy constructor.
Definition SDL3pp_mouse.h:294
Handle to an owned cursor.
Definition SDL3pp_mouse.h:349
constexpr Cursor(Cursor &&other)=default
Move constructor.
constexpr Cursor(SDL_Cursor *resource={})
Constructs from the underlying resource.
Definition SDL3pp_mouse.h:355
Cursor & operator=(Cursor other)
Assignment operator.
Definition SDL3pp_mouse.h:375
~Cursor()
Frees up resource when object goes out of scope.
Definition SDL3pp_mouse.h:370
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:138
Handle to a non owned window.
Definition SDL3pp_video.h:2778