aboutsummaryrefslogtreecommitdiff
path: root/vendor/glfw/bindings/types.odin
blob: bb1c7e4316c7926b3808d88f8e3123f248e810c2 (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
package glfw_bindings

import "core:c"

WindowHandle  :: distinct rawptr
MonitorHandle :: distinct rawptr
CursorHandle  :: distinct rawptr

VidMode :: struct {
	width:        c.int,
	height:       c.int,
	red_bits:     c.int,
	green_bits:   c.int,
	blue_bits:    c.int,
	refresh_rate: c.int,
}

GammaRamp :: struct {
	red, green, blue: [^]c.ushort,
	size:                c.uint, 
}

Image :: struct {
	width, height: c.int,
	pixels:        [^]u8,
}

GamepadState :: struct {
	buttons: [15]u8,
	axes:    [6]f32,
}

Allocator :: struct {
	allocate:   AllocateProc,
	reallocate: ReallocateProc,
	deallocate: DeallocateProc,
	user:       rawptr,
}

/*** Procedure type declarations ***/
WindowIconifyProc      :: #type proc "c" (window: WindowHandle, iconified: c.int)
WindowRefreshProc      :: #type proc "c" (window: WindowHandle)
WindowFocusProc        :: #type proc "c" (window: WindowHandle, focused: c.int)
WindowCloseProc        :: #type proc "c" (window: WindowHandle)
WindowSizeProc         :: #type proc "c" (window: WindowHandle, width, height: c.int)
WindowPosProc          :: #type proc "c" (window: WindowHandle, xpos, ypos: c.int)
WindowMaximizeProc     :: #type proc "c" (window: WindowHandle, iconified: c.int) 
WindowContentScaleProc :: #type proc "c" (window: WindowHandle, xscale, yscale: f32)
FramebufferSizeProc    :: #type proc "c" (window: WindowHandle, width, height: c.int)
DropProc               :: #type proc "c" (window: WindowHandle, count: c.int, paths: [^]cstring)
MonitorProc            :: #type proc "c" (monitor: MonitorHandle, event: c.int)

KeyProc                :: #type proc "c" (window: WindowHandle, key, scancode, action, mods: c.int)
MouseButtonProc        :: #type proc "c" (window: WindowHandle, button, action, mods: c.int)
CursorPosProc          :: #type proc "c" (window: WindowHandle, xpos,  ypos: f64)
ScrollProc             :: #type proc "c" (window: WindowHandle, xoffset, yoffset: f64)
CharProc               :: #type proc "c" (window: WindowHandle, codepoint: rune)
CharModsProc           :: #type proc "c" (window: WindowHandle, codepoint: rune, mods: c.int)
CursorEnterProc        :: #type proc "c" (window: WindowHandle, entered: c.int)
JoystickProc           :: #type proc "c" (joy, event: c.int)

ErrorProc              :: #type proc "c" (error: c.int, description: cstring)

AllocateProc           :: #type proc "c" (size: c.size_t, user: rawptr) -> rawptr
ReallocateProc         :: #type proc "c" (block: rawptr, size: c.size_t, user: rawptr) -> rawptr
DeallocateProc         :: #type proc "c" (block: rawptr, user: rawptr)