aboutsummaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-12-30 12:01:06 -0800
committer3gg <3gg@shellblade.net>2024-12-30 12:01:06 -0800
commitd30b146ce320a48d58d37a8f191daa4ef29fbc67 (patch)
treeea08d824404e513ca0efce21ca53b0d55dddb8cf /Demos
parent9d4964f8fb607e8e6274a670c83130fc569729a6 (diff)
Spacing.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Pong/Main.hs6
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
29app = App defaultAppOptions step render resize 30app = App defaultAppOptions step render resize
30 31
32
31main = 33main =
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
35initGame :: Window -> Game () GameState 38initGame :: Window -> Game () GameState
36initGame window = do 39initGame 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
45step :: Elapsed -> Dt -> [InputEvent] -> Game GameState Bool 49step :: Elapsed -> Dt -> [InputEvent] -> Game GameState Bool
46step elapsed dt inputEvents = do 50step elapsed dt inputEvents = do
47 gs <- getGameState 51 gs <- getGameState
@@ -61,6 +65,7 @@ processInput window = processKeys window
61 65
62exitRequested = elem (KeyDown KEY_ESC) 66exitRequested = elem (KeyDown KEY_ESC)
63 67
68
64render :: Game GameState () 69render :: Game GameState ()
65render = do 70render = 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
111resize :: WindowEvent -> Game GameState () 117resize :: WindowEvent -> Game GameState ()
112resize (ResizeEvent w h) = 118resize (ResizeEvent w h) =
113 let r = fromIntegral w / fromIntegral h 119 let r = fromIntegral w / fromIntegral h