2018-06-04 03:29:20 +00:00
|
|
|
module Types.Animation where
|
|
|
|
|
|
|
|
import NanoVG (Image)
|
|
|
|
|
|
|
|
import Types.Direction
|
|
|
|
|
|
|
|
data AnimId = AnimId
|
2019-02-14 21:31:00 +00:00
|
|
|
{ aiVariation :: AnimationName
|
|
|
|
, aiName :: String
|
2018-06-04 03:29:20 +00:00
|
|
|
, aiDirection :: Direction
|
|
|
|
}
|
|
|
|
deriving (Show, Eq, Ord)
|
|
|
|
|
|
|
|
data AnimState = AnimState
|
|
|
|
{ asId :: AnimId
|
|
|
|
, asCurrentFrame :: Int
|
|
|
|
, asElapsedTime :: Double
|
|
|
|
}
|
2018-06-08 23:17:03 +00:00
|
|
|
deriving (Show, Eq)
|
2018-06-04 03:29:20 +00:00
|
|
|
|
|
|
|
data AnimPlayback
|
|
|
|
= APLoop
|
|
|
|
| APOnce
|
2018-06-08 23:17:03 +00:00
|
|
|
deriving (Show, Eq)
|
2018-06-04 03:29:20 +00:00
|
|
|
|
|
|
|
data Animation = Animation
|
|
|
|
{ animDuration :: Double
|
|
|
|
, animSprites :: [Image]
|
|
|
|
, animPlay :: AnimPlayback
|
|
|
|
}
|
2018-06-08 23:17:03 +00:00
|
|
|
deriving (Show, Eq)
|
2018-06-04 03:29:20 +00:00
|
|
|
|
|
|
|
data AnimationConfig = AnimationConfig
|
|
|
|
{ animConfOffset :: (Int, Int)
|
|
|
|
, animConfSize :: (Int, Int)
|
2018-07-21 04:43:26 +00:00
|
|
|
, animConfStep :: (Int, Int)
|
2018-06-04 03:29:20 +00:00
|
|
|
, animConfCount :: Int
|
|
|
|
, animConfDuration :: Double
|
|
|
|
, animConfPlay :: AnimPlayback
|
|
|
|
}
|
2018-06-08 23:17:03 +00:00
|
|
|
deriving (Show, Eq)
|
2019-02-14 21:31:00 +00:00
|
|
|
|
|
|
|
data AnimationName
|
|
|
|
= AnimIntruder
|
|
|
|
| AnimCopier
|
|
|
|
| AnimComputer
|
|
|
|
| AnimToilet
|
|
|
|
| AnimJDoeM
|
|
|
|
| AnimDoor0
|
|
|
|
deriving (Show, Eq, Ord, Enum)
|
2019-03-09 19:36:21 +00:00
|
|
|
|
|
|
|
isWallLike :: AnimationName -> Bool
|
|
|
|
isWallLike AnimDoor0 = True
|
|
|
|
isWallLike _ = False
|