{-# OPTIONS_HADDOCK hide #-}

module Graphics.Gloss.Internals.Interface.Animate.State
        ( State (..)
        , stateInit )
where

-- | Animation State
data State
        = State
        {
        -- | Whether the animation is running.
          State -> Bool
stateAnimate                  :: !Bool

        -- | How many times we've entered the animation loop.
        , State -> Integer
stateAnimateCount             :: !Integer

        -- | Whether this is the first frame of the animation.
        , State -> Bool
stateAnimateStart             :: !Bool

        -- | Number of msec the animation has been running for
        , State -> Double
stateAnimateTime              :: !Double

        -- | The time when we entered the display callback for the current frame.
        , State -> Double
stateDisplayTime              :: !Double
        , State -> Double
stateDisplayTimeLast          :: !Double

        -- | Clamp the minimum time between frames to this value (in seconds)
        --      Setting this to < 10ms probably isn't worthwhile.
        , State -> Double
stateDisplayTimeClamp         :: !Double

        -- | The time when the last call to the users render function finished.
        , State -> Double
stateGateTimeStart            :: !Double

        -- | The time when displayInWindow last finished (after sleeping to clamp fps).
        , State -> Double
stateGateTimeEnd              :: !Double

        -- | How long it took to draw this frame
        , State -> Double
stateGateTimeElapsed          :: !Double }


stateInit :: State
stateInit :: State
stateInit
        = State :: Bool
-> Integer
-> Bool
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> State
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 }