World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл SDL_mouse.h

См. исходные тексты.

Определения типов

typedef struct SDL_Cursor SDL_Cursor
 

Перечисления

enum  SDL_SystemCursor {
  SDL_SYSTEM_CURSOR_ARROW, SDL_SYSTEM_CURSOR_IBEAM, SDL_SYSTEM_CURSOR_WAIT, SDL_SYSTEM_CURSOR_CROSSHAIR,
  SDL_SYSTEM_CURSOR_WAITARROW, SDL_SYSTEM_CURSOR_SIZENWSE, SDL_SYSTEM_CURSOR_SIZENESW, SDL_SYSTEM_CURSOR_SIZEWE,
  SDL_SYSTEM_CURSOR_SIZENS, SDL_SYSTEM_CURSOR_SIZEALL, SDL_SYSTEM_CURSOR_NO, SDL_SYSTEM_CURSOR_HAND,
  SDL_NUM_SYSTEM_CURSORS
}
 Cursor types for SDL_CreateSystemCursor(). Подробнее...
 
enum  SDL_MouseWheelDirection { SDL_MOUSEWHEEL_NORMAL, SDL_MOUSEWHEEL_FLIPPED }
 Scroll direction types for the Scroll event. Подробнее...
 

Функции

DECLSPEC SDL_Window *SDLCALL SDL_GetMouseFocus (void)
 Get the window which currently has mouse focus. Подробнее...
 
DECLSPEC Uint32 SDLCALL SDL_GetMouseState (int *x, int *y)
 Retrieve the current state of the mouse. Подробнее...
 
DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState (int *x, int *y)
 Get the current state of the mouse, in relation to the desktop. Подробнее...
 
DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState (int *x, int *y)
 Retrieve the relative state of the mouse. Подробнее...
 
DECLSPEC void SDLCALL SDL_WarpMouseInWindow (SDL_Window *window, int x, int y)
 Moves the mouse to the given position within the window. Подробнее...
 
DECLSPEC int SDLCALL SDL_WarpMouseGlobal (int x, int y)
 Moves the mouse to the given position in global screen space. Подробнее...
 
DECLSPEC int SDLCALL SDL_SetRelativeMouseMode (SDL_bool enabled)
 Set relative mouse mode. Подробнее...
 
DECLSPEC int SDLCALL SDL_CaptureMouse (SDL_bool enabled)
 Capture the mouse, to track input outside an SDL window. Подробнее...
 
DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode (void)
 Query whether relative mouse mode is enabled. Подробнее...
 
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor (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). Подробнее...
 
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor (SDL_Surface *surface, int hot_x, int hot_y)
 Create a color cursor. Подробнее...
 
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor (SDL_SystemCursor id)
 Create a system cursor. Подробнее...
 
DECLSPEC void SDLCALL SDL_SetCursor (SDL_Cursor *cursor)
 Set the active cursor. Подробнее...
 
DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor (void)
 Return the active cursor. Подробнее...
 
DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor (void)
 Return the default cursor. Подробнее...
 
DECLSPEC void SDLCALL SDL_FreeCursor (SDL_Cursor *cursor)
 Frees a cursor created with SDL_CreateCursor() or similar functions. Подробнее...
 
DECLSPEC int SDLCALL SDL_ShowCursor (int toggle)
 Toggle whether or not the cursor is shown. Подробнее...
 

Подробное описание

Include file for SDL mouse event handling.

См. определение в файле SDL_mouse.h

Типы

◆ SDL_Cursor

typedef struct SDL_Cursor SDL_Cursor

Implementation dependent

См. определение в файле SDL_mouse.h строка 41

Перечисления

◆ SDL_SystemCursor

Cursor types for SDL_CreateSystemCursor().

Элементы перечислений
SDL_SYSTEM_CURSOR_ARROW 

Arrow

SDL_SYSTEM_CURSOR_IBEAM 

I-beam

SDL_SYSTEM_CURSOR_WAIT 

Wait

SDL_SYSTEM_CURSOR_CROSSHAIR 

Crosshair

SDL_SYSTEM_CURSOR_WAITARROW 

Small wait cursor (or Wait if not available)

SDL_SYSTEM_CURSOR_SIZENWSE 

Double arrow pointing northwest and southeast

SDL_SYSTEM_CURSOR_SIZENESW 

Double arrow pointing northeast and southwest

SDL_SYSTEM_CURSOR_SIZEWE 

Double arrow pointing west and east

SDL_SYSTEM_CURSOR_SIZENS 

Double arrow pointing north and south

SDL_SYSTEM_CURSOR_SIZEALL 

Four pointed arrow pointing north, south, east, and west

SDL_SYSTEM_CURSOR_NO 

Slashed circle or crossbones

SDL_SYSTEM_CURSOR_HAND 

