Graphics.Gloss.Interface.Simulate
Description
Simulate mode is for producing an animation of some model who's picture
changes over finite time steps. The behavior of the model can also depent
on the current ViewPort
.
- module Graphics.Gloss.Data.Picture
- module Graphics.Gloss.Data.Color
- data ViewPort = ViewPort {
- viewPortTranslate :: (Float, Float)
- viewPortRotate :: Float
- viewPortScale :: Float
- simulateInWindow :: forall model. String -> (Int, Int) -> (Int, Int) -> Color -> Int -> model -> (model -> Picture) -> (ViewPort -> Float -> model -> model) -> IO ()
Documentation
module Graphics.Gloss.Data.Picture
module Graphics.Gloss.Data.Color
Constructors
ViewPort | |
Fields
|
Arguments
:: forall model . | |
=> String | Name of the window. |
-> (Int, Int) | Initial size of the window, in pixels. |
-> (Int, Int) | Initial position of the window, in pixels. |
-> Color | Background color. |
-> Int | Number of simulation steps to take for each second of real time. |
-> model | The initial model. |
-> (model -> Picture) | A function to convert the model to a picture. |
-> (ViewPort -> Float -> model -> model) | A function to step the model one iteration. It is passed the current viewport and the amount of time for this simulation step (in seconds). |
-> IO () |
Run a finite-time-step simulation in a window. You decide how the model is represented, how to convert the model to a picture, and how to advance the model for each unit of time. This function does the rest.
Once the window is open you can use the same commands as with displayInWindow
.