helm-0.6.2: 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 Engine Source

A data structure describing the current engine state.

Constructors

Engine 

Fields

window :: Window
 
renderer :: Renderer
 
cache :: Map FilePath Surface
 

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

startup :: EngineConfig -> IO EngineSource

Creates a new engine that can be run later using run.

run :: Engine -> SignalGen (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) -> SignalGen (Signal a) -> SignalGen (Signal b)Source

Applies a function to a signal producing a new signal. This is a wrapper around the builtin fmap function that automatically binds the input signal out of the signal generator.

 render <~ Window.dimensions