packages feed

boomslang 0.0.1 → 0.0.2

raw patch · 5 files changed

+58/−56 lines, 5 files

Files

boomslang.cabal view
@@ -1,5 +1,5 @@ name:        boomslang-version:     0.0.1+version:     0.0.2  category:    Game @@ -43,17 +43,29 @@    main-is: Main.hs -  build-depends:-    GLFW-b                 == 0.*,-    MonadRandom            == 0.*,-    OpenGL                 == 2.4.*,-    base                   == 4.*,-    containers             == 0.*,-    data-accessor          == 0.*,-    data-accessor-template == 0.*,-    font-opengl-basic4x6   == 0.*,-    mtl                    == 1.*,-    template-haskell       == 2.3.*+  if impl(ghc >= 6.12)+    build-depends:+      GLFW-b                 == 0.*,+      MonadRandom            == 0.*,+      OpenGL                 == 2.4.*,+      base                   == 4.*,+      containers             == 0.*,+      data-accessor          == 0.*,+      data-accessor-template == 0.*,+      font-opengl-basic4x6   == 0.*,+      mtl                    == 1.*+  else+    build-depends:+      GLFW-b                 == 0.*,+      MonadRandom            == 0.*,+      OpenGL                 == 2.4.*,+      base                   == 4.*,+      containers             == 0.*,+      data-accessor          == 0.*,+      data-accessor-template == 0.*,+      font-opengl-basic4x6   == 0.*,+      mtl                    == 1.*,+      template-haskell       == 2.3.*    ghc-options: -Wall -O2 -funbox-strict-fields   if impl(ghc >= 6.8)
src/External/Graphics.hs view
@@ -5,7 +5,7 @@  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -import Control.Exception (finally)+import Control.Monad (when)  import Graphics.Rendering.OpenGL (($=)) @@ -14,51 +14,45 @@  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -withGraphics :: IO a -> IO a+withGraphics :: IO () -> IO () withGraphics action =-    (start >> action) `finally` end+    start >>= flip when (action >> end)  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -start :: IO ()+start :: IO Bool start = do-    GLFW.initialize-    GLFW.openWindow GLFW.defaultDisplayOptions-      { GLFW.displayOptions_width             = 600-      , GLFW.displayOptions_height            = 600-      , GLFW.displayOptions_numRedBits        = 5-      , GLFW.displayOptions_numGreenBits      = 5-      , GLFW.displayOptions_numBlueBits       = 5-      , GLFW.displayOptions_numAlphaBits      = 5-      , GLFW.displayOptions_numFsaaSamples    = Just 8-      , GLFW.displayOptions_windowIsResizable = True-      }-    GLFW.setWindowTitle "boomslang"--    GLFW.setWindowSizeCallback $ \w h -> do-        GL.viewport   $= (GL.Position 0 0, GL.Size (fromIntegral w) (fromIntegral h))-        GL.matrixMode $= GL.Projection-        GL.loadIdentity-        GL.ortho2D 0 (realToFrac w) (realToFrac h) 0--    GL.clearColor $= GL.Color4 0.025 0.025 0.025 1+    r0 <- GLFW.initialize+    if not r0+      then return False+      else do+          r1 <- GLFW.openWindow GLFW.defaultDisplayOptions+                  { GLFW.displayOptions_width             = 600+                  , GLFW.displayOptions_height            = 600+                  , GLFW.displayOptions_numRedBits        = 5+                  , GLFW.displayOptions_numGreenBits      = 5+                  , GLFW.displayOptions_numBlueBits       = 5+                  , GLFW.displayOptions_numAlphaBits      = 5+                  , GLFW.displayOptions_numFsaaSamples    = Just 8+                  , GLFW.displayOptions_windowIsResizable = True+                  }+          if not r1+            then return False+            else do+                GLFW.setWindowTitle "boomslang" -    GL.multisample $= GL.Enabled-    GL.blend       $= GL.Enabled-    GL.blendFunc   $= (GL.SrcAlpha, GL.OneMinusSrcAlpha)+                GLFW.setWindowSizeCallback $ \w h -> do+                    GL.viewport   $= (GL.Position 0 0, GL.Size (fromIntegral w) (fromIntegral h))+                    GL.matrixMode $= GL.Projection+                    GL.loadIdentity+                    GL.ortho2D 0 (realToFrac w) (realToFrac h) 0 -    {--    GL.colorMaterial $= Just (GL.Front, GL.AmbientAndDiffuse)-    GL.depthFunc     $= Nothing+                GL.multisample $= GL.Enabled+                GL.blend       $= GL.Enabled+                GL.blendFunc   $= (GL.SrcAlpha, GL.OneMinusSrcAlpha)+                GL.clearColor  $= GL.Color4 0.025 0.025 0.025 1 -    let light0 = GL.Light 0-    GL.light    light0 $= GL.Enabled-    GL.ambient  light0 $= GL.Color4 0.3 0.3 0.3 1-    GL.diffuse  light0 $= GL.Color4 0.6 0.6 0.6 1-    GL.specular light0 $= GL.Color4 0.1 0.1 0.1 1-    GL.position light0 $= GL.Vertex4 0 0 2 1-    GL.lighting        $= GL.Enabled-    -}+                return True  end :: IO () end = do
src/External/Graphics/Rendering.hs view
@@ -4,7 +4,6 @@  import Control.Monad (unless) import Data.Char     (ord)-import Data.Maybe    (maybe) import qualified Data.IntMap as M  import Data.Accessor.Basic ((^.))
src/Game/Logic.hs view
@@ -17,10 +17,7 @@ import Game.Score                  (Score(..)) import Vector                      ((^-^), (^+^), (.*^)) import qualified External.Input.Keyboard      as Keyboard-import qualified External.Input.Keyboard.Keys as Keyboard import qualified External.Input.Mouse         as Mouse-import qualified External.Input.Mouse.Buttons as Mouse-import qualified Game.Activity                as GameActivity import qualified Game.Entity.Dot              as Dot import qualified Game.Entity.Dot.Activity     as DotActivity import qualified Game.Environment             as Environment
src/Main.hs view
@@ -11,5 +11,5 @@ main :: IO () main =     ExternalGraphics.withGraphics $ do-      env <- environment-      runG logic env (State Starting NoScore)+        env <- environment+        runG logic env (State Starting NoScore)