31 lines
696 B
Haskell
31 lines
696 B
Haskell
module Classes.Scene where
|
|
|
|
import Affection
|
|
|
|
import Control.Concurrent.STM
|
|
|
|
import qualified SDL
|
|
|
|
-- internal imports
|
|
|
|
import Types.Util
|
|
|
|
class Scene a where
|
|
|
|
-- | Perform initialization and output a (possibly empty) data container.
|
|
initScene :: IO a
|
|
|
|
-- | Load actual data into the initialized container.
|
|
loadScene :: a -> TMVar Progress -> IO ()
|
|
|
|
-- | Query whether loading data is finished.
|
|
isSceneLoaded :: a -> Affection Bool
|
|
|
|
-- | Run updates on the data given the time elapsed since last frame
|
|
update :: a -> Double -> Affection ()
|
|
|
|
-- | Handle input events
|
|
onEvents :: a -> [SDL.EventPayload] -> Affection ()
|
|
|
|
-- | perform the drawing
|
|
render :: a -> Affection ()
|