From ac3ded6e9afe20a0951e1536eb53f29332910c5b Mon Sep 17 00:00:00 2001 From: raul Date: Thu, 11 Apr 2024 15:19:04 +0200 Subject: [PATCH] Add error handling to WASD inputs Can't believe I forgot about that --- wasd-game/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wasd-game/main.go b/wasd-game/main.go index 754798d..c279137 100644 --- a/wasd-game/main.go +++ b/wasd-game/main.go @@ -60,6 +60,7 @@ func initKeybindings(g *gocui.Gui) error { playerX -= movementStep return nil }); err != nil { + log.Panicln(err) } if err := g.SetKeybinding("", 'd', gocui.ModNone, @@ -67,6 +68,7 @@ func initKeybindings(g *gocui.Gui) error { playerX += movementStep return nil }); err != nil { + log.Panicln(err) } if err := g.SetKeybinding("", 'w', gocui.ModNone, @@ -74,6 +76,7 @@ func initKeybindings(g *gocui.Gui) error { playerY += movementStep return nil }); err != nil { + log.Panicln(err) } if err := g.SetKeybinding("", 's', gocui.ModNone, @@ -81,6 +84,7 @@ func initKeybindings(g *gocui.Gui) error { playerY -= movementStep return nil }); err != nil { + log.Panicln(err) } return nil