diff options
author | 3gg <3gg@shellblade.net> | 2024-08-20 18:53:46 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2024-08-20 18:53:46 -0700 |
commit | fd8d1268d2f347bb56400ac3f16f48dc7c22d1b0 (patch) | |
tree | 0356620a6afc6bb1bdfdf011f741f940f3936ff6 /Demos/Pong/Pong.hs | |
parent | c6afd90485fe19e6b5b3f78df173aae819e2624b (diff) |
Tidy.
Diffstat (limited to 'Demos/Pong/Pong.hs')
-rw-r--r-- | Demos/Pong/Pong.hs | 17 |
1 files changed, 9 insertions, 8 deletions
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 | |||
77 | transform = basis | 77 | transform = basis |
78 | 78 | ||
79 | 79 | ||
80 | stepWorld :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> [GameObject] | ||
81 | stepWorld elapsed dt evts gos = map (update elapsed dt evts gos) gos | ||
82 | |||
83 | update :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> GameObject -> GameObject | ||
84 | update elapsed dt evts gos go = | ||
85 | let (go', s') = runStep (gostep go) elapsed dt gos evts go | ||
86 | in go' {gostep = s'} | ||
87 | |||
88 | ballBox, padBox :: AABB2 | 80 | ballBox, padBox :: AABB2 |
89 | ballBox = AABB2 (vec2 (-s) (-s)) (vec2 s s) where s = ballSize | 81 | ballBox = AABB2 (vec2 (-s) (-s)) (vec2 s s) where s = ballSize |
90 | padBox = AABB2 (-padSize) padSize | 82 | padBox = AABB2 (-padSize) padSize |
@@ -96,6 +88,15 @@ newWorld = | |||
96 | ] | 88 | ] |
97 | where makeAt = newTransform2 unitx2 unity2 | 89 | where makeAt = newTransform2 unitx2 unity2 |
98 | 90 | ||
91 | |||
92 | stepWorld :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> [GameObject] | ||
93 | stepWorld elapsed dt evts gos = map (update elapsed dt evts gos) gos | ||
94 | |||
95 | update :: Elapsed -> Dt -> [GameEvent] -> [GameObject] -> GameObject -> GameObject | ||
96 | update elapsed dt evts gos go = | ||
97 | let (go', s') = runStep (gostep go) elapsed dt gos evts go | ||
98 | in go' {gostep = s'} | ||
99 | |||
99 | -- Ball steppers | 100 | -- Ball steppers |
100 | 101 | ||
101 | stepBall vel = collideBall vel .> moveBall | 102 | stepBall vel = collideBall vel .> moveBall |