module Terminal.Game.Animation (module Terminal.Game.Animation,
module T
) where
import Terminal.Game.Plane
import Control.Timer.Tick as T
import Data.Serialize
import GHC.Generics
import qualified Data.ByteString as BS
import qualified Data.Bifunctor as BF
type Animation = T.Timed Plane
creaAni :: Loop -> [(Integer, Plane)] -> Animation
creaAni = creaTimedRes
instance Serialize ExpBehaviour
instance Serialize Loop
instance Serialize Cell
instance Serialize Plane
instance Serialize Animation
encodeAni :: FilePath -> Animation -> IO ()
encodeAni fp fs = BS.writeFile fp (encode fs)
decodeAni :: FilePath -> IO (Either String Animation)
decodeAni fp = fmap decode (BS.readFile fp) >>=
return . BF.bimap err id
where
err se = fp ++ ": " ++ se