Portability | non-portable |
---|---|
Stability | provisional |
Maintainer | Fumiaki Kinsohita <fumiexcel@gmail.com> |
Safe Haskell | None |
The essentials of using free-game
- type Game = Free GameAction
- data GameAction a
- data GameParam = GameParam {
- framePerSecond :: Int
- windowSize :: (Int, Int)
- windowTitle :: String
- windowed :: Bool
- cursorVisible :: Bool
- clearColor :: Color
- windowOrigin :: Vec2
- defaultGameParam :: GameParam
- runSimple :: GameParam -> world -> (world -> Game world) -> IO ()
- runSimple' :: GameParam -> world -> (world -> forall m. MonadFree GameAction m => m world) -> IO ()
- drawPicture :: MonadFree GameAction m => Picture -> m ()
- getButtonState :: MonadFree GameAction m => Button -> m Bool
- getMousePosition :: MonadFree GameAction m => m Vec2
- getMouseWheel :: MonadFree GameAction m => m Int
- embedIO :: MonadFree GameAction m => IO a -> m a
- quitGame :: MonadFree GameAction m => m Void
- tick :: MonadFree GameAction m => m ()
- untickGame :: Free GameAction a -> Free GameAction (Free GameAction a)
- data Picture
- data Bitmap
- loadBitmapFromFile :: FilePath -> IO Bitmap
- loadBitmaps :: FilePath -> Q [Dec]
- data Vec2 = Vec2 !Float !Float
- data Font
- loadFont :: FilePath -> IO Font
- text :: Font -> Float -> String -> Picture
- randomness :: (Random r, MonadFree GameAction m) => (r, r) -> m r
- degrees :: Float -> Float
- askInput :: MonadFree GameAction m => Button -> m Bool
- getMouseState :: MonadFree GameAction m => m MouseState
- module Graphics.FreeGame.Input
- module Graphics.FreeGame.Data.Color
Basic type
Run the game
Parameters of the application.
GameParam | |
|
defaultGameParam :: GameParamSource
640*480(windowed), 60fps
:: GameParam | |
-> world | An initial world |
-> (world -> Game world) | A computation yielding new world |
-> IO () |
Run a Game
by the given initial state and updating function.
:: GameParam | |
-> world | An initial world |
-> (world -> forall m. MonadFree GameAction m => m world) | A computation yielding new world |
-> IO () |
Run more efficiently.
In the Game monad
drawPicture :: MonadFree GameAction m => Picture -> m ()Source
Draw a Picture
.
getButtonState :: MonadFree GameAction m => Button -> m BoolSource
Is the specified Button
is pressed?
getMousePosition :: MonadFree GameAction m => m Vec2Source
getMouseWheel :: MonadFree GameAction m => m IntSource
quitGame :: MonadFree GameAction m => m VoidSource
Break the current computation.
tick :: MonadFree GameAction m => m ()Source
Finalize the current frame and refresh the screen.
untickGame :: Free GameAction a -> Free GameAction (Free GameAction a)Source
Run a Game
as one frame.
About Picture
A 2D Picture.
Bitmap Bitmap | |
BitmapPicture Bitmap | Deprecated: use Bitmap instead Deprecated synonym for |
Pictures [Picture] | A picture consist of some |
PictureWithFinalizer (FinalizerT IO Picture) | A picture that may have side effects(for internal use). |
Rotate Float Picture | Rotated picture by the given angle (in degrees, counterclockwise). |
Scale Vec2 Picture | Scaled picture. |
Translate Vec2 Picture | A picture translated by the given coordinate. |
Colored Color Picture | Colored picture. |
loadBitmaps :: FilePath -> Q [Dec]Source
Load and define all pictures in the specified directory.
data Vec2
Drawing texts
Utilities
randomness :: (Random r, MonadFree GameAction m) => (r, r) -> m rSource
Get a given range of value.
Deprecated
askInput :: MonadFree GameAction m => Button -> m BoolSource
Deprecated: use getButtonState instead.
Deprecated synonym for getButtonState
.
getMouseState :: MonadFree GameAction m => m MouseStateSource
Deprecated: use getMousePosition and getMouseWheel instead.
Yields the mouse's state.
Reexports
module Graphics.FreeGame.Input
module Graphics.FreeGame.Data.Color