From 3cb7e3a5c942e18ea37cbf10cd148df180da442c Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 13 Aug 2025 13:49:09 +0200 Subject: [PATCH] Make escape key quit application --- ui/controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/controller.go b/ui/controller.go index 4e27e39..c93ddbe 100644 --- a/ui/controller.go +++ b/ui/controller.go @@ -51,10 +51,15 @@ func (c *Controller) Run() { running := true for running { for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() { - switch event.(type) { + switch e := event.(type) { case *sdl.QuitEvent: - println("Quit") running = false + case *sdl.KeyboardEvent: + if e.Type == sdl.KEYDOWN { + if e.Keysym.Sym == sdl.K_ESCAPE { + running = false + } + } } }