shine-0.1.0.0: Declarative graphics for the browser using GHCJS

Copyright(c) Francesco Gazzetta, 2016
LicenseMIT
Maintainerfrancygazz@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Graphics.Shine

Contents

Description

The main module. Here are defined all the functions needed to get an animation on the screen.

If you want to render a single Picture only once, use render from Render

Synopsis

Getting a rendering context

toContext Source

Arguments

:: Element

this must be a canvas

-> IO CanvasRenderingContext2D 

Get a context from a canvas element.

fullScreenCanvas :: Window -> IO CanvasRenderingContext2D Source

Create a full screen canvas

fixedSizeCanvas :: Window -> Int -> Int -> IO CanvasRenderingContext2D Source

Create a fixed size canvas given the dimensions

Drawing

animate Source

Arguments

:: CanvasRenderingContext2D

the context to draw on

-> Float

FPS

-> (Float -> Picture)

Your drawing function

-> IO () 

Draws a picture which depends only on the time

animateIO Source

Arguments

:: CanvasRenderingContext2D

the context to draw on

-> Float

FPS

-> (Float -> IO Picture)

Your drawing function

-> IO () 

Draws a picture which depends only on the time... and everything else, since you can do I/O.

play Source

Arguments

:: (IsEventTarget eventElement, IsDocument eventElement) 
=> CanvasRenderingContext2D

the context to draw on

-> eventElement 
-> Float

FPS

-> state

Initial state

-> (state -> Picture)

Drawing function

-> (Input -> state -> state)

Input handling function

-> (Float -> state -> state)

Stepping function

-> IO () 

Lets you manage the input.

playIO Source

Arguments

:: (IsEventTarget eventElement, IsDocument eventElement) 
=> CanvasRenderingContext2D

the context to draw on

-> eventElement 
-> Float

FPS

-> state

Initial state

-> (state -> IO Picture)

Drawing function

-> (Input -> state -> IO state)

Input handling function

-> (Float -> state -> IO state)

Stepping function

-> IO () 

Same thing with I/O