{-# LANGUAGE RankNTypes #-}
module Brillo.Interface.Pure.Simulate (
module Brillo.Data.Display,
module Brillo.Data.Picture,
module Brillo.Data.Color,
simulate,
ViewPort (..),
)
where
import Brillo.Data.Color
import Brillo.Data.Display
import Brillo.Data.Picture
import Brillo.Data.ViewPort
import Brillo.Internals.Interface.Backend
import Brillo.Internals.Interface.Simulate
simulate
:: Display
-> Color
-> Int
-> model
-> (model -> Picture)
-> (ViewPort -> Float -> model -> model)
-> IO ()
simulate :: forall model.
Display
-> Color
-> Int
-> model
-> (model -> Picture)
-> (ViewPort -> Float -> model -> model)
-> IO ()
simulate
Display
display
Color
backColor
Int
simResolution
model
modelStart
model -> Picture
modelToPicture
ViewPort -> Float -> model -> model
modelStep =
do
()
_ <-
GLFWState
-> Display
-> Color
-> Int
-> model
-> (model -> IO Picture)
-> (ViewPort -> Float -> model -> IO model)
-> IO ()
forall model a.
Backend a =>
a
-> Display
-> Color
-> Int
-> model
-> (model -> IO Picture)
-> (ViewPort -> Float -> model -> IO model)
-> IO ()
simulateWithBackendIO
GLFWState
defaultBackendState
Display
display
Color
backColor
Int
simResolution
model
modelStart
(Picture -> IO Picture
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Picture -> IO Picture)
-> (model -> Picture) -> model -> IO Picture
forall b c a. (b -> c) -> (a -> b) -> a -> c
. model -> Picture
modelToPicture)
(\ViewPort
view Float
time model
model -> model -> IO model
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (model -> IO model) -> model -> IO model
forall a b. (a -> b) -> a -> b
$ ViewPort -> Float -> model -> model
modelStep ViewPort
view Float
time model
model)
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()