Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- ticks :: MonadIO m => m Word32
- time :: (Fractional a, MonadIO m) => m a
- delay :: MonadIO m => Word32 -> m ()
- type TimerCallback = Word32 -> IO RetriggerTimer
- data Timer
- data RetriggerTimer
- addTimer :: MonadIO m => Word32 -> TimerCallback -> m Timer
- removeTimer :: MonadIO m => Timer -> m Bool
Time Measurement
ticks :: MonadIO m => m Word32 Source #
Number of milliseconds since library initialization.
See SDL_GetTicks
for C documentation.
time :: (Fractional a, MonadIO m) => m a Source #
The current time in seconds since some arbitrary starting point (consist over the life of the application).
This time is derived from the system's performance counter - see SDL_GetPerformanceFrequency
and SDL_GetPerformanceCounter
for C documentation about the implementation.
Timer
delay :: MonadIO m => Word32 -> m () Source #
Wait a specified number of milliseconds before returning.
Users are generally recommended to use threadDelay
instead, to take advantage of the abilities of the Haskell runtime.
See SDL_Delay
for C documentation.
type TimerCallback = Word32 -> IO RetriggerTimer Source #
A TimerCallback
is called with the interval size of the callback. It can return information as to whether or not the timer should continue to exist.
data RetriggerTimer Source #
RetriggerTimer
allows a callback to inform SDL if the timer should be retriggered or cancelled
Reschedule Word32 | Retrigger the timer again in a given number of milliseconds. |
Cancel | Cancel future invocations of this timer. |
Instances
addTimer :: MonadIO m => Word32 -> TimerCallback -> m Timer Source #
Set up a callback function to be run on a separate thread after the specified number of milliseconds has elapsed.
See SDL_AddTimer
for C documentation.
removeTimer :: MonadIO m => Timer -> m Bool Source #
Remove a Timer
.
See SDL_RemoveTimer
for C documentation.