| Copyright | (c) Francesco Gazzetta 2016 |
|---|---|
| License | MIT |
| Maintainer | francygazz@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell98 |
Graphics.Shine
Description
Synopsis
- toContext :: Element -> JSM CanvasRenderingContext2D
- fullScreenCanvas :: Document -> JSM CanvasRenderingContext2D
- fixedSizeCanvas :: Document -> Int -> Int -> JSM CanvasRenderingContext2D
- animate :: CanvasRenderingContext2D -> Double -> (Double -> Picture) -> JSM ()
- animateIO :: CanvasRenderingContext2D -> Double -> (Double -> IO Picture) -> JSM ()
- play :: (IsEventTarget eventElement, IsDocument eventElement) => CanvasRenderingContext2D -> eventElement -> Double -> state -> (state -> Picture) -> (Input -> state -> state) -> (Double -> state -> state) -> JSM ()
- playIO :: (IsEventTarget eventElement, IsDocument eventElement) => CanvasRenderingContext2D -> eventElement -> Double -> state -> (state -> IO Picture) -> (Input -> state -> IO state) -> (Double -> state -> IO state) -> JSM ()
Getting a rendering context
Arguments
| :: Element | this must be a canvas |
| -> JSM CanvasRenderingContext2D |
Get a context from a canvas element.
fullScreenCanvas :: Document -> JSM CanvasRenderingContext2D Source #
Create a full screen canvas
fixedSizeCanvas :: Document -> Int -> Int -> JSM CanvasRenderingContext2D Source #
Create a fixed size canvas given the dimensions
Drawing
Arguments
| :: CanvasRenderingContext2D | the context to draw on |
| -> Double | FPS |
| -> (Double -> Picture) | Your drawing function |
| -> JSM () |
Draws a picture which depends only on the time
Arguments
| :: CanvasRenderingContext2D | the context to draw on |
| -> Double | FPS |
| -> (Double -> IO Picture) | Your drawing function |
| -> JSM () |
Draws a picture which depends only on the time... and everything else, since you can do I/O.
Arguments
| :: (IsEventTarget eventElement, IsDocument eventElement) | |
| => CanvasRenderingContext2D | the context to draw on |
| -> eventElement | |
| -> Double | FPS |
| -> state | Initial state |
| -> (state -> Picture) | Drawing function |
| -> (Input -> state -> state) | Input handling function |
| -> (Double -> state -> state) | Stepping function |
| -> JSM () |
Lets you manage the input.
Arguments
| :: (IsEventTarget eventElement, IsDocument eventElement) | |
| => CanvasRenderingContext2D | the context to draw on |
| -> eventElement | |
| -> Double | FPS |
| -> state | Initial state |
| -> (state -> IO Picture) | Drawing function |
| -> (Input -> state -> IO state) | Input handling function |
| -> (Double -> state -> IO state) | Stepping function |
| -> JSM () |
Same thing with I/O