sdl2-gfx-0.2: Bindings to SDL2_gfx.

Copyright(c) 2015 Siniša Biđin
LicenseMIT
Maintainersinisa@bidin.eu
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

SDL.Framerate

Description

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

Synopsis

Documentation

type Framerate = Int #

A certain number of frames per second.

newtype Manager #

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

Constructors

Manager (Ptr Manager) 

Instances

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

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 #

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 () #

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 #

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 () #

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

minimum :: Framerate #

The smallest allowed framerate.

maximum :: Framerate #

The largest allowed framerate.

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

Get the currently set framerate.

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

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

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

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