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 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 ()

View file

@ -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

View file

@ -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

View file

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