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