Hand

SDL_NUM_SYSTEM_CURSORS 

См. определение в файле SDL_mouse.h строка 46

◆ SDL_MouseWheelDirection

Scroll direction types for the Scroll event.

Элементы перечислений
SDL_MOUSEWHEEL_NORMAL 

The scroll direction is normal

SDL_MOUSEWHEEL_FLIPPED 

The scroll direction is flipped / natural

См. определение в файле SDL_mouse.h строка 66

Функции

◆ SDL_GetMouseFocus()

DECLSPEC SDL_Window* SDLCALL SDL_GetMouseFocus ( void  )

Get the window which currently has mouse focus.

◆ SDL_GetMouseState()

DECLSPEC Uint32 SDLCALL SDL_GetMouseState ( int *  x,
int *  y 
)

Retrieve the current state of the mouse.

The current button state is returned as a button bitmask, which can be tested using the SDL_BUTTON(X) macros, and x and y are set to the mouse cursor position relative to the focus window for the currently selected mouse. You can pass NULL for either x or y.

Используется в Sdl2Window::TransformCursorPos().

+ Граф вызова функции:

◆ SDL_GetGlobalMouseState()

DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState ( int *  x,
int *  y 
)

Get the current state of the mouse, in relation to the desktop.

This works just like SDL_GetMouseState(), but the coordinates will be reported relative to the top-left of the desktop. This can be useful if you need to track the mouse outside of a specific window and SDL_CaptureMouse() doesn't fit your needs. For example, it could be useful if you need to track the mouse while dragging a window, where coordinates relative to a window might not be in sync at all times.

Заметки
SDL_GetMouseState() returns the mouse position as SDL understands it from the last pump of the event queue. This function, however, queries the OS for the current mouse position, and as such, might be a slightly less efficient function. Unless you know what you're doing and have a good reason to use this function, you probably want SDL_GetMouseState() instead.
Аргументы
xReturns the current X coord, relative to the desktop. Can be NULL.
yReturns the current Y coord, relative to the desktop. Can be NULL.
Возвращает
The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
См. также
SDL_GetMouseState

◆ SDL_GetRelativeMouseState()

DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState ( int *  x,
int *  y 
)

Retrieve the relative state of the mouse.

The current button state is returned as a button bitmask, which can be tested using the SDL_BUTTON(X) macros, and x and y are set to the mouse deltas since the last call to SDL_GetRelativeMouseState().

◆ SDL_WarpMouseInWindow()

DECLSPEC void SDLCALL SDL_WarpMouseInWindow ( SDL_Window window,
int  x,
int  y 
)

Moves the mouse to the given position within the window.

Аргументы
windowThe window to move the mouse into, or NULL for the current mouse focus
xThe x coordinate within the window
yThe y coordinate within the window
Заметки
This function generates a mouse motion event

◆ SDL_WarpMouseGlobal()

DECLSPEC int SDLCALL SDL_WarpMouseGlobal ( int  x,
int  y 
)

Moves the mouse to the given position in global screen space.

Аргументы
xThe x coordinate
yThe y coordinate
Возвращает
0 on success, -1 on error (usually: unsupported by a platform).
Заметки
This function generates a mouse motion event

◆ SDL_SetRelativeMouseMode()

DECLSPEC int SDLCALL SDL_SetRelativeMouseMode ( SDL_bool  enabled)

Set relative mouse mode.

Аргументы
enabledWhether or not to enable relative mode
Возвращает
0 on success, or -1 if relative mode is not supported.

While the mouse is in relative mode, the cursor is hidden, and the driver will try to report continuous motion in the current window. Only relative motion events will be delivered, the mouse position will not change.

Заметки
This function will flush any pending mouse motion.
См. также
SDL_GetRelativeMouseMode()

◆ SDL_CaptureMouse()

DECLSPEC int SDLCALL SDL_CaptureMouse ( SDL_bool  enabled)

Capture the mouse, to track input outside an SDL window.

Аргументы
enabledWhether or not to enable capturing

Capturing enables your app to obtain mouse events globally, instead of just within your window. Not all video targets support this function. When capturing is enabled, the current window will get all mouse events, but unlike relative mode, no change is made to the cursor and it is not restrained to your window.

This function may also deny mouse input to other windows–both those in your application and others on the system–so you should use this function sparingly, and in small bursts. For example, you might want to track the mouse while the user is dragging something, until the user releases a mouse button. It is not recommended that you capture the mouse for long periods of time, such as the entire time your app is running.

While captured, mouse events still report coordinates relative to the current (foreground) window, but those coordinates may be outside the bounds of the window (including negative values). Capturing is only allowed for the foreground window. If the window loses focus while capturing, the capture will be disabled automatically.

While capturing is enabled, the current window will have the SDL_WINDOW_MOUSE_CAPTURE flag set.

