-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
61 lines (52 loc) · 1.32 KB
/
main.go
File metadata and controls
61 lines (52 loc) · 1.32 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
57
58
59
60
61
package main
import (
null0 "github.com/notnullgames/null0go/cartapi"
)
// called to set things up
func main() {
println("[init] Callbacks example cart loaded!")
println("Available types: Color, Vector, Rectangle, Dimensions")
println("Available enums: Key, GamepadButton, MouseButton, ImageFilter, SfxPresetType")
}
//export buttonUp
func buttonUp(button uint32, player uint32) {
println("[buttonUp] called!")
}
//export buttonDown
func buttonDown(button uint32, player uint32) {
println("[buttonDown] called!")
}
//export keyUp
func keyUp(key uint32) {
println("[keyUp] called!")
// Example: check if it's the space key
if key == uint32(null0.KEY_SPACE) {
println("[keyUp] Space key!")
}
}
//export keyDown
func keyDown(key uint32) {
println("[keyDown] called!")
// Example: check for specific keys
if key == uint32(null0.KEY_A) {
println("[keyDown] A key!")
} else if key == uint32(null0.KEY_ESCAPE) {
println("[keyDown] Escape key!")
}
}
//export mouseDown
func mouseDown(button uint32) {
println("[mouseDown] called!")
// Example: check button type
if button == uint32(null0.MOUSE_BUTTON_LEFT) {
println("[mouseDown] Left click!")
}
}
//export mouseUp
func mouseUp(button uint32) {
println("[mouseUp] called!")
}
//export mouseMoved
func mouseMoved(x float32, y float32) {
println("[mouseMoved] called!")
}