pituicat/src/Classes/Scene.hs

32 lines
694 B
Haskell
Raw Normal View History

2020-10-28 10:48:58 +00:00
module Classes.Scene where
2020-10-25 18:32:44 +00:00
import Affection
2020-10-28 10:48:58 +00:00
import Control.Concurrent.STM
2020-10-25 18:32:44 +00:00
import qualified SDL
2020-10-28 10:48:58 +00:00
-- internal imports
import Types.Util
2020-10-25 18:32:44 +00:00
class Scene a where
-- | Perform initialization and output a (possibly empty) data container.
initScene :: IO a
-- | Load actual data into the initialized container.
2020-10-28 10:48:58 +00:00
loadScene :: a -> TMVar Progress -> IO a
2020-10-25 18:32:44 +00:00
-- | Query whether loading data is finished.
isSceneLoaded :: a -> Affection Bool
-- | Run updates on the data given the time elapsed since last frame
update :: a -> Float -> Affection ()
-- | Handle input events
onEvents :: a -> [SDL.EventPayload] -> Affection ()
-- | perform the drawing
render :: a -> Affection ()