spice-0.2.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 WindowConfig Source

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

defaultWindowConfig :: WindowConfig Source

The default for WindowConfig

getWindowWidth      = 640
getWindowHeight     = 480
getWindowFullscreen = False
getWindowResizeable = 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 Sinks Source

A wrapper around the sinks for the mouse position, the key states, and the mouse button states.

Constructors

Sinks 

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).

data InputContainer Source

A container around Sinks and Signal Input so that one needn't pass around a tuple.

Constructors

InputContainer 

makeInputContainer :: IO InputContainer Source

Making an InputContainer filled with all necessary externals.

makeMousePositionCallback :: WindowConfig -> InputContainer -> MousePosCallback Source

Creating a callback to update the mouse position's state.

makeKeyboardCallback :: InputContainer -> KeyCallback Source

Creating a callback to update the keyboard's states.

makeMouseCallback :: InputContainer -> MouseButtonCallback Source

Creating a callback to update the mouse buttons' states.

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 :: a -> Scene Source