show everything

This commit is contained in:
nek0 2017-07-29 02:20:32 +02:00
parent f544b5f025
commit 2499fe526a
2 changed files with 8 additions and 8 deletions

View File

@ -18,19 +18,19 @@ import qualified Control.Monad.Parallel as MP
import Affection.Types
data Ord a => Actor a = Actor
data (Show a, Ord a) => Actor a = Actor
{ actorProperties :: [ActorProperty a]
, actorNodes :: M.Map a G.GeglNode
, actorFlange :: G.GeglNode
} deriving (Eq)
} deriving (Show, Eq)
data Ord a => ActorProperty a = ActorProperty
data (Show a, Ord a) => ActorProperty a = ActorProperty
{ apName :: String
, apValue :: G.PropertyValue
, apMapping :: Maybe (a, String)
} deriving (Eq)
} deriving (Show, Eq)
updateProperties :: Ord a => [G.Property] -> Actor a -> Actor a
updateProperties :: (Show a, Ord a) => [G.Property] -> Actor a -> Actor a
updateProperties ps act@Actor{..} =
act
{ actorProperties =
@ -46,7 +46,7 @@ updateProperties ps act@Actor{..} =
| apName p == n = p
| otherwise = getProp' n ps
applyProperties :: Ord a => Actor a -> Affection us ()
applyProperties :: (Show a, Ord a) => Actor a -> Affection us ()
applyProperties Actor{..} =
MP.mapM_ (\(ActorProperty{..}) ->
maybe (return ()) (\m ->
@ -55,7 +55,7 @@ applyProperties Actor{..} =
) apMapping
) actorProperties
getProperty :: Ord a => String -> Actor a -> Maybe G.PropertyValue
getProperty :: (Show a, Ord a) => String -> Actor a -> Maybe G.PropertyValue
getProperty name act =
case find (\a -> name == apName a) $ actorProperties act of
Just p -> Just $ apValue p

View File

@ -23,7 +23,7 @@ data SpriteAnimation = SpriteAnimation
}
runAnimation
:: Ord a
:: (Show a, Ord a)
=> Actor a
-> SpriteAnimation
-> Affection us (SpriteAnimation, Actor a)