I am stuck in generating debug output for my game objects using Haskell / Yampa (= Arrows) (with HOOD).
My engine basically launches a list of game objects that produce output states (line, circle), which are then displayed.
data Output = Circle Position2 Double | Line Vector2
output :: [Output] -> IO ()
output oos = mapM render oos
render :: Output -> IO ()
render (Circle p r) = drawCircle p r
render (Line vec) = drawLine (Point2 0 0) vec
The player’s object simply moves to the right and appears as a (located) circle.
playerObject :: SF () Output -- SF is an Arrow run by time
p <- mover (Point2 0 0) -< (Vector2 10 0)
returnA -< (Circle p 2.0)
mover is just a simple integrator (acceleration position-> speed->), where I want to observe the speed and output it as a result of debugging as a (non-positional) line.
mover :: Position2 -> SF Vector2 Position2
mover position0 = proc acceleration -> do
velocity <- integral -< acceleration -- !! I want to observe velocity
position <- (position0 .+^) ^<< integral -< velocity
returnA -< position
How to create additional graphical debug output for internal values of functions of my game objects?
, (), ( ). , HOOD, Haskell , HOOD .