diff --git a/src/Scenes/Test.hs b/src/Scenes/Test.hs index 768a9f1..12e0d6d 100644 --- a/src/Scenes/Test.hs +++ b/src/Scenes/Test.hs @@ -139,6 +139,11 @@ instance Scene Test where update level dt = liftIO $ do logIO Debug ("FPS: " <> fromString (show $ 1 / dt)) + -- Let all Actors update themselves (Typeclasses rock!) + atomically $ + modifyTVar + (testCast level) + (V.map (\(Cast c) -> Cast (perform dt c))) onEvents _ _ = return () @@ -175,7 +180,8 @@ instance Scene Test where logIO Debug "Wrote buffers" bind (tileMapTexture tileMap) - mapM_ (\(StageSet p) -> bindPropTexture p) stageSet + V.mapM_ (\(StageSet p) -> bindPropTexture p) stageSet + V.mapM_ (\(Cast c) -> bindPropTexture c) cast R.draw va ib sh logIO Debug "Drawn" diff --git a/src/Types/Player.hs b/src/Types/Player.hs index db18844..42a0015 100644 --- a/src/Types/Player.hs +++ b/src/Types/Player.hs @@ -11,6 +11,7 @@ import qualified Data.Vector as V import Classes.Graphics.Drawable import Classes.Graphics.Bindable import Classes.Prop +import Classes.Actor import Types.Graphics.VertexBuffer import Types.Texture @@ -56,3 +57,7 @@ instance Prop Pituicat where residentLayer _ = 0 bindPropTexture = bind . pcTexture + +instance Actor Pituicat where + + perform _ p = p