change subscriber function and close window on request
This commit is contained in:
parent
43f5649ce5
commit
1e71b63f67
1 changed files with 9 additions and 4 deletions
13
src/Main.hs
13
src/Main.hs
|
@ -58,9 +58,9 @@ main = do
|
|||
|
||||
preLoad :: GameData -> Affection ()
|
||||
preLoad gd = do
|
||||
void $ generalSubscribe
|
||||
((\(SubKeyboard t) -> t) $ subKeyboard $ gameSubsystems gd)
|
||||
(\(MsgKeyboardEvent when win motion False keysym) -> do
|
||||
void $ partSubscribe
|
||||
(subKeyboard $ gameSubsystems gd)
|
||||
(\(MsgKeyboardEvent time win motion False keysym) -> do
|
||||
translator <- liftIO $ atomically $ readTVar (gameActionTranslation gd)
|
||||
case
|
||||
((SDL.keysymScancode keysym, SDL.keysymModifier keysym) `M.lookup`
|
||||
|
@ -69,10 +69,15 @@ preLoad gd = do
|
|||
Just action ->
|
||||
partEmit
|
||||
(subTranslator $ gameSubsystems gd)
|
||||
(TranslatorMessage action when motion)
|
||||
(TranslatorMessage action time motion)
|
||||
Nothing ->
|
||||
return ()
|
||||
)
|
||||
void $ partSubscribe
|
||||
(subWindow $ gameSubsystems gd)
|
||||
(\(MsgWindowClose time win) ->
|
||||
atomically $ writeTVar (gameRunning gd) False
|
||||
)
|
||||
|
||||
handle :: GameData -> [SDL.EventPayload] -> Affection ()
|
||||
handle gd evs = do
|
||||
|
|
Loading…
Reference in a new issue