forked from fumieval/free-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFreeGame.hs
131 lines (125 loc) · 2.88 KB
/
FreeGame.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{-# OPTIONS_GHC -fno-warn-orphans #-}
-----------------------------------------------------------------------------
-- |
-- Module : FreeGame
-- Copyright : (C) 2013 Fumiaki Kinoshita
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Fumiaki Kinoshita <[email protected]>
-- Stability : provisional
-- Portability : non-portable
----------------------------------------------------------------------------
module FreeGame
( -- * Game
Game,
runGame,
runGameDefault,
reGame,
WindowMode(..),
BoundingBox2,
Box(..),
isInside,
delay,
tick,
foreverFrame,
untick,
untickInfinite,
-- * Frame
Frame,
reFrame,
FreeGame(..),
-- * Transformations
Vec2,
Affine(..),
Local(),
globalize,
localize,
-- * Pictures
Drawable,
Picture2D(..),
BlendMode(..),
Bitmap,
bitmapSize,
readBitmap,
cropBitmap,
clipBitmap,
loadBitmaps,
loadBitmapsWith,
writeBitmap,
-- * Text
Font,
loadFont,
text,
-- * Keyboard
Keyboard(..),
Key(..),
charToKey,
keyPress,
keyUp,
keyDown,
-- * Mouse
Mouse(),
mouseScroll,
mouseInWindow,
mousePositionMay,
mousePosition,
mouseButtonL,
mouseButtonR,
mouseButtonM,
mouseDownL,
mouseDownR,
mouseDownM,
mouseUpL,
mouseUpR,
mouseUpM,
-- * IO
FromFinalizer(),
embedIO,
liftIO,
randomness,
-- * Utility functions
unitV2,
angleV2,
degrees,
radians,
-- * Reexports
module Control.Monad,
module Control.Applicative,
module Control.Bool,
module Data.Color,
module Data.Color.Names,
module Linear,
-- * Deprecated
keyChar,
keySpecial
) where
import FreeGame.UI
import FreeGame.Util
import FreeGame.Types
import FreeGame.Text
import FreeGame.Class
import FreeGame.Instances ()
import FreeGame.Data.Bitmap
import FreeGame.Data.Font
import qualified FreeGame.Backend.GLFW as GLFW
import Control.Monad.IO.Class
import Control.Monad
import Control.Applicative
import Control.Bool
import Data.Color
import Data.Color.Names
import Linear
import Data.BoundingBox
import Control.Monad.Trans.Iter
-- | 'Game' is a kind of procedure but you can also use it like a value.
-- free-game's design is based on free structures, however, you don't have to mind it -- Just apply 'runGame', and enjoy.
--
-- <<http://shared.botis.org/free-game.png>>
--
-- For more examples, see <https://github.com/fumieval/free-game/tree/master/examples>.
runGame :: WindowMode -> BoundingBox2 -> Game a -> IO (Maybe a)
runGame = GLFW.runGame
runGameDefault :: Game a -> IO (Maybe a)
runGameDefault = runGame Windowed (Box (V2 0 0) (V2 640 480))
instance MonadIO Frame where
liftIO = embedIO