diff options
| -rw-r--r-- | Spear/App.hs | 2 | ||||
| -rw-r--r-- | Spear/Game.hs | 10 | ||||
| -rw-r--r-- | Spear/Scene/Loader.hs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/Spear/App.hs b/Spear/App.hs index 6e8f5f2..e85c46b 100644 --- a/Spear/App.hs +++ b/Spear/App.hs | |||
| @@ -163,7 +163,7 @@ runApp app = | |||
| 163 | , appCustomState = gameState | 163 | , appCustomState = gameState |
| 164 | } | 164 | } |
| 165 | -- Run app. | 165 | -- Run app. |
| 166 | (result, endAppState) <- runSubGame appState $ do | 166 | (result, endAppState) <- runChildGame appState $ do |
| 167 | loop app window | 167 | loop app window |
| 168 | endApp app | 168 | endApp app |
| 169 | -- Shut down. | 169 | -- Shut down. |
diff --git a/Spear/Game.hs b/Spear/Game.hs index 0c8b963..ae986c8 100644 --- a/Spear/Game.hs +++ b/Spear/Game.hs | |||
| @@ -22,7 +22,7 @@ module Spear.Game | |||
| 22 | , catch | 22 | , catch |
| 23 | -- * Running and IO | 23 | -- * Running and IO |
| 24 | , runGame | 24 | , runGame |
| 25 | , runSubGame | 25 | , runChildGame |
| 26 | , runSiblingGame | 26 | , runSiblingGame |
| 27 | , eval | 27 | , eval |
| 28 | , exec | 28 | , exec |
| @@ -106,18 +106,18 @@ assertMaybe (Just x) _ = return x | |||
| 106 | runGame :: s -> Game s a -> IO (a, s) | 106 | runGame :: s -> Game s a -> IO (a, s) |
| 107 | runGame state game = runResourceT . runStateT (getGame game) $ state | 107 | runGame state game = runResourceT . runStateT (getGame game) $ state |
| 108 | 108 | ||
| 109 | -- | Run the given sub-game, unrolling the full monad stack and returning the | 109 | -- | Run the given child game, unrolling the full monad stack and returning the |
| 110 | -- game's result and its final state. | 110 | -- game's result and its final state. |
| 111 | -- | 111 | -- |
| 112 | -- Like `runGame`, this frees any resources that are acquired by the sub-game. | 112 | -- Like `runGame`, this frees any resources that are acquired by the sub-game. |
| 113 | -- If you want to keep acquired resources, see `runSiblingGame` instead. | 113 | -- If you want to keep acquired resources, see `runSiblingGame` instead. |
| 114 | runSubGame :: s -> Game s a -> Game t (a, s) | 114 | runChildGame :: s -> Game s a -> Game t (a, s) |
| 115 | runSubGame state game = liftIO $ runGame state game | 115 | runChildGame state game = liftIO $ runGame state game |
| 116 | 116 | ||
| 117 | -- | Run the given sibling game, unrolling the state transformer but not the | 117 | -- | Run the given sibling game, unrolling the state transformer but not the |
| 118 | -- resource transformer. | 118 | -- resource transformer. |
| 119 | -- | 119 | -- |
| 120 | -- Unlike `runSubGame`, any resources acquired by the sibling game are *not* | 120 | -- Unlike `runChildGame`, any resources acquired by the sibling game are *not* |
| 121 | -- released. | 121 | -- released. |
| 122 | runSiblingGame :: s -> Game s a -> Game t (a, s) | 122 | runSiblingGame :: s -> Game s a -> Game t (a, s) |
| 123 | runSiblingGame state game = Game . lift $ runStateT (getGame game) state | 123 | runSiblingGame state game = Game . lift $ runStateT (getGame game) state |
diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs index 5f96f8c..0593c77 100644 --- a/Spear/Scene/Loader.hs +++ b/Spear/Scene/Loader.hs | |||
| @@ -58,7 +58,7 @@ validate _ = Nothing | |||
| 58 | 58 | ||
| 59 | -- | Load the scene described by the given 'SceneGraph'. | 59 | -- | Load the scene described by the given 'SceneGraph'. |
| 60 | resourceMap :: SceneGraph -> Game s SceneResources | 60 | resourceMap :: SceneGraph -> Game s SceneResources |
| 61 | resourceMap g = exec runSubGame emptySceneResources (resourceMap' g) | 61 | resourceMap g = exec runChildGame emptySceneResources (resourceMap' g) |
| 62 | 62 | ||
| 63 | resourceMap' :: SceneGraph -> Loader () | 63 | resourceMap' :: SceneGraph -> Loader () |
| 64 | resourceMap' node@(SceneLeaf nid props) = do | 64 | resourceMap' node@(SceneLeaf nid props) = do |
