Add frame clock
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
module Dodge.Clock
|
||||
( clockCycle
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
|
||||
import qualified Data.Vector as V
|
||||
clockCycle :: Int -> V.Vector a -> World -> a
|
||||
{-# INLINABLE clockCycle #-}
|
||||
clockCycle tPeriod xs w = xs V.! i
|
||||
where
|
||||
l = V.length xs
|
||||
t = _frameClock w `mod` (l * tPeriod)
|
||||
i = t `div` tPeriod
|
||||
Reference in New Issue
Block a user