FunGEn-0.4: FUNctional Game ENgine

Safe HaskellNone

Graphics.UI.Fungen.Game

Description

This FunGEn module contains some important game routines.

Synopsis

Documentation

data Game t s u v Source

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

data IOGame t s u v a Source

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).

Instances

Monad (IOGame t s u v) 

runIOGame :: IOGame t s u v a -> Game t s u v -> IO (Game t s u v, a)Source

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

setGameState :: u -> IOGame t s u v ()Source

getGameFlags :: IOGame t s u v GameFlagsSource

setGameFlags :: GameFlags -> IOGame t s u v ()Source

setGameAttribute :: t -> IOGame t s u v ()Source

createGame :: GameMap v -> [ObjectManager s] -> WindowConfig -> u -> t -> FilePictureList -> IO (Game t s u v)Source

funExit :: IOGame t s u v ()Source

drawMap :: IOGame t s u v ()Source

printOnPrompt :: Show a => a -> IOGame t s u v ()Source

printText :: IOGame t s u v ()Source

randomInt :: (Int, Int) -> IOGame t s u v IntSource

wait :: Int -> IOGame t s u v ()Source