free-game-0.3.1.1: Create graphical applications for free.

Portabilitynon-portable
Stabilityexperimental
MaintainerFumiaki Kinsohita <fumiexcel@gmail.com>
Safe HaskellNone

Graphics.FreeGame.Base

Contents

Description

Abstract structures that represents user interfaces

Synopsis

Types

type Game = Free GameActionSource

Game is a Monad that abstracts user interfaces.

data GameAction a Source

A base for Game monad.

Instances

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 aSource

Break the current computation.

Pictures

data Picture Source

A 2D Picture.

Constructors

BitmapPicture Bitmap

A Bitmap as a Picture.

Pictures [Picture]

A picture consist of some Pictures.

IOPicture (IO Picture)

A picture that may have side effects.

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

Inputs

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

Is the specified Key is pressed?

getMouseState :: MonadFree GameAction m => m MouseStateSource

Get the mouse's state.

Settings

data GameParam Source

Parameters of the application.

Constructors

GameParam 

defaultGameParam :: GameParamSource

640*480(windowed), 60fps

Deprecated

loadPicture :: MonadFree GameAction m => Bitmap -> m PictureSource

Deprecated: No longer needed; use BitmapPicture instead

Create a Picture from Bitmap.