Make escape key quit application

This commit is contained in:
Michael Smith 2025-08-13 13:49:09 +02:00
parent 8d2f6cab47
commit 792c245711

View File

@ -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
}
}
}
}