Atlas - SDL_mouse_c.h

Home / ext / SDL2 / src / events Lines: 1 | Size: 4263 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2018 Sam Lantinga <[email protected]> 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#include "../SDL_internal.h" 22 23#ifndef SDL_mouse_c_h_ 24#define SDL_mouse_c_h_ 25 26#include "SDL_mouse.h" 27 28typedef Uint32 SDL_MouseID; 29 30struct SDL_Cursor 31{ 32 struct SDL_Cursor *next; 33 void *driverdata; 34}; 35 36typedef struct 37{ 38 int last_x, last_y; 39 Uint32 last_timestamp; 40 Uint8 click_count; 41} SDL_MouseClickState; 42 43typedef struct 44{ 45 /* Create a cursor from a surface */ 46 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); 47 48 /* Create a system cursor */ 49 SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id); 50 51 /* Show the specified cursor, or hide if cursor is NULL */ 52 int (*ShowCursor) (SDL_Cursor * cursor); 53 54 /* This is called when a mouse motion event occurs */ 55 void (*MoveCursor) (SDL_Cursor * cursor); 56 57 /* Free a window manager cursor */ 58 void (*FreeCursor) (SDL_Cursor * cursor); 59 60 /* Warp the mouse to (x,y) within a window */ 61 void (*WarpMouse) (SDL_Window * window, int x, int y); 62 63 /* Warp the mouse to (x,y) in screen space */ 64 int (*WarpMouseGlobal) (int x, int y); 65 66 /* Set relative mode */ 67 int (*SetRelativeMouseMode) (SDL_bool enabled); 68 69 /* Set mouse capture */ 70 int (*CaptureMouse) (SDL_Window * window); 71 72 /* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */ 73 Uint32 (*GetGlobalMouseState) (int *x, int *y); 74 75 /* Data common to all mice */ 76 SDL_MouseID mouseID; 77 SDL_Window *focus; 78 int x; 79 int y; 80 int xdelta; 81 int ydelta; 82 int last_x, last_y; /* the last reported x and y coordinates */ 83 float accumulated_wheel_x; 84 float accumulated_wheel_y; 85 Uint32 buttonstate; 86 SDL_bool has_position; 87 SDL_bool relative_mode; 88 SDL_bool relative_mode_warp; 89 float normal_speed_scale; 90 float relative_speed_scale; 91 float scale_accum_x; 92 float scale_accum_y; 93 SDL_bool touch_mouse_events; 94 95 /* Data for double-click tracking */ 96 int num_clickstates; 97 SDL_MouseClickState *clickstate; 98 99 SDL_Cursor *cursors; 100 SDL_Cursor *def_cursor; 101 SDL_Cursor *cur_cursor; 102 SDL_bool cursor_shown; 103 104 /* Driver-dependent data. */ 105 void *driverdata; 106} SDL_Mouse; 107 108 109/* Initialize the mouse subsystem */ 110extern int SDL_MouseInit(void); 111 112/* Get the mouse state structure */ 113SDL_Mouse *SDL_GetMouse(void); 114 115/* Set the default double-click interval */ 116extern void SDL_SetDoubleClickTime(Uint32 interval); 117 118/* Set the default mouse cursor */ 119extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); 120 121/* Set the mouse focus window */ 122extern void SDL_SetMouseFocus(SDL_Window * window); 123 124/* Send a mouse motion event */ 125extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); 126 127/* Send a mouse button event */ 128extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button); 129 130/* Send a mouse button event with a click count */ 131extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); 132 133/* Send a mouse wheel event */ 134extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); 135 136/* Shutdown the mouse subsystem */ 137extern void SDL_MouseQuit(void); 138 139#endif /* SDL_mouse_c_h_ */ 140 141/* vi: set ts=4 sw=4 expandtab: */ 142
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.