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

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

Graphics.FreeGame.Simple

Contents

Description

The essentials of using free-game

Synopsis

Basic type

type Game = Free GameActionSource

Game is a Monad that abstracts user interfaces.

data GameAction a Source

A base for Game monad.

Run the game

data GameParam Source

Parameters of the application.

Instances

defaultGameParam :: GameParamSource

640*480(windowed), 60fps

runSimpleSource

Arguments

:: GameParam 
-> world

An initial world

-> (world -> Game world)

A computation yielding new world

-> IO () 

Run a Game by the given initial state and updating function.

runSimple'Source

Arguments

:: GameParam 
-> world

An initial world

-> (world -> forall m. MonadFree GameAction m => m world)

A computation yielding new world

-> IO () 

Run more efficiently.

In the Game monad

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

Is the specified Button is pressed?

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

Embed arbitrary IO actions into a Game monad.

quitGame :: MonadFree GameAction m => m VoidSource

Break the current computation.

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

Finalize the current frame and refresh the screen.

About Picture

data Picture Source

A 2D Picture.

Constructors

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(for internal use).

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.

data Bitmap Source

Concrete bitmap data

loadBitmapFromFile :: FilePath -> IO BitmapSource

Create a Bitmap from the given file.

loadBitmaps :: FilePath -> Q [Dec]Source

Load and define all pictures in the specified directory.

Drawing texts

data Font Source

Font object

loadFont :: FilePath -> IO FontSource

Create a Font from the given file.

text :: Font -> Float -> String -> PictureSource

Render a text by the specified Font.

Utilities

randomness :: (Random r, MonadFree GameAction m) => (r, r) -> m rSource

Get a given range of value.

degrees :: Float -> FloatSource

Convert radians to degrees.

Deprecated

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.

Reexports