packages feed

Gamgine 0.2 → 0.3

raw patch · 4 files changed

+28/−17 lines, 4 filesdep ~GLFW-bdep ~OpenGLRawdep ~array

Dependency ranges changed: GLFW-b, OpenGLRaw, array

Files

Gamgine.cabal view
@@ -1,5 +1,5 @@ name: Gamgine-version: 0.2+version: 0.3 cabal-version: >=1.6 build-type: Simple license: BSD3@@ -24,15 +24,15 @@ library     build-depends:         base >3 && <5,-        GLFW-b >=0.1.0.5 && <0.2,-        OpenGLRaw >=1.4.0.0 && <1.5,+        GLFW-b >=1.0 && <1.5,+        OpenGLRaw >=1.4.0.0 && <1.6,         mtl >=2.1.3.1 && <2.2,         time >=1.4.0.1 && <1.5,         Vec >=1.0.1 && <1.1,         utility-ht >=0.0.10 && <0.1,         directory >=1.2.0.1 && <1.3,         StateVar >=1.0.0.0 && <1.1,-        array >=0.4.0.1 && <0.5,+        array >=0.4.0.1 && <0.6,         bytestring >=0.10.0.2 && <0.11,         unordered-containers >=0.2.4.0 && <0.3,         data-lens >=2.10.4 && <2.11,
Gamgine/Engine.hs view
@@ -2,13 +2,15 @@ module Gamgine.Engine where import Graphics.UI.GLFW (getTime) import Control.Monad.State (MonadIO, liftIO)+import Control.Applicative ((<$>))+import Data.Maybe (fromMaybe)   mkUpdateLoop :: (MonadIO m) => Int -> Int -> m a -> (Double -> m (Double, Double)) mkUpdateLoop ticksPerSecond maxFrameSkip update = \nextFrame -> loop nextFrame 0    where       loop nextFrame skippedFrames = do-	 time <- liftIO getTime+	 time <- liftIO (fromMaybe nextFrame <$> getTime) 	 if time > nextFrame && skippedFrames < maxFrameSkip 	    then do 	       update
Gamgine/State/InputInfo.hs view
@@ -1,9 +1,9 @@  module Gamgine.State.InputInfo where import qualified Graphics.UI.GLFW as GLFW-import Control.Monad (liftM2) import Gamgine.Control ((?)) import qualified Gamgine.Math.Vect as V+import Control.Applicative ((<$>), (<*>))  data Modifier = Ctrl | Alt | Shift deriving (Eq, Ord) @@ -13,14 +13,17 @@ -- | if the key/mouse button was pressed or released data InputState = Pressed | Released deriving (Eq, Ord) -pressedModifiers :: IO [Modifier]-pressedModifiers = do-   ctrl  <- isCtrlPressed-   shift <- isShiftPressed-   alt   <- isAltPressed-   return $ (ctrl ? [Ctrl] $ []) ++ (shift ? [Shift] $ []) ++ (alt ? [Alt] $ [])-         -isCtrlPressed, isAltPressed, isShiftPressed :: IO Bool-isCtrlPressed  = liftM2 (||) (GLFW.keyIsPressed GLFW.KeyLeftCtrl)  (GLFW.keyIsPressed GLFW.KeyRightCtrl)-isAltPressed   = liftM2 (||) (GLFW.keyIsPressed GLFW.KeyLeftAlt)   (GLFW.keyIsPressed GLFW.KeyRightAlt)-isShiftPressed = liftM2 (||) (GLFW.keyIsPressed GLFW.KeyLeftShift) (GLFW.keyIsPressed GLFW.KeyRightShift)+pressedModifiers :: GLFW.Window -> IO [Modifier]+pressedModifiers win = do+   ctrlPressed  <- isCtrlPressed win+   shiftPressed <- isShiftPressed win+   altPressed   <- isAltPressed win+   return $ [Ctrl | ctrlPressed] ++ [Shift | shiftPressed] ++ [Alt | altPressed]++isCtrlPressed, isAltPressed, isShiftPressed :: GLFW.Window -> IO Bool+isCtrlPressed  win = (||) <$> isKeyPressed win GLFW.Key'LeftControl <*> isKeyPressed win GLFW.Key'RightControl+isAltPressed   win = (||) <$> isKeyPressed win GLFW.Key'LeftAlt     <*> isKeyPressed win GLFW.Key'RightAlt+isShiftPressed win = (||) <$> isKeyPressed win GLFW.Key'LeftShift   <*> isKeyPressed win GLFW.Key'RightShift++isKeyPressed :: GLFW.Window -> GLFW.Key -> IO Bool+isKeyPressed win key = (== GLFW.KeyState'Pressed) <$> GLFW.getKey win key
c_libraries/glf/glf.c view
@@ -22,7 +22,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h>++#ifdef __APPLE__+#include <OpenGL/gl.h>+#else #include <GL/gl.h>+#endif+ #include "glf.h"  /* Defines */