-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.go
More file actions
56 lines (43 loc) · 1.44 KB
/
input.go
File metadata and controls
56 lines (43 loc) · 1.44 KB
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
package hlg
import "github.com/dfirebaugh/hlg/pkg/input"
// IsKeyPressed checks if a key is currently pressed
func IsKeyPressed(keyCode input.Key) bool {
return hlg.inputState.IsKeyPressed(keyCode)
}
func IsKeyJustPressed(keyCode input.Key) bool {
return hlg.inputState.IsKeyJustPressed(keyCode)
}
func PressKey(keyCode input.Key) {
hlg.inputState.PressKey(keyCode)
}
func ReleaseKey(keyCode input.Key) {
hlg.inputState.ReleaseKey(keyCode)
}
func IsButtonPressed(buttonCode input.MouseButton) bool {
return hlg.inputState.IsButtonPressed(buttonCode)
}
// IsButtonJustPressed checks if a mouse button was just pressed
func IsButtonJustPressed(buttonCode input.MouseButton) bool {
return hlg.inputState.IsButtonJustPressed(buttonCode)
}
// IsButtonJustReleased checks if a mouse button was just released
func IsButtonJustReleased(buttonCode input.MouseButton) bool {
return hlg.inputState.IsButtonJustReleased(buttonCode)
}
// PressButton simulates a mouse button press
func PressButton(buttonCode input.MouseButton) {
hlg.inputState.PressButton(buttonCode)
}
func ReleaseButton(buttonCode input.MouseButton) {
hlg.inputState.ReleaseButton(buttonCode)
}
func GetCursorPosition() (int, int) {
return hlg.inputState.GetCursorPosition()
}
func SetScrollCallback(cb func(x float64, y float64)) {
hlg.inputState.SetScrollCallback(cb)
}
// GetTypedRunes returns the runes typed this frame
func GetTypedRunes() []rune {
return hlg.inputState.GetTypedRunes()
}