From 79642ec557c6b61553caaa81a9c7ea5505b28cbc Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 26 Feb 2017 02:13:58 +0100 Subject: [PATCH] get the nodes in the right order --- src/Commons.hs | 25 ++++++++++++++++++------- src/InGame.hs | 3 +++ src/StateMachine.hs | 9 +++++++-- src/Types.hs | 1 + 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Commons.hs b/src/Commons.hs index bb38165..b3ea430 100644 --- a/src/Commons.hs +++ b/src/Commons.hs @@ -130,8 +130,8 @@ load _ = do _ <- gegl_node_connect_to pnop "output" pover "aux" _ <- gegl_node_connect_to hnop "output" hover "aux" _ <- gegl_node_connect_to bg "output" bgover "aux" - -- liftIO $ gegl_node_link fgnop fgtranslate - _ <- gegl_node_connect_to fgtranslate "output" fgover "aux" + liftIO $ gegl_node_link fgnop fgtranslate + -- _ <- gegl_node_connect_to fgtranslate "output" fgover "aux" _ <- gegl_node_connect_to fgnop "output" fgover "aux" traceM "nodes complete" myMap <- return $ M.fromList @@ -149,6 +149,7 @@ load _ = do , (KeyPixelize, pixelize) , (KeyFGOver, fgover) , (KeyFGNop, fgnop) + , (KeyFGTrans, fgtranslate) , (KeyMenuHeading, menuTranslateHeading) , (KeyMenuText, menuText) , (KeyMenuOver, menuOver) @@ -250,9 +251,15 @@ haskelloidShotDown h = do (nodeGraph ud M.! KeyHNop) else do liftIO $ traceIO "YOU WON!" - liftIO $ gegl_node_link + _ <- liftIO $ gegl_node_link (nodeGraph ud M.! KeyWon) - (nodeGraph ud M.! KeyFGNop) + (nodeGraph ud M.! KeyFGTrans) + _ <- liftIO $ gegl_node_connect_to + (nodeGraph ud M.! KeyFGTrans) + "output" + (nodeGraph ud M.! KeyFGOver) + "aux" + _ <- liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyShipOver) "aux" putAffection ud { wonlost = True } @@ -352,9 +359,13 @@ lose = do liftIO $ traceIO "YOU LOST!" _ <- liftIO $ gegl_node_link (nodeGraph ud M.! KeyLost) - (nodeGraph ud M.! KeyFGNop) + (nodeGraph ud M.! KeyFGTrans) + _ <- liftIO $ gegl_node_connect_to + (nodeGraph ud M.! KeyFGTrans) + "output" + (nodeGraph ud M.! KeyFGOver) + "aux" + _ <- liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyShipOver) "aux" putAffection ud { wonlost = True } - _ <- liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyShipOver) "aux" - return () diff --git a/src/InGame.hs b/src/InGame.hs index 81d8e2f..e711a97 100644 --- a/src/InGame.hs +++ b/src/InGame.hs @@ -33,6 +33,9 @@ loadGame = do liftIO $ traceIO "inserted haskelloids" liftIO $ gegl_node_link_many $ map hFlange hs liftIO $ gegl_node_link (last $ map hFlange hs) (nodeGraph ud M.! KeyHNop) + liftIO $ gegl_node_disconnect + (nodeGraph ud M.! KeyFGOver) + "aux" liftIO $ traceIO "nodes linked" putAffection ud { haskelloids = hs diff --git a/src/StateMachine.hs b/src/StateMachine.hs index f84bf9b..36a578f 100644 --- a/src/StateMachine.hs +++ b/src/StateMachine.hs @@ -27,9 +27,11 @@ class StateMachine a us where instance StateMachine State UserData where smLoad Menu = do ud <- getAffection - liftIO $ gegl_node_link + liftIO $ gegl_node_connect_to (nodeGraph ud M.! KeyMenuOver) - (nodeGraph ud M.! KeyFGNop) + "output" + (nodeGraph ud M.! KeyFGOver) + "aux" hs <- liftIO $ catMaybes <$> foldM (\acc _ -> do px <- randomRIO (0, 800) py <- randomRIO (0, 600) @@ -37,10 +39,13 @@ instance StateMachine State UserData where ) [] ([0..9] :: [Int]) liftIO $ gegl_node_link_many $ map hFlange hs liftIO $ gegl_node_link (last $ map hFlange hs) (nodeGraph ud M.! KeyHNop) + liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyPNop) "input" putAffection ud { haskelloids = hs , fade = FadeIn 1 , state = Menu + , shots = (shots ud) + { partSysParts = ParticleStorage Nothing [] } } smLoad InGame = loadGame diff --git a/src/Types.hs b/src/Types.hs index 46cee94..aaf2717 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -52,6 +52,7 @@ data NodeKey | KeyPixelize | KeyFGOver | KeyFGNop + | KeyFGTrans | KeyMenuHeading | KeyMenuText | KeyMenuStart