free-game- Create graphical applications for free.

MaintainerFumiaki Kinsohita <>
Safe HaskellNone




Abstract structures that represents user interfaces



type Game = Free GameActionSource

Game is a Monad that abstracts user interfaces.

data GameAction a Source

A base for Game monad.

Basic operations

tick :: MonadFree GameAction m => m ()Source

Finalize the current frame and refresh the screen.

embedIO :: MonadFree GameAction m => IO a -> m aSource

Embed arbitrary IO actions into a Game monad.

bracket :: MonadFree GameAction m => Game a -> m aSource

Run a Game monad in a Game monad. resources (e.g. pictures) will be released when inner computation is done.

quitGame :: MonadFree GameAction m => m VoidSource

Break the current computation.


data Color Source

A color that has red, green, blue, alpha as its component.


Color Float Float Float Float 

data Picture Source

A 2D Picture.


Bitmap Bitmap

A Bitmap as a Picture.

BitmapPicture Bitmap

Deprecated: use Bitmap instead

Deprecated synonym for Bitmap.

Pictures [Picture]

A picture consist of some Pictures.

PictureWithFinalizer (FinalizerT IO Picture)

A picture that may have side effects(internal use only).

Rotate Float Picture

Rotated picture by the given angle (in degrees, counterclockwise).

Scale Vec2 Picture

Scaled picture.

Translate Vec2 Picture

A picture translated by the given coordinate.

Colored Color Picture

Colored picture.

transPicture :: (Picture -> Picture) -> GameAction cont -> GameAction contSource

Lift a picture transformation into transformation of GameAction


getButtonState :: MonadFree GameAction m => Button -> m BoolSource

Is the specified Button is pressed?


data GameParam Source

Parameters of the application.


defaultGameParam :: GameParamSource

640*480(windowed), 60fps

getCurrentGameParam :: MonadFree GameAction m => m GameParamSource

Get the game params that apply to the currently running game.


askInput :: MonadFree GameAction m => Button -> m BoolSource

Deprecated: use getButtonState instead.

Deprecated synonym for getButtonState.

getMouseState :: MonadFree GameAction m => m MouseStateSource

Deprecated: use getMousePosition and getMouseWheel instead.

Yields the mouse's state.