Safe Haskell | None |
---|
This FunGEn module contains some important game routines.
- data Game t s u v
- data IOGame t s u v a
- runIOGame :: IOGame t s u v a -> Game t s u v -> IO (Game t s u v, a)
- runIOGameM :: IOGame t s u v a -> Game t s u v -> IO ()
- liftIOtoIOGame :: IO a -> IOGame t s u v a
- liftIOtoIOGame' :: (a -> IO ()) -> a -> IOGame t s u v ()
- getGameState :: IOGame t s u v u
- setGameState :: u -> IOGame t s u v ()
- getGameFlags :: IOGame t s u v GameFlags
- setGameFlags :: GameFlags -> IOGame t s u v ()
- enableGameFlags :: IOGame t s u v ()
- disableGameFlags :: IOGame t s u v ()
- enableMapDrawing :: IOGame t s u v ()
- disableMapDrawing :: IOGame t s u v ()
- enableObjectsDrawing :: IOGame t s u v ()
- disableObjectsDrawing :: IOGame t s u v ()
- enableObjectsMoving :: IOGame t s u v ()
- disableObjectsMoving :: IOGame t s u v ()
- getObjectManagers :: IOGame t s u v [ObjectManager s]
- setObjectManagers :: [ObjectManager s] -> IOGame t s u v ()
- getGameAttribute :: IOGame t s u v t
- setGameAttribute :: t -> IOGame t s u v ()
- createGame :: GameMap v -> [ObjectManager s] -> WindowConfig -> u -> t -> FilePictureList -> IO (Game t s u v)
- funExit :: IOGame t s u v ()
- drawMap :: IOGame t s u v ()
- clearScreen :: GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- getTileFromIndex :: (Int, Int) -> IOGame t s u v (Tile v)
- getTileFromWindowPosition :: (GLdouble, GLdouble) -> IOGame t s u v (Tile v)
- setCurrentMapIndex :: Int -> IOGame t s u v ()
- drawAllObjects :: IOGame t s u v ()
- drawObject :: GameObject s -> IOGame t s u v ()
- moveAllObjects :: IOGame t s u v ()
- destroyObjects :: [GameObject s] -> IOGame t s u v ()
- destroyObject :: GameObject s -> IOGame t s u v ()
- getObjectsFromGroup :: String -> IOGame t s u v [GameObject s]
- addObjectsToGroup :: [GameObject s] -> String -> IOGame t s u v ()
- addObjectsToNewGroup :: [GameObject s] -> String -> IOGame t s u v ()
- findObjectManager :: String -> IOGame t s u v (ObjectManager s)
- findObject :: String -> String -> IOGame t s u v (GameObject s)
- getObjectName :: GameObject s -> IOGame t s u v String
- getObjectGroupName :: GameObject s -> IOGame t s u v String
- getObjectAsleep :: GameObject s -> IOGame t s u v Bool
- getObjectSize :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- getObjectPosition :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- getObjectSpeed :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- getObjectAttribute :: GameObject s -> IOGame t s u v s
- setObjectPosition :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
- setObjectAsleep :: Bool -> GameObject s -> IOGame t s u v ()
- setObjectSpeed :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
- setObjectCurrentPicture :: Int -> GameObject s -> IOGame t s u v ()
- setObjectAttribute :: s -> GameObject s -> IOGame t s u v ()
- replaceObject :: GameObject s -> (GameObject s -> GameObject s) -> IOGame t s u v ()
- reverseXSpeed :: GameObject s -> IOGame t s u v ()
- reverseYSpeed :: GameObject s -> IOGame t s u v ()
- objectsCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
- objectsFutureCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
- objectListObjectCollision :: [GameObject s] -> GameObject s -> IOGame t s u v Bool
- objectListObjectFutureCollision :: [GameObject s] -> GameObject s -> IOGame t s u v Bool
- objectTopMapCollision :: GameObject s -> IOGame t s u v Bool
- objectBottomMapCollision :: GameObject s -> IOGame t s u v Bool
- objectRightMapCollision :: GameObject s -> IOGame t s u v Bool
- objectLeftMapCollision :: GameObject s -> IOGame t s u v Bool
- pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v Bool
- pointsObjectListCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> [GameObject s] -> IOGame t s u v Bool
- objectTopMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- objectBottomMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- objectRightMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- objectLeftMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- printOnPrompt :: Show a => a -> IOGame t s u v ()
- printOnScreen :: String -> BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- printText :: IOGame t s u v ()
- randomFloat :: (Float, Float) -> IOGame t s u v Float
- randomInt :: (Int, Int) -> IOGame t s u v Int
- randomDouble :: (Double, Double) -> IOGame t s u v Double
- showFPS :: BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- wait :: Int -> IOGame t s u v ()
Documentation
A game has the type Game t s u v
, where
- t is the type of the game special attributes
- s is the type of the object special attributes
- u is the type of the game levels (state)
- v is the type of the map tile special attribute, in case we use a Tile Map as the background of our game
For a mnemonic, uh...
- t - Top-level game attribute type,
- s - Sprite object attribute type,
- u - Updating game state type,
- v - Vicinity (map tile) attribute type.
A Game consists of the following attributes, accessible via the accessor functions below:
gameMap :: IORef (GameMap v) -- a map (background)
gameState :: IORef u -- initial game state
gameFlags :: IORef GameFlags -- initial game flags
objManagers :: IORef [(ObjectManager s)] -- some object managers
textList :: IORef [Text] -- some texts
quadricObj :: QuadricPrimitive -- a quadric thing
windowConfig :: IORef WindowConfig -- a config for the main window
gameAttribute :: IORef t -- a game attribute
pictureList :: IORef [TextureObject] -- some pictures
fpsInfo :: IORef (Int,Int,Float) -- only for debugging
A game action (IOGame) has the type IOGame t s u v a
, where t, s, u and v
are as for Game and a is the type returned by each action of the game
(such as the Int for IO Int). The name IOGame was chosen to remind
that each action deals with a Game, but an IO operation can also be
performed between game actions (such as the reading of a file or
printing something in the prompt).
runIOGameM :: IOGame t s u v a -> Game t s u v -> IO ()Source
liftIOtoIOGame :: IO a -> IOGame t s u v aSource
liftIOtoIOGame' :: (a -> IO ()) -> a -> IOGame t s u v ()Source
getGameState :: IOGame t s u v uSource
setGameState :: u -> IOGame t s u v ()Source
getGameFlags :: IOGame t s u v GameFlagsSource
setGameFlags :: GameFlags -> IOGame t s u v ()Source
enableGameFlags :: IOGame t s u v ()Source
disableGameFlags :: IOGame t s u v ()Source
enableMapDrawing :: IOGame t s u v ()Source
disableMapDrawing :: IOGame t s u v ()Source
enableObjectsDrawing :: IOGame t s u v ()Source
disableObjectsDrawing :: IOGame t s u v ()Source
enableObjectsMoving :: IOGame t s u v ()Source
disableObjectsMoving :: IOGame t s u v ()Source
getObjectManagers :: IOGame t s u v [ObjectManager s]Source
setObjectManagers :: [ObjectManager s] -> IOGame t s u v ()Source
getGameAttribute :: IOGame t s u v tSource
setGameAttribute :: t -> IOGame t s u v ()Source
createGame :: GameMap v -> [ObjectManager s] -> WindowConfig -> u -> t -> FilePictureList -> IO (Game t s u v)Source
setCurrentMapIndex :: Int -> IOGame t s u v ()Source
drawAllObjects :: IOGame t s u v ()Source
drawObject :: GameObject s -> IOGame t s u v ()Source
moveAllObjects :: IOGame t s u v ()Source
destroyObjects :: [GameObject s] -> IOGame t s u v ()Source
destroyObject :: GameObject s -> IOGame t s u v ()Source
getObjectsFromGroup :: String -> IOGame t s u v [GameObject s]Source
addObjectsToGroup :: [GameObject s] -> String -> IOGame t s u v ()Source
addObjectsToNewGroup :: [GameObject s] -> String -> IOGame t s u v ()Source
findObjectManager :: String -> IOGame t s u v (ObjectManager s)Source
findObject :: String -> String -> IOGame t s u v (GameObject s)Source
getObjectName :: GameObject s -> IOGame t s u v StringSource
getObjectGroupName :: GameObject s -> IOGame t s u v StringSource
getObjectAsleep :: GameObject s -> IOGame t s u v BoolSource
getObjectSize :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)Source
getObjectPosition :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)Source
getObjectSpeed :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)Source
getObjectAttribute :: GameObject s -> IOGame t s u v sSource
setObjectPosition :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()Source
setObjectAsleep :: Bool -> GameObject s -> IOGame t s u v ()Source
setObjectSpeed :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()Source
setObjectCurrentPicture :: Int -> GameObject s -> IOGame t s u v ()Source
setObjectAttribute :: s -> GameObject s -> IOGame t s u v ()Source
replaceObject :: GameObject s -> (GameObject s -> GameObject s) -> IOGame t s u v ()Source
reverseXSpeed :: GameObject s -> IOGame t s u v ()Source
reverseYSpeed :: GameObject s -> IOGame t s u v ()Source
objectsCollision :: GameObject s -> GameObject s -> IOGame t s u v BoolSource
objectsFutureCollision :: GameObject s -> GameObject s -> IOGame t s u v BoolSource
objectListObjectCollision :: [GameObject s] -> GameObject s -> IOGame t s u v BoolSource
objectListObjectFutureCollision :: [GameObject s] -> GameObject s -> IOGame t s u v BoolSource
objectTopMapCollision :: GameObject s -> IOGame t s u v BoolSource
objectBottomMapCollision :: GameObject s -> IOGame t s u v BoolSource
objectRightMapCollision :: GameObject s -> IOGame t s u v BoolSource
objectLeftMapCollision :: GameObject s -> IOGame t s u v BoolSource
pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v BoolSource
pointsObjectListCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> [GameObject s] -> IOGame t s u v BoolSource
objectTopMapFutureCollision :: GameObject s -> IOGame t s u v BoolSource
objectBottomMapFutureCollision :: GameObject s -> IOGame t s u v BoolSource
objectRightMapFutureCollision :: GameObject s -> IOGame t s u v BoolSource
objectLeftMapFutureCollision :: GameObject s -> IOGame t s u v BoolSource
printOnPrompt :: Show a => a -> IOGame t s u v ()Source
printOnScreen :: String -> BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()Source