Возвращает
0 on success, or -1 if not supported.

◆ SDL_GetRelativeMouseMode()

DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode ( void  )

Query whether relative mouse mode is enabled.

См. также
SDL_SetRelativeMouseMode()

◆ SDL_CreateCursor()

DECLSPEC SDL_Cursor* SDLCALL SDL_CreateCursor ( 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).

The cursor width must be a multiple of 8 bits.

The cursor is created in black and white according to the following:

data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black if not.
См. также
SDL_FreeCursor()

◆ SDL_CreateColorCursor()

DECLSPEC SDL_Cursor* SDLCALL SDL_CreateColorCursor ( SDL_Surface surface,
int  hot_x,
int  hot_y 
)

Create a color cursor.

См. также
SDL_FreeCursor()

◆ SDL_CreateSystemCursor()

DECLSPEC SDL_Cursor* SDLCALL SDL_CreateSystemCursor ( SDL_SystemCursor  id)

Create a system cursor.

См. также
SDL_FreeCursor()

◆ SDL_SetCursor()

DECLSPEC void SDLCALL SDL_SetCursor ( SDL_Cursor cursor)

Set the active cursor.

◆ SDL_GetCursor()

DECLSPEC SDL_Cursor* SDLCALL SDL_GetCursor ( void  )

Return the active cursor.

◆ SDL_GetDefaultCursor()

DECLSPEC SDL_Cursor* SDLCALL SDL_GetDefaultCursor ( void  )

Return the default cursor.

◆ SDL_FreeCursor()

DECLSPEC void SDLCALL SDL_FreeCursor ( SDL_Cursor cursor)

Frees a cursor created with SDL_CreateCursor() or similar functions.

См. также
SDL_CreateCursor()
SDL_CreateColorCursor()
SDL_CreateSystemCursor()

◆ SDL_ShowCursor()

DECLSPEC int SDLCALL SDL_ShowCursor ( int  toggle)

Toggle whether or not the cursor is shown.

Аргументы
toggle1 to show the cursor, 0 to hide it, -1 to query the current state.
Возвращает
1 if the cursor is shown, or 0 if the cursor is hidden.
SDL_SYSTEM_CURSOR_HAND
@ SDL_SYSTEM_CURSOR_HAND
Definition: SDL_mouse.h:59
SDL_NUM_SYSTEM_CURSORS
@ SDL_NUM_SYSTEM_CURSORS
Definition: SDL_mouse.h:60
SDL_SYSTEM_CURSOR_WAITARROW
@ SDL_SYSTEM_CURSOR_WAITARROW
Definition: SDL_mouse.h:52
SDL_SYSTEM_CURSOR_CROSSHAIR
@ SDL_SYSTEM_CURSOR_CROSSHAIR
Definition: SDL_mouse.h:51
SDL_SYSTEM_CURSOR_SIZENESW
@ SDL_SYSTEM_CURSOR_SIZENESW
Definition: SDL_mouse.h:54
SDL_SYSTEM_CURSOR_SIZEALL
@ SDL_SYSTEM_CURSOR_SIZEALL
Definition: SDL_mouse.h:57
SDL_SystemCursor
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor().
Definition: SDL_mouse.h:46
SDL_SYSTEM_CURSOR_IBEAM
@ SDL_SYSTEM_CURSOR_IBEAM
Definition: SDL_mouse.h:49
SDL_MOUSEWHEEL_FLIPPED
@ SDL_MOUSEWHEEL_FLIPPED
Definition: SDL_mouse.h:69
SDL_SYSTEM_CURSOR_NO
@ SDL_SYSTEM_CURSOR_NO
Definition: SDL_mouse.h:58
SDL_SYSTEM_CURSOR_WAIT
@ SDL_SYSTEM_CURSOR_WAIT
Definition: SDL_mouse.h:50
SDL_SYSTEM_CURSOR_SIZEWE
@ SDL_SYSTEM_CURSOR_SIZEWE
Definition: SDL_mouse.h:55
SDL_MOUSEWHEEL_NORMAL
@ SDL_MOUSEWHEEL_NORMAL
Definition: SDL_mouse.h:68
SDL_SYSTEM_CURSOR_SIZENWSE
@ SDL_SYSTEM_CURSOR_SIZENWSE
Definition: SDL_mouse.h:53
SDL_MouseWheelDirection
SDL_MouseWheelDirection
Scroll direction types for the Scroll event.
Definition: SDL_mouse.h:66
SDL_SYSTEM_CURSOR_ARROW
@ SDL_SYSTEM_CURSOR_ARROW
Definition: SDL_mouse.h:48
SDL_SYSTEM_CURSOR_SIZENS
@ SDL_SYSTEM_CURSOR_SIZENS
Definition: SDL_mouse.h:56