make Pituicat an Actor and update it properly

This commit is contained in:
nek0 2020-12-24 12:01:59 +01:00
parent 3bfa8671b0
commit 4137101dbc
2 changed files with 12 additions and 1 deletions

View File

@ -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"

View File

@ -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