free-game 0.9.3.3 → 0.9.3.4
raw patch · 5 files changed
+16/−28 lines, 5 filesdep +control-booldep ~GLFW-bPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: control-bool
Dependency ranges changed: GLFW-b
API changes (from Hackage documentation)
- Graphics.UI.FreeGame.Util: (<&&>) :: Applicative f => f Bool -> f Bool -> f Bool
- Graphics.UI.FreeGame.Util: (<||>) :: Applicative f => f Bool -> f Bool -> f Bool
- Graphics.UI.FreeGame.Util: notF :: Functor f => f Bool -> f Bool
Files
- Graphics/UI/FreeGame.hs +5/−3
- Graphics/UI/FreeGame/Base.hs +1/−2
- Graphics/UI/FreeGame/Types.hs +1/−1
- Graphics/UI/FreeGame/Util.hs +5/−19
- free-game.cabal +4/−3
Graphics/UI/FreeGame.hs view
@@ -23,6 +23,7 @@ module Graphics.UI.FreeGame.Types, module Control.Monad, module Control.Applicative, + module Control.Bool, module Data.Color, module Data.Color.Names, module Linear @@ -35,13 +36,14 @@ import Graphics.UI.FreeGame.Text import Graphics.UI.FreeGame.Data.Bitmap import Graphics.UI.FreeGame.Data.Font -import Data.Color -import Data.Color.Names import qualified Graphics.UI.FreeGame.GUI.GLFW as GLFW import Control.Monad.Free.Church import Data.Default import Control.Monad import Control.Applicative +import Control.Bool +import Data.Color +import Data.Color.Names import Linear hiding (rotate) -- | 'Game' is a "free" monad which describes GUIs. @@ -51,7 +53,7 @@ -- -- You have to call 'tick' at the end of the current frame. -- --- The only way to embody 'Game' as real thing is to apply 'runGame'. +-- The only way to embody a 'Game' as a real thing is to apply 'runGame'. type Game = F GUI -- | Run a 'Game'.
Graphics/UI/FreeGame/Base.hs view
@@ -12,7 +12,6 @@ -- Stability : experimental -- Portability : non-portable ----- Abstract structures for descripting user interfaces ---------------------------------------------------------------------------- module Graphics.UI.FreeGame.Base (@@ -91,7 +90,7 @@ tick :: MonadFree (UI n) m => m () tick = wrap $ Tick (return ()) --- | Run a Game monad in a Game monad. resources (e.g. pictures) will be released when inner computation is done.+-- | Run a Game monad in a Game monad. Resources (e.g. pictures) will be released when inner computation is done. bracket :: MonadFree (UI n) m => F (UI n) a -> m a bracket = wrap . Bracket . fmap return
Graphics/UI/FreeGame/Types.hs view
@@ -21,7 +21,7 @@ import Linear.V2 --- | 2D bounding box. +-- | 2D bounding box data BoundingBox a = BoundingBox a a a a deriving (Show, Eq, Ord, Functor, Read) -- | Determine whether the given point is in the 'BoundingBox'.
Graphics/UI/FreeGame/Util.hs view
@@ -12,10 +12,6 @@ ---------------------------------------------------------------------------- module Graphics.UI.FreeGame.Util ( - -- * Combinators - notF, - (<&&>), - (<||>), -- * Controlling foreverTick, untick, @@ -33,6 +29,7 @@ loadBitmaps, loadBitmapsWith ) where + import Control.Applicative import Control.Monad import Control.Monad.Free @@ -51,19 +48,7 @@ foreverTick :: MonadFree (UI n) m => m a -> m any foreverTick m = m >> (tick >> foreverTick m) --- | A lifted 'not'. -notF :: Functor f => f Bool -> f Bool -notF = fmap not - --- | A lifted '(&&)'. -(<&&>) :: Applicative f => f Bool -> f Bool -> f Bool -(<&&>) = liftA2 (&&) - --- | A lifted '(||)' -(<||>) :: Applicative f => f Bool -> f Bool -> f Bool -(<||>) = liftA2 (||) - --- | A unit vector with given angle. +-- | An unit vector with given angle. unitV2 :: Floating a => a -> V2 a unitV2 t = V2 (cos t) (sin t) @@ -104,7 +89,7 @@ loadPictureFromFile :: (Picture2D p, MonadFree (UI n) m) => FilePath -> m (p ()) loadPictureFromFile = embedIO . fmap fromBitmap . loadBitmapFromFile --- | Load and define all pictures in the specified directory. +-- | The type of the given 'Name' must be @String -> IO String@ loadBitmapsWith :: Name -> FilePath -> Q [Dec] loadBitmapsWith getFullPath path = do loc <- (</>path) <$> takeDirectory <$> loc_filename <$> location @@ -123,13 +108,14 @@ (varE '(>>=)) (varE 'loadBitmapFromFile) --- | use with getDataFileName +-- | Load and define all pictures in the specified directory. loadBitmaps :: FilePath -> Q [Dec] loadBitmaps = loadBitmapsWith 'canonicalizePath getFileList :: FilePath -> IO [FilePath] getFileList path = do allContents <- filter notHidden `fmap` getDirectoryContents path + files <- filterM (doesFileExist . (path</>)) allContents dirs <- filterM (doesDirectoryExist . (path</>)) allContents fmap ((files++).concat) $ forM dirs $ \i -> map (i</>) `fmap` getFileList (path</>i)
free-game.cabal view
@@ -1,5 +1,5 @@ name: free-game -version: 0.9.3.3 +version: 0.9.3.4 synopsis: Create graphical applications for free description: Cross-platform GUI library based on free monads homepage: https://github.com/fumieval/free-game @@ -45,7 +45,7 @@ free == 3.*, repa, freetype2 >= 0.1, - GLFW-b >= 0.1.0.5, + GLFW-b == 0.1.*, hashable >= 1.2, mtl >= 2.1, OpenGL == 2.8.*, @@ -58,4 +58,5 @@ vector == 0.10.*, JuicyPixels-repa >= 0.5.1, data-default, - colors == 0.1.*+ colors == 0.1.*, + control-bool