{-# OPTIONS_HADDOCK hide #-}

module Brillo.Internals.Interface.Animate.State (
  State (..),
  stateInit,
)
where


-- | Animation State
data State
  = State
  { State -> Bool
stateAnimate :: !Bool
  -- ^ Whether the animation is running.
  , State -> Integer
stateAnimateCount :: !Integer
  -- ^ How many times we've entered the animation loop.
  , State -> Bool
stateAnimateStart :: !Bool
  -- ^ Whether this is the first frame of the animation.
  , State -> Double
stateAnimateTime :: !Double
  -- ^ Number of msec the animation has been running for
  , State -> Double
stateDisplayTime :: !Double
  -- ^ The time when we entered the display callback for the current frame.
  , State -> Double
stateDisplayTimeLast :: !Double
  , State -> Double
stateDisplayTimeClamp :: !Double
  -- ^ Clamp the minimum time between frames to this value (in seconds)
  --      Setting this to < 10ms probably isn't worthwhile.
  , State -> Double
stateGateTimeStart :: !Double
  -- ^ The time when the last call to the users render function finished.
  , State -> Double
stateGateTimeEnd :: !Double
  -- ^ The time when displayInWindow last finished (after sleeping to clamp fps).
  , State -> Double
stateGateTimeElapsed :: !Double
  -- ^ How long it took to draw this frame
  }


stateInit :: State
stateInit :: State
stateInit =
  State
    { stateAnimate :: Bool
stateAnimate = Bool
True
    , stateAnimateCount :: Integer
stateAnimateCount = Integer
0
    , stateAnimateStart :: Bool
stateAnimateStart = Bool
True
    , stateAnimateTime :: Double
stateAnimateTime = Double
0
    , stateDisplayTime :: Double
stateDisplayTime = Double
0
    , stateDisplayTimeLast :: Double
stateDisplayTimeLast = Double
0
    , stateDisplayTimeClamp :: Double
stateDisplayTimeClamp = Double
0.01
    , stateGateTimeStart :: Double
stateGateTimeStart = Double
0
    , stateGateTimeEnd :: Double
stateGateTimeEnd = Double
0
    , stateGateTimeElapsed :: Double
stateGateTimeElapsed = Double
0
    }