Haskell/Yampa (= Arrows) (HOOD を使用) を使用して、ゲーム オブジェクトのデバッグ出力を生成することに行き詰まっています。
私のエンジンは基本的に、レンダリングされる出力状態 (線、円) を生成するゲーム オブジェクトのリストを実行します。
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
プレイヤー オブジェクトは右に移動し、(配置された) 円として表されます。
playerObject :: SF () Output -- SF is an Arrow run by time
p <- mover (Point2 0 0) -< (Vector2 10 0)
returnA -< (Circle p 2.0)
mover は単純なインテグレータ (加速度 -> 速度 -> 位置) であり、速度を観察し、デバッグ出力として (位置付けされていない) ラインとしてレンダリングします。
mover :: Position2 -> SF Vector2 Position2
mover position0 = proc acceleration -> do
velocity <- integral -< acceleration -- !! I want to observe velocity
position <- (position0 .+^) ^<< integral -< velocity
returnA -< position
ゲーム オブジェクト関数の内部値の追加のグラフィカル デバッグ出力を作成するにはどうすればよいですか?
最初に実際のオブジェクト (円) をレンダリングしますが、追加のデバッグ出力 (移動ベクトルを線として) もレンダリングします。おそらく HOOD でこれを達成できますが、まだ Haskell に堪能ではなく、私の場合に HOOD チュートリアルを採用する方法がわかりません。