From 4ee2ed3222d150c60585781b8148eaaf19748a22 Mon Sep 17 00:00:00 2001 From: Luke Meyers Date: Wed, 5 Feb 2020 08:54:47 -0800 Subject: [PATCH] Add quit command. --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 4fc1ec4..d88de37 100644 --- a/main.go +++ b/main.go @@ -26,11 +26,14 @@ func run() { start := time.Now() 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) - render(s, w, time.Since(start), colors) } + render(s, w, time.Since(start), colors) w.Update() } }