Add quit command.
This commit is contained in:
parent
cad36f97a7
commit
4ee2ed3222
9
main.go
9
main.go
|
@ -26,11 +26,14 @@ func run() {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
for !w.Closed() && !s.gameOver {
|
for !w.Closed() && !s.gameOver {
|
||||||
if w.JustPressed(pixelgl.KeySpace) {
|
w.Clear(colornames.Peru)
|
||||||
w.Clear(colornames.Peru)
|
switch {
|
||||||
|
case w.JustPressed(pixelgl.KeyQ):
|
||||||
|
return
|
||||||
|
case w.JustPressed(pixelgl.KeySpace):
|
||||||
s = updateState(s)
|
s = updateState(s)
|
||||||
render(s, w, time.Since(start), colors)
|
|
||||||
}
|
}
|
||||||
|
render(s, w, time.Since(start), colors)
|
||||||
w.Update()
|
w.Update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue