get the nodes in the right order

This commit is contained in:
nek0 2017-02-26 02:13:58 +01:00
parent 2ff4f61722
commit 79642ec557
4 changed files with 29 additions and 9 deletions

View file

@ -130,8 +130,8 @@ load _ = do
_ <- gegl_node_connect_to pnop "output" pover "aux" _ <- gegl_node_connect_to pnop "output" pover "aux"
_ <- gegl_node_connect_to hnop "output" hover "aux" _ <- gegl_node_connect_to hnop "output" hover "aux"
_ <- gegl_node_connect_to bg "output" bgover "aux" _ <- gegl_node_connect_to bg "output" bgover "aux"
-- liftIO $ gegl_node_link fgnop fgtranslate liftIO $ gegl_node_link fgnop fgtranslate
_ <- gegl_node_connect_to fgtranslate "output" fgover "aux" -- _ <- gegl_node_connect_to fgtranslate "output" fgover "aux"
_ <- gegl_node_connect_to fgnop "output" fgover "aux" _ <- gegl_node_connect_to fgnop "output" fgover "aux"
traceM "nodes complete" traceM "nodes complete"
myMap <- return $ M.fromList myMap <- return $ M.fromList
@ -149,6 +149,7 @@ load _ = do
, (KeyPixelize, pixelize) , (KeyPixelize, pixelize)
, (KeyFGOver, fgover) , (KeyFGOver, fgover)
, (KeyFGNop, fgnop) , (KeyFGNop, fgnop)
, (KeyFGTrans, fgtranslate)
, (KeyMenuHeading, menuTranslateHeading) , (KeyMenuHeading, menuTranslateHeading)
, (KeyMenuText, menuText) , (KeyMenuText, menuText)
, (KeyMenuOver, menuOver) , (KeyMenuOver, menuOver)
@ -250,9 +251,15 @@ haskelloidShotDown h = do
(nodeGraph ud M.! KeyHNop) (nodeGraph ud M.! KeyHNop)
else do else do
liftIO $ traceIO "YOU WON!" liftIO $ traceIO "YOU WON!"
liftIO $ gegl_node_link _ <- liftIO $ gegl_node_link
(nodeGraph ud M.! KeyWon) (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 putAffection ud
{ wonlost = True { wonlost = True
} }
@ -352,9 +359,13 @@ lose = do
liftIO $ traceIO "YOU LOST!" liftIO $ traceIO "YOU LOST!"
_ <- liftIO $ gegl_node_link _ <- liftIO $ gegl_node_link
(nodeGraph ud M.! KeyLost) (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 putAffection ud
{ wonlost = True { wonlost = True
} }
_ <- liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyShipOver) "aux"
return ()

View file

@ -33,6 +33,9 @@ loadGame = do
liftIO $ traceIO "inserted haskelloids" liftIO $ traceIO "inserted haskelloids"
liftIO $ gegl_node_link_many $ map hFlange hs liftIO $ gegl_node_link_many $ map hFlange hs
liftIO $ gegl_node_link (last $ map hFlange hs) (nodeGraph ud M.! KeyHNop) 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" liftIO $ traceIO "nodes linked"
putAffection ud putAffection ud
{ haskelloids = hs { haskelloids = hs

View file

@ -27,9 +27,11 @@ class StateMachine a us where
instance StateMachine State UserData where instance StateMachine State UserData where
smLoad Menu = do smLoad Menu = do
ud <- getAffection ud <- getAffection
liftIO $ gegl_node_link liftIO $ gegl_node_connect_to
(nodeGraph ud M.! KeyMenuOver) (nodeGraph ud M.! KeyMenuOver)
(nodeGraph ud M.! KeyFGNop) "output"
(nodeGraph ud M.! KeyFGOver)
"aux"
hs <- liftIO $ catMaybes <$> foldM (\acc _ -> do hs <- liftIO $ catMaybes <$> foldM (\acc _ -> do
px <- randomRIO (0, 800) px <- randomRIO (0, 800)
py <- randomRIO (0, 600) py <- randomRIO (0, 600)
@ -37,10 +39,13 @@ instance StateMachine State UserData where
) [] ([0..9] :: [Int]) ) [] ([0..9] :: [Int])
liftIO $ gegl_node_link_many $ map hFlange hs liftIO $ gegl_node_link_many $ map hFlange hs
liftIO $ gegl_node_link (last $ map hFlange hs) (nodeGraph ud M.! KeyHNop) liftIO $ gegl_node_link (last $ map hFlange hs) (nodeGraph ud M.! KeyHNop)
liftIO $ gegl_node_disconnect (nodeGraph ud M.! KeyPNop) "input"
putAffection ud putAffection ud
{ haskelloids = hs { haskelloids = hs
, fade = FadeIn 1 , fade = FadeIn 1
, state = Menu , state = Menu
, shots = (shots ud)
{ partSysParts = ParticleStorage Nothing [] }
} }
smLoad InGame = loadGame smLoad InGame = loadGame

View file

@ -52,6 +52,7 @@ data NodeKey
| KeyPixelize | KeyPixelize
| KeyFGOver | KeyFGOver
| KeyFGNop | KeyFGNop
| KeyFGTrans
| KeyMenuHeading | KeyMenuHeading
| KeyMenuText | KeyMenuText
| KeyMenuStart | KeyMenuStart