diff options
author | 3gg <3gg@shellblade.net> | 2024-12-30 12:01:06 -0800 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2024-12-30 12:01:06 -0800 |
commit | d30b146ce320a48d58d37a8f191daa4ef29fbc67 (patch) | |
tree | ea08d824404e513ca0efce21ca53b0d55dddb8cf /Demos | |
parent | 9d4964f8fb607e8e6274a670c83130fc569729a6 (diff) |
Spacing.
Diffstat (limited to 'Demos')
-rw-r--r-- | Demos/Pong/Main.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Demos/Pong/Main.hs b/Demos/Pong/Main.hs index d51a324..66fa223 100644 --- a/Demos/Pong/Main.hs +++ b/Demos/Pong/Main.hs | |||
@@ -26,12 +26,15 @@ data GameState = GameState | |||
26 | , world :: [GameObject] | 26 | , world :: [GameObject] |
27 | } | 27 | } |
28 | 28 | ||
29 | |||
29 | app = App defaultAppOptions step render resize | 30 | app = App defaultAppOptions step render resize |
30 | 31 | ||
32 | |||
31 | main = | 33 | main = |
32 | withWindow (1920, 1200) (Just "Pong") initGame endGame $ | 34 | withWindow (1920, 1200) (Just "Pong") initGame endGame $ |
33 | loop app | 35 | loop app |
34 | 36 | ||
37 | |||
35 | initGame :: Window -> Game () GameState | 38 | initGame :: Window -> Game () GameState |
36 | initGame window = do | 39 | initGame window = do |
37 | (immRenderState, renderCoreState) <- runSiblingGame newImmRenderer newRenderCoreState | 40 | (immRenderState, renderCoreState) <- runSiblingGame newImmRenderer newRenderCoreState |
@@ -42,6 +45,7 @@ endGame = do | |||
42 | game <- getGameState | 45 | game <- getGameState |
43 | runSubGame' (deleteImmRenderer $ immRenderState game) (renderCoreState game) | 46 | runSubGame' (deleteImmRenderer $ immRenderState game) (renderCoreState game) |
44 | 47 | ||
48 | |||
45 | step :: Elapsed -> Dt -> [InputEvent] -> Game GameState Bool | 49 | step :: Elapsed -> Dt -> [InputEvent] -> Game GameState Bool |
46 | step elapsed dt inputEvents = do | 50 | step elapsed dt inputEvents = do |
47 | gs <- getGameState | 51 | gs <- getGameState |
@@ -61,6 +65,7 @@ processInput window = processKeys window | |||
61 | 65 | ||
62 | exitRequested = elem (KeyDown KEY_ESC) | 66 | exitRequested = elem (KeyDown KEY_ESC) |
63 | 67 | ||
68 | |||
64 | render :: Game GameState () | 69 | render :: Game GameState () |
65 | render = do | 70 | render = do |
66 | gameState <- getGameState | 71 | gameState <- getGameState |
@@ -108,6 +113,7 @@ renderGO go = do | |||
108 | ,vec2 xmax ymax | 113 | ,vec2 xmax ymax |
109 | ,vec2 xmin ymax)] | 114 | ,vec2 xmin ymax)] |
110 | 115 | ||
116 | |||
111 | resize :: WindowEvent -> Game GameState () | 117 | resize :: WindowEvent -> Game GameState () |
112 | resize (ResizeEvent w h) = | 118 | resize (ResizeEvent w h) = |
113 | let r = fromIntegral w / fromIntegral h | 119 | let r = fromIntegral w / fromIntegral h |