sdl2-2.1.0: Both high- and low-level bindings to the SDL library (version 2.0.3).

Safe HaskellSafe
LanguageHaskell2010

SDL.Time

Contents

Synopsis

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 Timer Source

A timer created by addTimer. This Timer can be removed with removeTimer.

data RetriggerTimer Source

RetriggerTimer allows a callback to inform SDL if the timer should be retriggered or cancelled

Constructors

Reschedule Word32

Retrigger the timer again in a given number of milliseconds.

Cancel

Cancel future invocations of this timer.

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.