From fd8d1268d2f347bb56400ac3f16f48dc7c22d1b0 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 20 Aug 2024 18:53:46 -0700 Subject: Tidy. --- Demos/Pong/Pong.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Demos/Pong/Pong.hs') diff --git a/Demos/Pong/Pong.hs b/Demos/Pong/Pong.hs index 2bd9df1..e834c5d 100644 --- a/Demos/Pong/Pong.hs +++ b/Demos/Pong/Pong.hs @@ -77,14 +77,6 @@ instance Spatial GameObject Vector2 Angle Transform2 where transform = basis -stepWorld :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> [GameObject] -stepWorld elapsed dt evts gos = map (update elapsed dt evts gos) gos - -update :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> GameObject -> GameObject -update elapsed dt evts gos go = - let (go', s') = runStep (gostep go) elapsed dt gos evts go - in go' {gostep = s'} - ballBox, padBox :: AABB2 ballBox = AABB2 (vec2 (-s) (-s)) (vec2 s s) where s = ballSize padBox = AABB2 (-padSize) padSize @@ -96,6 +88,15 @@ newWorld = ] where makeAt = newTransform2 unitx2 unity2 + +stepWorld :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> [GameObject] +stepWorld elapsed dt evts gos = map (update elapsed dt evts gos) gos + +update :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> GameObject -> GameObject +update elapsed dt evts gos go = + let (go', s') = runStep (gostep go) elapsed dt gos evts go + in go' {gostep = s'} + -- Ball steppers stepBall vel = collideBall vel .> moveBall -- cgit v1.2.3