helm-0.7.0: A functionally reactive game engine.

Safe HaskellNone

FRP.Helm

Contents

Description

Contains miscellaneous utility functions and the main functions for interfacing with the engine.

Synopsis

Types

type Time = DoubleSource

A type describing an amount of time in an arbitary unit. Use the time composing/converting functions to manipulate time values.

data EngineConfig Source

A data structure describing miscellaneous initial configurations of the game window and engine.

Constructors

EngineConfig 

Fields

windowDimensions :: (Int, Int)
 
windowIsFullscreen :: Bool
 
windowIsResizable :: Bool
 
windowTitle :: String
 

Engine

run :: EngineConfig -> Signal Element -> IO ()Source

Initializes and runs the game engine. The supplied signal generator is constantly sampled for an element to render until the user quits.

 import FRP.Helm
 import qualified FRP.Helm.Window as Window

 render :: (Int, Int) -> Element
 render (w, h) = collage w h [rect (fromIntegral w) (fromIntegral h) |> filled red]

 main :: IO ()
 main = run defaultConfig $ lift render Window.dimensions

defaultConfig :: EngineConfigSource

Creates the default configuration for the engine. You should change the fields where necessary before passing it to run.

Prelude

lift :: (a -> b) -> Signal a -> Signal bSource

Applies a function to a signal producing a new signal. This is a synonym of fmap. It automatically binds the input signal out of the signal generator.

 lift render Window.dimensions