-
Notifications
You must be signed in to change notification settings - Fork 6
/
input.go
38 lines (30 loc) · 834 Bytes
/
input.go
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
package microui
/*============================================================================
** input handlers
**============================================================================*/
func (ctx *Context) InputMouseMove(x, y int) {
ctx.MousePos = NewVec2(x, y)
}
func (ctx *Context) InputMouseDown(x, y int, btn int) {
ctx.InputMouseMove(x, y)
ctx.MouseDown |= btn
ctx.MousePressed |= btn
}
func (ctx *Context) InputMouseUp(x, y int, btn int) {
ctx.InputMouseMove(x, y)
ctx.MouseDown &= ^btn
}
func (ctx *Context) InputScroll(x, y int) {
ctx.ScrollDelta.X += x
ctx.ScrollDelta.Y += y
}
func (ctx *Context) InputKeyDown(key int) {
ctx.KeyPressed |= key
ctx.KeyDown |= key
}
func (ctx *Context) InputKeyUp(key int) {
ctx.KeyDown &= ^key
}
func (ctx *Context) InputText(text []rune) {
ctx.TextInput = text
}