-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinput.go
45 lines (37 loc) · 933 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
39
40
41
42
43
44
45
package gogre3d
/*
#cgo LDFLAGS: -lllcoi
#cgo CFLAGS: -I./llcoihdr
#include "ois_interface.h"
*/
import "C"
type InputManager struct {
cptr C.InputManagerHandle
}
func NewInput(w RenderWindow) InputManager {
var result InputManager
result.cptr = C.create_input_system(C.uint(w.Handle()))
return result
}
func (i *InputManager) Destroy() {
C.destroy_input_system(i.cptr)
i.cptr = nil
}
func (i *InputManager) NewKeyboard(buffered bool) Keyboard {
var result Keyboard
result.cptr = C.create_keyboard_object(i.cptr, cbool(buffered))
return result
}
func (i *InputManager) DestroyKeyboard(k Keyboard) {
C.destroy_keyboard_object(i.cptr, k.cptr)
k.cptr = nil
}
func (i *InputManager) NewMouse(buffered bool) Mouse {
var result Mouse
result.cptr = C.create_mouse_object(i.cptr, cbool(buffered))
return result
}
func (i *InputManager) DestroyMouse(m Mouse) {
C.destroy_mouse_object(i.cptr, m.cptr)
m.cptr = nil
}