aboutsummaryrefslogtreecommitdiff
path: root/vendor/sdl2/sdl_mouse.odin
blob: 8e782a5e326d1721bb95b0fa5a75edeec6bb0244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package sdl2

import "core:c"

when ODIN_OS == .Windows {
	@(ignore_duplicates)
	foreign import lib "SDL2.lib"
} else {
	@(ignore_duplicates)
	foreign import lib "system:SDL2"
}

Cursor :: struct {}

BUTTON :: #force_inline proc "c" (X: c.int) -> c.int { return 1 << u32(X-1) }
BUTTON_LEFT     :: 1
BUTTON_MIDDLE   :: 2
BUTTON_RIGHT    :: 3
BUTTON_X1       :: 4
BUTTON_X2       :: 5
BUTTON_LMASK    :: 1<<(BUTTON_LEFT-1)
BUTTON_MMASK    :: 1<<(BUTTON_MIDDLE-1)
BUTTON_RMASK    :: 1<<(BUTTON_RIGHT-1)
BUTTON_X1MASK   :: 1<<(BUTTON_X1-1)
BUTTON_X2MASK   :: 1<<(BUTTON_X2-1)

SystemCursor :: enum c.int {
	ARROW,     /**< Arrow */
	IBEAM,     /**< I-beam */
	WAIT,      /**< Wait */
	CROSSHAIR, /**< Crosshair */
	WAITARROW, /**< Small wait cursor (or Wait if not available) */
	SIZENWSE,  /**< Double arrow pointing northwest and southeast */
	SIZENESW,  /**< Double arrow pointing northeast and southwest */
	SIZEWE,    /**< Double arrow pointing west and east */
	SIZENS,    /**< Double arrow pointing north and south */
	SIZEALL,   /**< Four pointed arrow pointing north, south, east, and west */
	NO,        /**< Slashed circle or crossbones */
	HAND,      /**< Hand */
	NUM_SYSTEM_CURSORS,
}

MouseWheelDirection :: enum c.int {
	NORMAL,    /**< The scroll direction is normal */
	FLIPPED,   /**< The scroll direction is flipped / natural */
}

@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
	GetMouseFocus         :: proc() -> ^Window ---
	GetMouseState         :: proc(x, y: ^c.int) -> u32 ---
	GetGlobalMouseState   :: proc(x, y: ^c.int) -> u32 ---
	GetRelativeMouseState :: proc(x, y: ^c.int) -> u32 ---
	WarpMouseInWindow     :: proc(window: ^Window, x, y: c.int) ---
	WarpMouseGlobal       :: proc(x, y: c.int) -> c.int ---
	SetRelativeMouseMode  :: proc(enabled: bool) -> c.int ---
	CaptureMouse          :: proc(enabled: bool) -> c.int ---
	GetRelativeMouseMode  :: proc() -> bool ---
	CreateCursor          :: proc(data: [^]u8, mask: [^]u8, w, h, hot_x, hot_y: c.int) -> ^Cursor ---
	CreateColorCursor     :: proc(surface: ^Surface, hot_x, hot_y: c.int) -> ^Cursor ---
	CreateSystemCursor    :: proc(id: SystemCursor) -> ^Cursor ---
	SetCursor             :: proc(cursor: ^Cursor) ---
	GetCursor             :: proc() -> ^Cursor ---
	GetDefaultCursor      :: proc() -> ^Cursor ---
	FreeCursor            :: proc(cursor: ^Cursor) ---
	ShowCursor            :: proc(toggle: c.int) -> c.int ---
}