#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.
Data Structures | |
struct | SDL_Cursor |
Defines | |
#define | SDL_BUTTON(X) (1 << ((X)-1)) |
#define | SDL_BUTTON_LEFT 1 |
#define | SDL_BUTTON_MIDDLE 2 |
#define | SDL_BUTTON_RIGHT 3 |
#define | SDL_BUTTON_WHEELUP 4 |
#define | SDL_BUTTON_WHEELDOWN 5 |
#define | SDL_BUTTON_X1 6 |
#define | SDL_BUTTON_X2 7 |
#define | SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) |
#define | SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) |
#define | SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) |
#define | SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) |
#define | SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) |
Typedefs | |
typedef struct WMcursor | WMcursor |
Functions | |
DECLSPEC Uint8 SDLCALL | SDL_GetMouseState (int *x, int *y) |
DECLSPEC Uint8 SDLCALL | SDL_GetRelativeMouseState (int *x, int *y) |
DECLSPEC void SDLCALL | SDL_WarpMouse (Uint16 x, Uint16 y) |
DECLSPEC SDL_Cursor *SDLCALL | SDL_CreateCursor (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) |
DECLSPEC void SDLCALL | SDL_SetCursor (SDL_Cursor *cursor) |
DECLSPEC SDL_Cursor *SDLCALL | SDL_GetCursor (void) |
DECLSPEC void SDLCALL | SDL_FreeCursor (SDL_Cursor *cursor) |
DECLSPEC int SDLCALL | SDL_ShowCursor (int toggle) |
#define SDL_BUTTON | ( | X | ) | (1 << ((X)-1)) |
Used as a mask when testing buttons in buttonstate Button 1: Left mouse button Button 2: Middle mouse button Button 3: Right mouse button Button 4: Mouse wheel up (may also be a real button) Button 5: Mouse wheel down (may also be a real button)
DECLSPEC SDL_Cursor* SDLCALL SDL_CreateCursor | ( | Uint8 * | data, | |
Uint8 * | mask, | |||
int | w, | |||
int | h, | |||
int | hot_x, | |||
int | hot_y | |||
) |
Create a cursor using the specified 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.
Cursors created with this function must be freed with SDL_FreeCursor().
DECLSPEC void SDLCALL SDL_FreeCursor | ( | SDL_Cursor * | cursor | ) |
Deallocates a cursor created with SDL_CreateCursor().
DECLSPEC SDL_Cursor* SDLCALL SDL_GetCursor | ( | void | ) |
Returns the currently active cursor.
DECLSPEC Uint8 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 current mouse cursor position. You can pass NULL for either x or y.
DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState | ( | 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 deltas since the last call to SDL_GetRelativeMouseState().
DECLSPEC void SDLCALL SDL_SetCursor | ( | SDL_Cursor * | cursor | ) |
Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display.
DECLSPEC int SDLCALL SDL_ShowCursor | ( | int | toggle | ) |
Toggle whether or not the cursor is shown on the screen. The cursor start off displayed, but can be turned off. SDL_ShowCursor() returns 1 if the cursor was being displayed before the call, or 0 if it was not. You can query the current state by passing a 'toggle' value of -1.
DECLSPEC void SDLCALL SDL_WarpMouse | ( | Uint16 | x, | |
Uint16 | y | |||
) |
Set the position of the mouse cursor (generates a mouse motion event)