sdl2-gfx-0.2: Bindings to SDL2_gfx.

Copyright(c) 2015 Siniša Biđin
Safe HaskellNone



Bindings to SDL2_gfx's framerate management functionality. These functions should allow you to set, manage and query a target application framerate.



type Framerate = Int Source #

A certain number of frames per second.

newtype Manager Source #

A framerate manager, counting frames and keeping track of time delays necessary to reach a certain target framerate.


Manager (Ptr Manager) 

with :: (MonadBaseControl IO m, MonadIO m) => Framerate -> (Manager -> m a) -> m a Source #

Creates a new framerate Manager, sets a target Framerate and frees the Manager after the inner computation ends.

This is the recommended way to create a Manager.

manager :: MonadIO m => m Manager Source #

Create a new framerate Manager using the default settings.

You have to take care to call destroyManager yourself. It's recommended to use with instead.

set :: MonadIO m => Manager -> Framerate -> m () Source #

Set a target framerate and reset delay interpolation.

Note that the given framerate must be within the allowed range -- otherwise the minimum or maximum allowed framerate is used instead.

delay :: MonadIO m => Manager -> m Int Source #

Generate and apply a delay in order to maintain a constant target framerate.

This should be called once per rendering loop.

Delay will automatically be set to zero if the computer cannot keep up (if rendering is too slow). Returns the number of milliseconds since the last time delay was called (possibly zero).

delay_ :: MonadIO m => Manager -> m () Source #

Same as delay, but doesn't return the time since it was last called.

minimum :: Framerate Source #

The smallest allowed framerate.

maximum :: Framerate Source #

The largest allowed framerate.

get :: MonadIO m => Manager -> m Framerate Source #

Get the currently set framerate.

count :: MonadIO m => Manager -> m Int Source #

Returns the framecount. Each time delay is called, a frame is counted.

destroyManager :: MonadIO m => Manager -> m () Source #

Frees a framerate manager. Make sure not to use it again after this action.