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

Safe HaskellNone
LanguageHaskell2010

FRP.Spice

Description

This module re-exports the core elements of the library, along with all of the types housed within the library.

Synopsis

Documentation

loadSpriteAsset :: FilePath -> LoadAssets Source

Creating a LoadAsset call to load a Sprite.

bindColor :: Color -> Scene Source

Binding a color to change the current OpenGL color.

color4f :: Float -> Float -> Float -> Float -> Color Source

Constructing a color from 4 Floats.

color3f :: Float -> Float -> Float -> Color Source

Constructing a color from 3 Floats, with the alpha channel defaulting to its maximum (of 1.0).

color4i :: Int -> Int -> Int -> Int -> Color Source

Constructing a color from 4 Ints.

color3i :: Int -> Int -> Int -> Color Source

Constructing a color from 3 Ints, with the alpha channel defaulting to its maximum (of 255).

black :: Color Source

The color black.

white :: Color Source

The color white.

grey :: Color Source

The color gray.

gray :: Color Source

A synonym for the color grey.

red :: Color Source

The color red.

green :: Color Source

The color green.

blue :: Color Source

The color blue.

renderPoint :: Vector Float -> Scene Source

Rendering a position.

renderLine :: Vector Float -> Vector Float -> Scene Source

Rendering a line.

renderTriangle :: Vector Float -> Vector Float -> Vector Float -> Scene Source

Rendering a triangle.

renderRectangle :: Vector Float -> Vector Float -> Scene Source

Rendering a rectangle.

renderSquare :: Vector Float -> Float -> Scene Source

Rendering a square.

renderPolygon :: [Vector Float] -> Scene Source

Rendering a polygon of any n sides.

renderSprite :: Sprite -> Vector Float -> Scene Source

Rendering a Sprite at the position specified.

renderSpriteWithSize :: Sprite -> Vector Float -> Vector Float -> Scene Source

Rendering a Sprite at the position specified with the size specified.

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

Starting the engine with window parameters described within the provided WindowConfig.

startEngineDefault :: Game a => a -> IO () Source

Starting the engine with default window parameter.

data DoListT a b Source

A data type that can be composed (so long as the data stored is a Monoid) in do-notation.

Constructors

DoListT a b 

Instances

Monoid a => Monad (DoListT a)

The Monad instance to allow the DoList to compose through do-notation.

Functor (DoListT a)

A Functor instance to satisfy the Applicative's requirements.

Monoid a => Applicative (DoListT a)

An Applicative instance to satisfy the Monad's requirements in the future.

type DoList a = DoListT a () Source

A type synonym for the DoListT that should be used.

data WindowConfig Source

The config that is used to define the GLFW window's properties.

Instances

Default WindowConfig

The default state for a WindowConfig.

data Color Source

A data type representing a color as 4 floats (r, g, b, a) representing red, green, blue, and the alpha channel respectively. The floats should range from 0 to 1, representing 0 to 255 in more classical representations.

Constructors

Color 

data Vector a Source

A data type that stores two values. It can be used to perform basic vector logic. It should be noted that the Vector logic provided in this library is not linear-algebra style vector logic.

Constructors

Vector a a 

Instances

Functor Vector

A functor instance to apply a function onto both values stored in a Vector.

Applicative Vector

An applicative instance to allow one to write functions on Vectors that have separate functions for both values.

Default a => Default (Vector a)

The default state for a Vector.

data Sinks Source

A wrapper around the sinks for the mouse position, mouse buttons, and keyboard keys.

Constructors

Sinks 

Fields

mousePosSink :: Vector Float -> IO ()
 
mouseButtonSink :: Map MouseButton (Bool -> IO ())
 
keySink :: Map Key (Bool -> IO ())
 

data Input Source

A data structure that represents the current state of the input. Used in the InputContainer along with the Sink to handle all input -- updating and referencing.

data InputContainer Source

The container for both Sink and Input. The Input is stored within a Signal so it may be used within the FRP/Elerea part of the framework.

Constructors

InputContainer 

data Sprite Source

Containing all of the necessary information for rendering an image on screen (aside from the position where the sprite should be rendered.)

Constructors

Sprite 

data LoadAsset Source

Representing the loading of an asset into the game framework.

Constructors

LoadSprite FilePath 

data Assets Source

Storing the loaded assets in a single data structure.

Constructors

Assets 

Instances

Default Assets

The default state for an Assets.

type Scene = IO () Source

A type synonym to imply that functions performed in this function should solely render.

type DeltaTime = Float Source

A type synonym to make the delta time (in the Game definition) more self documenting.

class Game a where Source

The requirements for a given data structure to be used as a game within the framework.

Methods

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

render :: Assets -> a -> Scene Source

loadAssets :: a -> LoadAssets Source

up :: Num a => Vector a Source

The cardinal directions.

right :: Num a => Vector a Source

The cardinal directions.

left :: Num a => Vector a Source

The cardinal directions.

down :: Num a => Vector a Source

The cardinal directions.

(^+) :: Num a => Vector a -> Vector a -> Vector a infixl 6 Source

Adding two Vectors.

(^-) :: Num a => Vector a -> Vector a -> Vector a infixl 6 Source

Subtracting a Vector from another Vector.

(^*) :: Num a => Vector a -> Vector a -> Vector a infixl 7 Source

Multiplying two Vectors (not a dot product, but rather multiplying the first value in the first vector by the second value in the second vector, and the same with with the second value.)

(^.) :: Num a => Vector a -> Vector a -> a infixl 7 Source

The dot product of two Vectors.

(^+>) :: Num a => Vector a -> a -> Vector a infixl 6 Source

Adding a Vector and a given number. Effectively the same as calling (^+) on a Vector and a Vector n n.

(^->) :: Num a => Vector a -> a -> Vector a infixl 6 Source

Subtracting a number from a Vector. Effectively the same as calling (^-) on a Vector and a Vector n n.

(^*>) :: Num a => Vector a -> a -> Vector a infixl 7 Source

Multiplying a Vector by a given number. Effecitvely the same as calling (^*) on a Vector and a Vector n n.

(^.>) :: Num a => Vector a -> a -> a infixl 7 Source

The dot product of two Vectors.