From b2b0e12c212a40ef2469f77043573b5569ff9e6d Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Fri, 10 Mar 2023 09:30:47 -0800 Subject: Minor refactoring and formatting. --- Demos/Pong/Main.hs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'Demos/Pong/Main.hs') diff --git a/Demos/Pong/Main.hs b/Demos/Pong/Main.hs index 4dbe0a3..ee0f8d8 100644 --- a/Demos/Pong/Main.hs +++ b/Demos/Pong/Main.hs @@ -2,20 +2,20 @@ module Main where -import Data.Maybe (mapMaybe) -import Graphics.Rendering.OpenGL.GL (($=)) -import Graphics.Rendering.OpenGL.GL qualified as GL -import Pong -import Spear.App -import Spear.Game -import Spear.Math.AABB -import Spear.Math.Spatial2 -import Spear.Math.Vector -import Spear.Window +import Data.Maybe (mapMaybe) +import Graphics.Rendering.OpenGL.GL (($=)) +import qualified Graphics.Rendering.OpenGL.GL as GL +import Pong +import Spear.App +import Spear.Game +import Spear.Math.AABB +import Spear.Math.Spatial2 +import Spear.Math.Vector +import Spear.Window data GameState = GameState { window :: Window, - world :: [GameObject] + world :: [GameObject] } main = @@ -53,7 +53,7 @@ renderGO go = do (xmin, ymin, xmax, ymax) = (f2d xmin', f2d ymin', f2d xmax', f2d ymax') GL.preservingMatrix $ do GL.translate (GL.Vector3 (f2d xcenter) (f2d ycenter) 0) - GL.renderPrimitive (GL.TriangleStrip) $ do + GL.renderPrimitive GL.TriangleStrip $ do GL.vertex (GL.Vertex2 xmin ymax) GL.vertex (GL.Vertex2 xmin ymin) GL.vertex (GL.Vertex2 xmax ymax) @@ -71,13 +71,13 @@ procEvent _ = return () translate = mapMaybe translate' -translate' (KeyDown KEY_LEFT) = Just MoveLeft +translate' (KeyDown KEY_LEFT) = Just MoveLeft translate' (KeyDown KEY_RIGHT) = Just MoveRight -translate' (KeyUp KEY_LEFT) = Just StopLeft -translate' (KeyUp KEY_RIGHT) = Just StopRight -translate' _ = Nothing +translate' (KeyUp KEY_LEFT) = Just StopLeft +translate' (KeyUp KEY_RIGHT) = Just StopRight +translate' _ = Nothing -exitRequested = any (== (KeyDown KEY_ESC)) +exitRequested = elem (KeyDown KEY_ESC) f2d :: Float -> GL.GLdouble f2d = realToFrac -- cgit v1.2.3