free-game-1.0: 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

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 :: (Functor f, MonadFree f m) => IterT (F f) a -> m (Either (IterT (F f) a) a)Source

Extract the next frame of the action.

untickInfinite :: (Functor f, MonadFree f m) => IterT (F f) Void -> m (IterT (F f) 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.

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

The type of the given Name must be FilePath -> IO FilePath