spice-0.3.2.2: 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

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

Instances

Eq WindowConfig 
Read WindowConfig 
Show WindowConfig 
Default WindowConfig

A default instance for WindowConfig. Equivalent to calling defaultWindowConfig.

defaultWindowConfig :: WindowConfig

The default for WindowConfig

getWindowWidth      = 640

getWindowHeight     = 480

getWindowFullscreen = False

getWindowTitle      = "Spice Application"

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

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

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

Constructors

Input 

Fields

mousePosition :: Vector Float
 
keyboard :: Map Key Bool
 
mouse :: Map MouseButton Bool
 

type DeltaTime = Float

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

class Game a where

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

render :: a -> Scene