From 54018ff71ee3f5ecacdcbf2bbe5a39c5dfd466dc Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 16 Dec 2017 11:57:58 +0100 Subject: [PATCH] close window on close (duh) --- examples/example00.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/example00.hs b/examples/example00.hs index d49eb94..e57e5f7 100644 --- a/examples/example00.hs +++ b/examples/example00.hs @@ -100,6 +100,7 @@ pre :: Affection StateData () pre = do sd <- getAffection _ <- partSubscribe (subKeyboard $ sdSubs sd) exitOnQ + _ <- partSubscribe (subWindow $ sdSubs sd) exitOnWindowClose return () exitOnQ :: KeyboardMessage -> Affection StateData () @@ -110,6 +111,14 @@ exitOnQ (MsgKeyboardEvent _ _ _ _ sym) = quit _ -> return () +exitOnWindowClose :: WindowMessage -> Affection StateData () +exitOnWindowClose wm = + case wm of + MsgWindowClose _ _ -> do + liftIO $ logIO Debug "I heard another one..." + quit + _ -> return () + handle :: [SDL.EventPayload] -> Affection StateData () handle es = do (Subsystems a b c) <- sdSubs <$> getAffection