free-game-1.1.79: Create games for free

Copyright(C) 2013 Fumiaki Kinoshita
LicenseBSD-style (see the file LICENSE)
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

FreeGame.Util

Contents

Description

 

Synopsis

Controlling

tick :: (Monad f, MonadFree f m) => m () Source

Delimit the computation to yield a frame.

foreverTick :: (Monad f, MonadFree f m) => m a -> m any Source

Warning: In most cases, foreverFrame is good enough and fast.

An infinite loop that run tick every frame after the given action.

foreverFrame :: (Monad f, Monad m, MonadTrans t, MonadFree f (t m)) => m a -> t m any Source

foreverFrame :: Frame a -> Game any

untick :: (Monad m, FreeGame m) => IterT Frame a -> m (Either (IterT Frame a) a) Source

Extract the next frame of the action.

untickInfinite :: (Monad m, FreeGame m) => IterT Frame Void -> m (IterT Frame Void) Source

An infinite version of untick.

Random

randomness :: (Random r, FromFinalizer m) => (r, r) -> m r Source

Get a given range of value.

Helper

degrees :: Floating a => a -> a Source

Convert radians to degrees.

radians :: Floating a => a -> a Source

Convert degrees to radians.

unitV2 :: Floating a => a -> V2 a Source

An unit vector with the specified angle.

angleV2 :: RealFloat a => V2 a -> a Source

An angle of the given vector.

Loading

loadPictureFromFile :: (Picture2D p, FromFinalizer m) => FilePath -> m (p ()) Source

Create a Picture from the given file.

loadBitmaps :: FilePath -> Q [Dec] Source

Load and define all pictures in the specified directory. On base >= 4.6, file paths to actually load will be respect to the directory of the executable. Otherwise it will be based on the current directory.

loadBitmapsWith :: ExpQ -> FilePath -> Q [Dec] Source

The type of the given ExpQ must be FilePath -> IO FilePath FIXME: This may cause name duplication if there are multiple non-alphanumeric file names.

Keyboard

keySpecial :: Keyboard f => Key -> f Bool Source

Deprecated: use keyPress instead