free-game 1.1.81 → 1.1.90
raw patch · 5 files changed
+47/−46 lines, 5 filesdep +StateVardep ~OpenGLdep ~OpenGLRawdep ~mtl
Dependencies added: StateVar
Dependency ranges changed: OpenGL, OpenGLRaw, mtl, reflection
Files
- FreeGame/Instances.hs +15/−15
- FreeGame/Internal/GLFW.hs +2/−2
- FreeGame/Util.hs +1/−1
- examples/demo_stateful.hs +23/−23
- free-game.cabal +6/−5
FreeGame/Instances.hs view
@@ -91,25 +91,25 @@ setBoundingBox b = (l) (setBoundingBox b); \ } -MK_AFFINE(_COMMA_ Functor m, F m, hoistF) -MK_AFFINE(_COMMA_ Functor m, Free.Free m, Free.hoistFree) +MK_AFFINE(, F m, hoistF) +MK_AFFINE(, Free.Free m, Free.hoistFree) MK_AFFINE(_COMMA_ Monad m, IterT m, hoistIterT) -MK_AFFINE(_COMMA_ Monad m, ReaderT r m, mapReaderT) -MK_AFFINE(_COMMA_ Monad m, Lazy.StateT s m, Lazy.mapStateT) -MK_AFFINE(_COMMA_ Monad m, Strict.StateT s m, Strict.mapStateT) -MK_AFFINE(_COMMA_ Monad m _COMMA_ Monoid w, Lazy.WriterT w m, Lazy.mapWriterT) -MK_AFFINE(_COMMA_ Monad m _COMMA_ Monoid w, Strict.WriterT w m, Strict.mapWriterT) -MK_AFFINE(_COMMA_ Monad m _COMMA_ Monoid w, Lazy.RWST r w s m, Lazy.mapRWST) -MK_AFFINE(_COMMA_ Monad m _COMMA_ Monoid w, Strict.RWST r w s m, Strict.mapRWST) -MK_AFFINE(_COMMA_ Monad m, IdentityT m, mapIdentityT) -MK_AFFINE(_COMMA_ Monad m, MaybeT m, mapMaybeT) -MK_AFFINE(_COMMA_ Monad m, ListT m, mapListT) +MK_AFFINE(, ReaderT r m, mapReaderT) +MK_AFFINE(, Lazy.StateT s m, Lazy.mapStateT) +MK_AFFINE(, Strict.StateT s m, Strict.mapStateT) +MK_AFFINE(, Lazy.WriterT w m, Lazy.mapWriterT) +MK_AFFINE(, Strict.WriterT w m, Strict.mapWriterT) +MK_AFFINE(, Lazy.RWST r w s m, Lazy.mapRWST) +MK_AFFINE(, Strict.RWST r w s m, Strict.mapRWST) +MK_AFFINE(, IdentityT m, mapIdentityT) +MK_AFFINE(, MaybeT m, mapMaybeT) +MK_AFFINE(, ListT m, mapListT) #if MIN_VERSION_transformers(0,4,0) -MK_AFFINE(_COMMA_ Monad m, ExceptT e m, mapExceptT) +MK_AFFINE(, ExceptT e m, mapExceptT) #else -MK_AFFINE(_COMMA_ Monad m _COMMA_ Error e, ErrorT e m, mapErrorT) +MK_AFFINE(_COMMA_ Error e, ErrorT e m, mapErrorT) #endif -MK_AFFINE(_COMMA_ Monad m, ContT r m, mapContT) +MK_AFFINE(, ContT r m, mapContT) MK_PICTURE_2D(_COMMA_ Functor m, F m, Church.liftF, hoistF) MK_PICTURE_2D(_COMMA_ Functor m, Free.Free m, Free.liftF, Free.hoistFree)
FreeGame/Internal/GLFW.hs view
@@ -11,8 +11,8 @@ import Data.IORef import FreeGame.Types import Data.BoundingBox -import Graphics.Rendering.OpenGL.GL.StateVar -import Graphics.Rendering.OpenGL.Raw.ARB.Compatibility +import Data.StateVar +import Graphics.GL.Compatibility30 import Linear import qualified Graphics.Rendering.OpenGL.GL as GL import qualified Graphics.UI.GLFW as GLFW
FreeGame/Util.hs view
@@ -189,4 +189,4 @@ {-# DEPRECATED keySpecial "use keyPress instead" #-} keySpecial :: Keyboard f => Key -> f Bool -keySpecial = keyPress+keySpecial = keyPress
examples/demo_stateful.hs view
@@ -1,23 +1,23 @@-import FreeGame--data StateData = StateData { _counter :: Int- , _font :: Font- }- -loop :: StateData -> Game ()-loop state = do- let fnt = _font state- cnt = 1 + _counter state- state' = state{_counter = cnt}-- translate (V2 100 240) . color green . text fnt 15 $ show cnt- translate (V2 340 240) . rotateD (fromIntegral cnt) . color red $ text fnt 70 "Test"-- key <- keyPress KeyEscape- unless key $ tick >> loop state'--main = runGame Windowed (Box (V2 0 0) (V2 640 480)) $ do- font <- loadFont "VL-PGothic-Regular.ttf"- clearColor black- let state = StateData{_counter=0, _font=font}- loop state+import FreeGame + +data StateData = StateData { _counter :: Int + , _font :: Font + } + +loop :: StateData -> Game () +loop state = do + let fnt = _font state + cnt = 1 + _counter state + state' = state{_counter = cnt} + + translate (V2 100 240) . color green . text fnt 15 $ show cnt + translate (V2 340 240) . rotateD (fromIntegral cnt) . color red $ text fnt 70 "Test" + + key <- keyPress KeyEscape + unless key $ tick >> loop state' + +main = runGame Windowed (Box (V2 0 0) (V2 640 480)) $ do + font <- loadFont "VL-PGothic-Regular.ttf" + clearColor black + let state = StateData{_counter=0, _font=font} + loop state
free-game.cabal view
@@ -1,5 +1,5 @@ name: free-game -version: 1.1.81 +version: 1.1.90 synopsis: Create games for free description: free-game defines a monad that integrates features to create 2D games. @@ -62,11 +62,12 @@ JuicyPixels, JuicyPixels-util >=0.1.1 && < 0.3, linear >= 1.0 && < 2, - mtl >= 2.2 && <3, - OpenGL >= 2.9 && <3, - OpenGLRaw >= 1.3 && < 1.6, + mtl >= 2.2 && <4, + OpenGL >= 3 && <4, + OpenGLRaw, random == 1.*, - reflection == 1.*, + reflection, + StateVar, template-haskell, transformers >= 0.3, vector >= 0.9 && <0.12,