-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.go
50 lines (42 loc) · 1.01 KB
/
event.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
46
47
48
49
package main
import (
"log"
"github.com/gen2brain/raylib-go/raylib"
)
func eventHandler() {
if rl.IsMouseButtonPressed(rl.MouseRightButton) {
Run = !Run
if !Run {
log.Println("PAUSED")
} else { log.Println("RESUMED")}
}
if rl.IsMouseButtonDown(rl.MouseLeftButton) {
mPos := rl.GetMousePosition()
posCell := cell{ x: int(mPos.X/float32(Size)),
y: int(mPos.Y/float32(Size))}
if rl.IsMouseButtonPressed(rl.MouseLeftButton) {
if isAlive(posCell) {
log.Println("Manual Kill:", posCell)
Mkill = true
delete(Alive, posCell)
} else {
log.Println("Manual Live:", posCell)
Mkill = false
Alive[ posCell ] = true
}
} else {
if !Run {
posCell := cell{ x: int(mPos.X/float32(Size)),
y: int(mPos.Y/float32(Size))}
if isAlive(posCell) && Mkill {
log.Println("Manual Kill:", posCell)
delete(Alive, posCell)
}
if !isAlive(posCell) && !Mkill {
log.Println("Manual Live:", posCell)
Alive[ posCell ] = true
}
}
}
}
}