From c61f07446594369d0726917913e4f0bbc54f439d Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Tue, 31 Dec 2019 11:43:42 +0100 Subject: [PATCH] Escape will go back to main menu in the level selection menu. --- cmd/krampus19/levelselect.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/krampus19/levelselect.go b/cmd/krampus19/levelselect.go index 0c0e118..9a64253 100644 --- a/cmd/krampus19/levelselect.go +++ b/cmd/krampus19/levelselect.go @@ -3,6 +3,8 @@ package main import ( "fmt" + "opslag.de/schobers/allg5" + "opslag.de/schobers/krampus19/alui" ) @@ -35,4 +37,14 @@ func (s *levelSelect) Enter(ctx *Context) error { return nil } +func (s *levelSelect) Handle(e allg5.Event) { + switch e := e.(type) { + case *allg5.KeyDownEvent: + switch e.KeyCode { + case allg5.KeyEscape: + s.ctx.Navigation.ShowMainMenu() + } + } +} + func (s *levelSelect) Leave() {}