Copyright | (c) Francesco Gazzetta, 2016 |
---|---|
License | MIT |
Maintainer | francygazz@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Graphics.Shine
Description
- toContext :: Element -> IO CanvasRenderingContext2D
- fullScreenCanvas :: Window -> IO CanvasRenderingContext2D
- fixedSizeCanvas :: Window -> Int -> Int -> IO CanvasRenderingContext2D
- animate :: CanvasRenderingContext2D -> Float -> (Float -> Picture) -> IO ()
- animateIO :: CanvasRenderingContext2D -> Float -> (Float -> IO Picture) -> IO ()
- play :: (IsEventTarget eventElement, IsDocument eventElement) => CanvasRenderingContext2D -> eventElement -> Float -> state -> (state -> Picture) -> (Input -> state -> state) -> (Float -> state -> state) -> IO ()
- playIO :: (IsEventTarget eventElement, IsDocument eventElement) => CanvasRenderingContext2D -> eventElement -> Float -> state -> (state -> IO Picture) -> (Input -> state -> IO state) -> (Float -> state -> IO state) -> IO ()
Getting a rendering context
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
Arguments
:: CanvasRenderingContext2D | the context to draw on |
-> Float | FPS |
-> (Float -> Picture) | Your drawing function |
-> IO () |
Draws a picture which depends only on the time
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.
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.
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