Skip to content
Permalink
Browse files

Toggle game menu

  • Loading branch information
borodust committed Apr 24, 2017
1 parent 7cdabeb commit 7925fdbbe907c741cd95220b8e626ac2edb44fe2
Showing with 25 additions and 4 deletions.
  1. +3 −0 client/src/events.lisp
  2. +2 −1 client/src/main.lisp
  3. +20 −3 client/src/ui.lisp
@@ -54,3 +54,6 @@

(defevent arena-join-requested ()
(name))


(defevent arena-leave-requested () ())
@@ -136,7 +136,8 @@
'trigger-pulled
'exit-requested
'new-arena-requested
'arena-join-requested)
'arena-join-requested
'arena-leave-requested)
(register-poiu-events (events))
(setf keymap (make-instance 'keymap)
task-queue (make-task-queue))
@@ -66,7 +66,20 @@
(-> ((mortar-combat)) (list)
(clear arena-list)
(dolist (name list)
(add-item arena-list name)))))))
(add-item arena-list name))))))
(toggle-game-menu (ev)
(when (and (eq (key-from ev) :escape)
(eq (state-from ev) :pressed))
(run (>> (-> ((mortar-combat)) ()
(let ((hidden-p (hiddenp game-menu)))
(if hidden-p
(show-window game-menu)
(hide-window game-menu))
hidden-p))
(-> ((host)) (was-hidden-p)
(if was-hidden-p
(unlock-cursor)
(lock-cursor))))))))
(subscribe-body-to (button-click-event (poiu-button)) (events)
(run (-> ((mortar-combat)) ()
(case (name-of poiu-button)
@@ -81,10 +94,14 @@
(:create (hide-window combat-zone) (show-window arena-creation-dialog))
(:join (when selected-arena
(post (make-arena-join-requested selected-arena) (events))
(hide-window combat-zone)))
(hide-window combat-zone)
(subscribe-to 'keyboard-event #'toggle-game-menu (events))))
(:arena-cancel (hide-window arena-creation-dialog) (show-window combat-zone))
(:arena-create (post (make-new-arena-requested (text-of arena-name-edit)) (events))
(hide-window arena-creation-dialog))
(hide-window arena-creation-dialog)
(subscribe-to 'keyboard-event #'toggle-game-menu (events)))
(:leave (unsubscribe-from 'keyboard-event #'toggle-game-menu (events))
(post (make-arena-leave-requested) (events)))
(:quit (post (make-exit-requested) (events))))))))
(subscribe-body-to (item-selected (source item)) (events)
(when (eq source arena-list)

0 comments on commit 7925fdb

Please sign in to comment.
You can’t perform that action at this time.