Safe Haskell | None |
---|---|
Language | Haskell2010 |
- play :: GleamConfig -> model -> (model -> Picture) -> (model -> model) -> (InputEvent -> model -> model) -> IO ()
- playMultiple :: [Simulation] -> IO ()
- data Picture
- type Point = (Double, Double)
- type Vector = Point
- type Path = [Point]
- data Source
- lineLoop :: Path -> Picture
- sectorWire :: Double -> Double -> Double -> Picture
- rectanglePath :: Double -> Double -> Path
- rectangleWire :: Double -> Double -> Picture
- rectangleSolid :: Double -> Double -> Picture
- convertColor :: Color -> String
- defaultGleamConfig :: GleamConfig
Documentation
:: GleamConfig | Canvas size. |
-> model | Initial model for the simulation. |
-> (model -> Picture) | Function to generate a picture from a model. |
-> (model -> model) | Function to update the state of the simulation. |
-> (InputEvent -> model -> model) | Function to handle input events. |
-> IO () |
Run a simulation in a window. You decide how the model is represented, how to convert the model to a picture and how to update the model. This function does the rest. The simulation can be seen on `127.0.0.1:8023`
playMultiple :: [Simulation] -> IO () Source #
Run multiple simulations in a window. You decide how each model is represented, how to convert each model to a picture and how to update the model. This function does the rest. The simulations can be seen on `127.0.0.1:8023`
A 2D picture
Blank | A blank picture, with nothing in it. |
Line Path | A line along an arbitrary path. |
Polygon Path | A polygon filled with a solid color. |
Circle Double | A circle with the given radius. |
Arc Double Double Double | A circular arc drawn counter-clockwise between two angles (in degrees) at the given radius. |
Rectangle Double Double | A rectangle drawn with given width and height. |
Image Source Double Double | Image to draw from a certain with given width and height. |
Text String Font FontSize | Some text to draw with a vector font. |
Color Color Picture | A picture drawn with this color. |
Stroke Color Double Picture | A picture drawn with this stroke, given a color and size. |
Translate Double Double Picture | A picture translated by the given x and y coordinates. |
Scale Double Double Picture | A picture scaled by the given x and y factors. |
Pictures [Picture] | A picture consisting of several others. |
An image location
Compound shapes
sectorWire :: Double -> Double -> Double -> Picture Source #
A wireframe sector of a circle. An arc is draw counter-clockwise from the first to the second angle at the given radius.
:: Double | width of rectangle |
-> Double | height of rectangle |
-> Path |
A path representing a rectangle centered about the origin
rectangleWire :: Double -> Double -> Picture Source #
A wireframe rectangle centered about the origin.
:: Double | width of rectangle |
-> Double | height of rectangle |
-> Picture |
A solid rectangle centered about the origin.
convertColor :: Color -> String Source #
Converts a color to a html color string.
defaultGleamConfig :: GleamConfig Source #
The default config for Gleam