spice-0.4.0.0: An FRP-based game engine written in Haskell.

Safe HaskellNone
LanguageHaskell2010

FRP.Spice

Description

This module re-exports some other modules in the spice library so that you needn't import all of them explicitly.

Synopsis

Documentation

data LoadAsset Source

A single call to load an asset.

Constructors

LoadSprite FilePath 

type LoadAssets = DoList [LoadAsset] Source

A list of LoadAssets that may be composed in do-notation.

data Assets Source

The data structure that contains the loaded assets.

Constructors

Assets 

Instances

Default Assets

A synonym for defaultAssets to fit within the data-default library.

defaultAssets :: Assets Source

The default state for the Assets data type. Used as the initial state for performAssetLoads.

appendSprite :: Assets -> FilePath -> Sprite -> Assets Source

Appending a Sprite to an Assets.

performAssetLoads :: LoadAssets -> IO Assets Source

Performing the actual loading upon a LoadAssets.

data WindowConfig Source

A datatype to configure the window settings when creating an OpenGL context using startEngine in the engine.

Instances

defaultWindowConfig :: WindowConfig Source

The default for WindowConfig

getWindowWidth      = 640
getWindowHeight     = 480
getWindowFullscreen = False
getWindowTitle      = "Spice Application"

startEngine :: Game a => WindowConfig -> a -> IO () Source

Starting the spice engine with the parameters prescribed in the WindowConfig. It updates and renders the Game automatically so all you need to to is set up the WindowConfig and make a datatype with an instance of Game.

data Input Source

A container for all of the states themselves. It is used as a Signal Input in the InputContainer (which is necessary to use it within Elerea's FRP network).

type DeltaTime = Float Source

A synonym to make the update function more self-documenting.

class Game a where Source

The class which is to be used in the startEngine function. update provides the API to update on every tick (purely), an render provides the API to render every frame.

Methods

update :: DeltaTime -> Input -> a -> a Source

render :: Assets -> a -> Scene Source

loadAssets :: a -> LoadAssets Source