My Project
Loading...
Searching...
No Matches
SDL_mouse.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
28#ifndef SDL_mouse_h_
29#define SDL_mouse_h_
30
31#include "SDL_stdinc.h"
32#include "SDL_error.h"
33#include "SDL_video.h"
34
35#include "begin_code.h"
36/* Set up for C function definitions, even when using C++ */
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41typedef struct SDL_Cursor SDL_Cursor;
46typedef enum
47{
60 SDL_NUM_SYSTEM_CURSORS
62
66typedef enum
67{
71
72/* Function prototypes */
73
81extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
82
104extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
105
133extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
134
152extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
153
173extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
174 int x, int y);
175
196extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
197
221extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
222
267extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
268
278extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
279
321extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
322 const Uint8 * mask,
323 int w, int h, int hot_x,
324 int hot_y);
325
340extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
341 int hot_x,
342 int hot_y);
343
356
373extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
374
387extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
388
398extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
399
414extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
415
436extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
437
445#define SDL_BUTTON(X) (1 << ((X)-1))
446#define SDL_BUTTON_LEFT 1
447#define SDL_BUTTON_MIDDLE 2
448#define SDL_BUTTON_RIGHT 3
449#define SDL_BUTTON_X1 4
450#define SDL_BUTTON_X2 5
451#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
452#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
453#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
454#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
455#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
456
457/* Ends C function definitions when using C++ */
458#ifdef __cplusplus
459}
460#endif
461#include "close_code.h"
462
463#endif /* SDL_mouse_h_ */
464
465/* vi: set ts=4 sw=4 expandtab: */
DECLSPEC int SDLCALL SDL_ShowCursor(int toggle)
DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y)
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, int hot_y)
DECLSPEC SDL_Window *SDLCALL SDL_GetMouseFocus(void)
DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y)
DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window *window, int x, int y)
DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void)
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor().
Definition: SDL_mouse.h:47
@ SDL_SYSTEM_CURSOR_SIZENS
Definition: SDL_mouse.h:56
@ SDL_SYSTEM_CURSOR_HAND
Definition: SDL_mouse.h:59
@ SDL_SYSTEM_CURSOR_ARROW
Definition: SDL_mouse.h:48
@ SDL_SYSTEM_CURSOR_SIZENWSE
Definition: SDL_mouse.h:53
@ SDL_SYSTEM_CURSOR_SIZENESW
Definition: SDL_mouse.h:54
@ SDL_SYSTEM_CURSOR_IBEAM
Definition: SDL_mouse.h:49
@ SDL_SYSTEM_CURSOR_NO
Definition: SDL_mouse.h:58
@ SDL_SYSTEM_CURSOR_WAITARROW
Definition: SDL_mouse.h:52
@ SDL_SYSTEM_CURSOR_SIZEALL
Definition: SDL_mouse.h:57
@ SDL_SYSTEM_CURSOR_WAIT
Definition: SDL_mouse.h:50
@ SDL_SYSTEM_CURSOR_SIZEWE
Definition: SDL_mouse.h:55
@ SDL_SYSTEM_CURSOR_CROSSHAIR
Definition: SDL_mouse.h:51
struct SDL_Cursor SDL_Cursor
Definition: SDL_mouse.h:41
DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor)
DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled)
DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y)
DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void)
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id)
DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y)
DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor)
SDL_MouseWheelDirection
Scroll direction types for the Scroll event.
Definition: SDL_mouse.h:67
@ SDL_MOUSEWHEEL_NORMAL
Definition: SDL_mouse.h:68
@ SDL_MOUSEWHEEL_FLIPPED
Definition: SDL_mouse.h:69
DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled)
DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void)
struct SDL_Window SDL_Window
The type used to identify a window.
Definition: SDL_video.h:95
A collection of pixels used in software blitting.
Definition: SDL_surface.h:73