diff --git a/alui/menu.go b/alui/menu.go index f4c29a7..37a4587 100644 --- a/alui/menu.go +++ b/alui/menu.go @@ -48,6 +48,13 @@ func (m *Menu) Handle(e allg5.Event) { } switch e := e.(type) { + case *allg5.KeyDownEvent: + switch e.KeyCode { + case allg5.KeyEscape: + if onEscape := m.OnEscape; onEscape != nil { + onEscape() + } + } case *allg5.KeyCharEvent: switch e.KeyCode { case allg5.KeyDown: @@ -58,10 +65,6 @@ func (m *Menu) Handle(e allg5.Event) { if onClick := m.buttons[m.active].OnClick; onClick != nil { onClick() } - case allg5.KeyEscape: - if onEscape := m.OnEscape; onEscape != nil { - onEscape() - } } case *allg5.MouseMoveEvent: for i, btn := range m.buttons { diff --git a/cmd/krampus19/entity.go b/cmd/krampus19/entity.go index 818e2cc..e13eda0 100644 --- a/cmd/krampus19/entity.go +++ b/cmd/krampus19/entity.go @@ -29,7 +29,7 @@ func newEntityMoveAnimation(e *entity, to geom.Point) *entityMoveAnimation { } func (a *entityMoveAnimation) Animate(start, now time.Duration) bool { - const duration = 270 * time.Millisecond + const duration = 210 * time.Millisecond progress := float32((now-start)*1000/duration) * .001 from, to := a.from.ToF32(), a.to.ToF32() diff --git a/cmd/krampus19/playlevel.go b/cmd/krampus19/playlevel.go index 1f8387e..a85f158 100644 --- a/cmd/krampus19/playlevel.go +++ b/cmd/krampus19/playlevel.go @@ -141,7 +141,7 @@ func (l *playLevel) Handle(e allg5.Event) { l.end.Handle(e) default: switch e := e.(type) { - case *allg5.KeyCharEvent: + case *allg5.KeyDownEvent: switch e.KeyCode { case allg5.KeyEscape: l.showMenu = true