From 31f56d62a3a9c13d4224270056919cefb21e852d Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 25 Oct 2020 19:32:44 +0100 Subject: [PATCH] add Scene class --- src/Classes/Scene.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/Classes/Scene.hs diff --git a/src/Classes/Scene.hs b/src/Classes/Scene.hs new file mode 100644 index 0000000..50964f6 --- /dev/null +++ b/src/Classes/Scene.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE ExistentialQuantification #-} +module Scenes.Scene where + +import Affection + +import qualified SDL + +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 -> Affection () + + -- | 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 ()