free-game-1.1.78: Create games for free

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

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 anySource

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 anySource

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 rSource

Get a given range of value.

Helper

degrees :: Floating a => a -> aSource

Convert radians to degrees.

radians :: Floating a => a -> aSource

Convert degrees to radians.

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

An unit vector with the specified angle.

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

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 BoolSource

Deprecated: use keyPress instead