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
|
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
|
|
|
import Types.Util
|
2021-01-11 11:01:07 +00:00
|
|
|
import Types.Subsystems
|
2020-10-28 10:48:58 +00:00
|
|
|
|
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-30 06:38:18 +00:00
|
|
|
loadScene :: a -> TMVar Progress -> IO ()
|
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
|
2020-12-14 07:00:06 +00:00
|
|
|
update :: a -> Double -> Affection ()
|
2020-10-25 18:32:44 +00:00
|
|
|
|
|
|
|
-- | Handle input events
|
2021-01-11 11:01:07 +00:00
|
|
|
onEvents :: a -> TranslatorMessage -> Affection ()
|
2020-10-25 18:32:44 +00:00
|
|
|
|
|
|
|
-- | perform the drawing
|
|
|
|
render :: a -> Affection ()
|