zenilib
0.5.3.0
|
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Macros | |
#define | SDL_BUTTON(X) (1 << ((X)-1)) |
#define | SDL_BUTTON_LEFT 1 |
#define | SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) |
#define | SDL_BUTTON_MIDDLE 2 |
#define | SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) |
#define | SDL_BUTTON_RIGHT 3 |
#define | SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) |
#define | SDL_BUTTON_X1 4 |
#define | SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) |
#define | SDL_BUTTON_X2 5 |
#define | SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) |
Typedefs | |
typedef struct SDL_Cursor | SDL_Cursor |
Enumerations | |
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. More... | |
Include file for SDL mouse event handling.
Definition in file SDL_mouse.h.
#define SDL_BUTTON | ( | X | ) | (1 << ((X)-1)) |
Used as a mask when testing buttons in buttonstate.
Definition at line 203 of file SDL_mouse.h.
Referenced by SDL_ResetMouse(), and SDL_SendMouseButton().
#define SDL_BUTTON_LEFT 1 |
Definition at line 204 of file SDL_mouse.h.
Referenced by Zeni::Widget_Button::on_mouse_button(), Zeni::Slider::on_mouse_button(), Zeni::Selector::on_mouse_button(), Zeni::Text_Box::on_mouse_button(), Zeni::Widget_Button::on_mouse_motion(), and Zeni::Game::run().
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) |
Definition at line 209 of file SDL_mouse.h.
#define SDL_BUTTON_MIDDLE 2 |
Definition at line 205 of file SDL_mouse.h.
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) |
Definition at line 210 of file SDL_mouse.h.
#define SDL_BUTTON_RIGHT 3 |
Definition at line 206 of file SDL_mouse.h.
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) |
Definition at line 211 of file SDL_mouse.h.
#define SDL_BUTTON_X1 4 |
Definition at line 207 of file SDL_mouse.h.
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) |
Definition at line 212 of file SDL_mouse.h.
#define SDL_BUTTON_X2 5 |
Definition at line 208 of file SDL_mouse.h.
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) |
Definition at line 213 of file SDL_mouse.h.
typedef struct SDL_Cursor SDL_Cursor |
Definition at line 41 of file SDL_mouse.h.
enum SDL_SystemCursor |
Cursor types for SDL_CreateSystemCursor.
Definition at line 46 of file SDL_mouse.h.
DECLSPEC SDL_Cursor* SDLCALL SDL_CreateColorCursor | ( | SDL_Surface * | surface, |
int | hot_x, | ||
int | hot_y | ||
) |
Create a color cursor.
Definition at line 535 of file SDL_mouse.c.
References SDL_Mouse::CreateCursor, SDL_Mouse::cursors, SDL_Surface::format, SDL_PixelFormat::format, SDL_Surface::h, SDL_Cursor::next, NULL, SDL_ConvertSurfaceFormat(), SDL_FreeSurface(), SDL_GetMouse(), SDL_PIXELFORMAT_ARGB8888, SDL_SetError(), and SDL_Surface::w.
Referenced by 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. |
Definition at line 486 of file SDL_mouse.c.
References NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_CreateColorCursor(), SDL_CreateRGBSurface(), and SDL_FreeSurface().
DECLSPEC SDL_Cursor* SDLCALL SDL_CreateSystemCursor | ( | SDL_SystemCursor | id | ) |
Create a system cursor.
Definition at line 578 of file SDL_mouse.c.
References SDL_Mouse::CreateSystemCursor, SDL_Mouse::cursors, SDL_Cursor::next, NULL, SDL_GetMouse(), and SDL_SetError().
DECLSPEC void SDLCALL SDL_FreeCursor | ( | SDL_Cursor * | cursor | ) |
Frees a cursor created with SDL_CreateCursor().
Definition at line 664 of file SDL_mouse.c.
References SDL_Mouse::cur_cursor, SDL_Mouse::cursors, SDL_Mouse::def_cursor, SDL_Mouse::FreeCursor, SDL_Cursor::next, NULL, SDL_GetMouse(), and SDL_SetCursor().
Referenced by SDL_MouseQuit().
DECLSPEC SDL_Cursor* SDLCALL SDL_GetCursor | ( | void | ) |
Return the active cursor.
Definition at line 642 of file SDL_mouse.c.
References SDL_Mouse::cur_cursor, NULL, and SDL_GetMouse().
DECLSPEC SDL_Cursor* SDLCALL SDL_GetDefaultCursor | ( | void | ) |
Return the default cursor.
Definition at line 653 of file SDL_mouse.c.
References SDL_Mouse::def_cursor, NULL, and SDL_GetMouse().
DECLSPEC SDL_Window* SDLCALL SDL_GetMouseFocus | ( | void | ) |
Get the window which currently has mouse focus.
Definition at line 68 of file SDL_mouse.c.
References SDL_Mouse::focus, and SDL_GetMouse().
Referenced by SDL_DestroyWindow(), and SDL_RestoreMousePosition().
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.
Definition at line 382 of file SDL_mouse.c.
References SDL_Mouse::buttonstate, SDL_GetMouse(), SDL_Mouse::x, and SDL_Mouse::y.
Referenced by Zeni::Game::run(), and SDL_RestoreMousePosition().
Query whether relative mouse mode is enabled.
Definition at line 478 of file SDL_mouse.c.
References SDL_Mouse::relative_mode, and SDL_GetMouse().
Referenced by Zeni::Window::get_mouse_state(), SDL_ShowMessageBox(), and SDLTest_CommonEvent().
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().
Definition at line 396 of file SDL_mouse.c.
References SDL_Mouse::buttonstate, SDL_GetMouse(), SDL_Mouse::xdelta, and SDL_Mouse::ydelta.
DECLSPEC void SDLCALL SDL_SetCursor | ( | SDL_Cursor * | cursor | ) |
Set the active cursor.
Definition at line 602 of file SDL_mouse.c.
References SDL_Mouse::cur_cursor, SDL_Mouse::cursor_shown, SDL_Mouse::cursors, SDL_Mouse::def_cursor, SDL_Mouse::focus, SDL_Cursor::next, NULL, SDL_Mouse::relative_mode, SDL_GetMouse(), SDL_SetError(), and SDL_Mouse::ShowCursor.
Referenced by SDL_FreeCursor(), SDL_SetDefaultCursor(), SDL_SetMouseFocus(), SDL_SetRelativeMouseMode(), and SDL_ShowCursor().
Set relative mouse mode.
enabled | Whether or not to enable relative mode |
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.
Definition at line 430 of file SDL_mouse.c.
References SDL_Mouse::focus, SDL_Window::h, NULL, SDL_Mouse::original_x, SDL_Mouse::original_y, SDL_Mouse::relative_mode, SDL_FlushEvent(), SDL_GetKeyboardFocus(), SDL_GetMouse(), SDL_MOUSEMOTION, SDL_SetCursor(), SDL_SetMouseFocus(), SDL_Unsupported, SDL_WarpMouseInWindow(), SDL_Mouse::SetRelativeMouseMode, SDL_Window::w, SDL_Mouse::x, and SDL_Mouse::y.
Referenced by SDL_ShowMessageBox(), SDLTest_CommonEvent(), and Zeni::Window::set_mouse_state().
Toggle whether or not the cursor is shown.
toggle | 1 to show the cursor, 0 to hide it, -1 to query the current state. |
Definition at line 698 of file SDL_mouse.c.
References SDL_Mouse::cursor_shown, NULL, SDL_FALSE, SDL_GetMouse(), SDL_SetCursor(), and SDL_TRUE.
Referenced by Zeni::Window::get_mouse_state(), SDL_MouseQuit(), SDL_ShowMessageBox(), and Zeni::Window::set_mouse_state().
Moves the mouse to the given position within the window.
window | The window to move the mouse into, or NULL for the current mouse focus |
x | The x coordinate within the window |
y | The y coordinate within the window |
Definition at line 412 of file SDL_mouse.c.
References SDL_Mouse::focus, SDL_Mouse::mouseID, NULL, SDL_GetMouse(), SDL_SendMouseMotion(), and SDL_Mouse::WarpMouse.
Referenced by Zeni::Game::run(), SDL_OnWindowFocusGained(), SDL_RestoreMousePosition(), and SDL_SetRelativeMouseMode().