packages feed

free-game 0.3.0.1 → 0.3.0.2

raw patch · 7 files changed

+46/−32 lines, 7 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Graphics.FreeGame.Input: KeyF13 :: Key
- Graphics.FreeGame.Input: KeyF14 :: Key
- Graphics.FreeGame.Input: KeyF15 :: Key

Files

Graphics/FreeGame.hs view
@@ -35,7 +35,11 @@ import Graphics.FreeGame.Bitmap
 import Graphics.FreeGame.Input
 import Graphics.FreeGame.Util
-import Graphics.FreeGame.Backends.GLFW
+import qualified Graphics.FreeGame.Backends.GLFW as GLFW
+
+-- | Run a 'Game' computation.
+runGame :: GameParam -> Game a -> IO (Maybe a)
+runGame = GLFW.runGame
 
 {- $example
 
Graphics/FreeGame/Backends/GLFW.hs view
@@ -153,9 +153,6 @@         I.KeyF10 -> KeyF10
         I.KeyF11 -> KeyF11
         I.KeyF12 -> KeyF12
-        I.KeyF13 -> KeyF13
-        I.KeyF14 -> KeyF14
-        I.KeyF15 -> KeyF15
         I.KeyEsc -> KeyEsc
         I.KeyUp -> KeyUp
         I.KeyDown -> KeyDown
Graphics/FreeGame/Base.hs view
@@ -6,30 +6,39 @@ -- License     :  BSD-style (see the file LICENSE)
 --
 -- Maintainer  :  Fumiaki Kinsohita <fumiexcel@gmail.com>
--- Stability   :  provisional
+-- Stability   :  experimental
 -- Portability :  non-portable
 --
 -- Abstract structures that represents user interfaces
 ----------------------------------------------------------------------------
 
 module Graphics.FreeGame.Base (
+    -- * Types
     Game
     ,GameAction(..)
-    ,GameParam(..)
+
+    -- * Basic operations
+    ,tick
+    ,embedIO
+    ,bracket
+
+    -- * Pictures
     ,Picture(..)
     ,transPicture
-    ,defaultGameParam
-    ,tick
     ,drawPicture
     ,loadPicture
+    
+    -- * Inputs
     ,askInput
     ,getMouseState
-    ,embedIO
-    ,bracket
+
+    -- * Settings
+    ,GameParam(..)
+    ,defaultGameParam
+
 ) where
 
 import Control.Monad.Free
-import Control.Monad.Trans.Free (FreeT)
 import Control.Monad
 import Graphics.FreeGame.Bitmap
 import Graphics.FreeGame.Input
Graphics/FreeGame/Bitmap.hs view
@@ -20,7 +20,7 @@ import Data.Array.IArray as A
 import qualified Graphics.Rendering.TrueType.STB as TT
 
--- | Concrete bitmap data type
+-- | Concrete bitmap data
 newtype Bitmap = Bitmap {
     bitmapData :: R.Array D DIM3 Word8 -- ^ Bare the 'Bitmap''s internal representation (y * x * ARGB)
     }
@@ -43,7 +43,7 @@ -- | Font object
 newtype Font = Font TT.BitmapCache
 
--- | create a 'Font' from the given file.
+-- | Create a 'Font' from the given file.
 loadFont :: FilePath -> Float -> IO Font
 loadFont path size = do
     tt <- TT.loadTTF path
@@ -54,7 +54,7 @@     let s = size/fromIntegral (x1-x0)
     Font <$> TT.newBitmapCache font False (s, s)
 
--- | render 'Bitmap' of the character by specified 'Font' and color(RGB).
+-- | Render 'Bitmap' of the character by specified 'Font' and color(RGB).
 charToBitmap :: Font -> (Word8, Word8, Word8) -> Char -> IO (Maybe (Bitmap, Float, Float, Float))
 charToBitmap (Font cache) (red,green,blue) ch = do
     r <- TT.getCachedBitmap cache ch
Graphics/FreeGame/Input.hs view
@@ -2,12 +2,13 @@ 
 import Data.Vect
 
-data MouseState = MouseState { mousePosition :: Vec2
-        , leftButton :: Bool
-        , middleButton :: Bool
-        , rightButton :: Bool
-        , mouseWheel :: Int
-        } deriving Show
+data MouseState = MouseState
+    { mousePosition :: Vec2
+    , leftButton :: Bool
+    , middleButton :: Bool
+    , rightButton :: Bool
+    , mouseWheel :: Int
+    } deriving Show
 
 data Key
         = KeyChar Char
@@ -25,9 +26,6 @@         | KeyF10
         | KeyF11
         | KeyF12
-        | KeyF13
-        | KeyF14
-        | KeyF15
         | KeyLeftShift
         | KeyRightShift
         | KeyLeftControl
Graphics/FreeGame/Util.hs view
@@ -6,8 +6,8 @@ -- License     :  BSD-style (see the file LICENSE)
 --
 -- Maintainer  :  Fumiaki Kinsohita <fumiexcel@gmail.com>
--- Stability   :  provisional
--- Portability :  portable
+-- Stability   :  experimental
+-- Portability :  non-portable
 --
 ----------------------------------------------------------------------------
 
@@ -42,7 +42,7 @@ {-# INLINE radians #-}
 radians x = x / 180 * pi
 
--- | Render the string by given font and color, and pass it to the 'Game' computation. 
+-- | Render the string by the given font and color, and pass it to the 'Game' computation. 
 withRenderString :: Font -> (Word8, Word8, Word8) -> String -> (Picture -> Game a) -> Game a
 withRenderString font color str action = bracket $ render str 0 >>= action . Pictures
     where
@@ -52,6 +52,6 @@             (:) <$> Translate (Vec2 (x + w + o) h) <$> loadPicture b
                 <*> render cs (x + w)
 
--- | Create a 'Picture' from given file path.
+-- | Create a 'Picture' from the given file.
 loadPictureFromFile :: FilePath -> Game Picture
 loadPictureFromFile = embedIO . loadBitmapFromFile >=> loadPicture
free-game.cabal view
@@ -1,20 +1,26 @@ name:                free-game
-version:             0.3.0.1
+version:             0.3.0.2
 synopsis:            Create graphical applications for free.
-description:         closs-platform GUI library based on free monads.
+description:         Cross-platform GUI library based on free monads.
 homepage:            https://github.com/fumieval/free-game
+bug-reports:         https://github.com/fumieval/free-game/issues
 license:             BSD3
 license-file:        LICENSE
 author:              Fumiaki Kinoshita
-maintainer:          fumiexcel@gmail.com
-copyright:           Copyright (C) 2012 Fumiaki Kinoshita
+maintainer:          Fumiaki Kinoshita <fumiexcel@gmail.com>
+copyright:           Copyright (C) 2012-2013 Fumiaki Kinoshita
 category:            Graphics
 build-type:          Simple
+stability:           experimental
 cabal-version:       >=1.8
 extra-source-files:
   examples/test.hs
   examples/logo.png
-  
+
+source-repository head
+  type: git
+  location: git@github.com:fumieval/free-game.git
+
 library
   exposed-modules:     Graphics.FreeGame
     , Graphics.FreeGame.Util