-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | FUNctional Game ENgine -- -- Multi-platform 2D game engine built on top of OpenGL & GLUT @package FunGEn @version 0.4 -- | GLUT-based keyboard/mouse handling. -- -- Sven Panne 2000 Sven.Panne@informatik.uni-muenchen.de -- -- This provides a still down event in addition to GLUT's -- key/mouse button up/down events, and manages bindings from input -- events to actions. module Graphics.UI.GLUT.Input -- | A generalized view of keys data Key :: * Char :: Char -> Key SpecialKey :: SpecialKey -> Key MouseButton :: MouseButton -> Key data KeyEvent Press :: KeyEvent StillDown :: KeyEvent Release :: KeyEvent type KeyBinder = Key -> KeyEvent -> Maybe InputHandler -> IO () type InputHandler = Modifiers -> Position -> IO () type StillDownHandler = IO () -- | Initialise the input system, which keeps a list of input event to -- action bindings and executes the the proper actions automatically. -- Returns a function for adding bindings, and another which should be -- called periodically (eg from refresh) to trigger still-down actions. initGLUTInput :: IO (KeyBinder, StillDownHandler) instance Eq KeyEvent -- | This FunGEn module contains some functions to print text on the -- screen. Fonts supported: Bitmap9By15, Bitmap8By13, BitmapTimesRoman10, -- BitmapTimesRoman24 BitmapHelvetica10, BitmapHelvetica12, -- BitmapHelvetica18 module Graphics.UI.Fungen.Text type Text = (String, BitmapFont, (GLdouble, GLdouble), GLclampf, GLclampf, GLclampf) -- | The bitmap fonts available in GLUT. The exact bitmap to be used is -- defined by the standard X glyph bitmaps for the X font with the given -- name. data BitmapFont :: * -- | A fixed width font with every character fitting in an 8 by 13 pixel -- rectangle. -- (-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1) Fixed8By13 :: BitmapFont -- | A fixed width font with every character fitting in an 9 by 15 pixel -- rectangle. -- (-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1) Fixed9By15 :: BitmapFont -- | A 10-point proportional spaced Times Roman font. -- (-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1) TimesRoman10 :: BitmapFont -- | A 24-point proportional spaced Times Roman font. -- (-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1) TimesRoman24 :: BitmapFont -- | A 10-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1) Helvetica10 :: BitmapFont -- | A 12-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1) Helvetica12 :: BitmapFont -- | A 18-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1) Helvetica18 :: BitmapFont putGameText :: [Text] -> IO () -- | This FunGEn module controls timing (how time-based functions will -- behave). module Graphics.UI.Fungen.Timer data RefreshType Idle :: RefreshType Timer :: Int -> RefreshType setRefresh :: RefreshType -> StillDownHandler -> IO () -- | This FunGEn module contains the FunGEN basic types. module Graphics.UI.Fungen.Types -- | position, size and name of the window type WindowConfig = ((Int, Int), (Int, Int), String) -- | a bidimensional point in space type Point2D = (GLdouble, GLdouble) -- | color in RGB format type ColorList3 = [(GLubyte, GLubyte, GLubyte)] -- | width, height and data of bitmap type AwbfBitmap = (GLsizei, GLsizei, PixelData GLubyte) -- | invisible colors (in RGB) of bitmap type InvList = Maybe [(Int, Int, Int)] -- | This FunGEn module contains some auxiliary functions. module Graphics.UI.Fungen.Util texCoord2 :: GLdouble -> GLdouble -> IO () vertex3 :: GLdouble -> GLdouble -> GLdouble -> IO () texStuff :: [TextureObject] -> [AwbfBitmap] -> IO () toRad :: Float -> Float randInt :: (Int, Int) -> IO Int randFloat :: (Float, Float) -> IO Float randDouble :: (Double, Double) -> IO Double shiftLeft :: String -> Int -> String toDecimal :: String -> GLsizei pow2 :: GLsizei -> GLsizei toBinary :: Int -> String make0 :: Int -> String dropGLsizei :: GLsizei -> [a] -> [a] ord2 :: Char -> GLubyte addNoInvisibility :: [FilePath] -> [(FilePath, Maybe ColorList3)] racMod :: GLdouble -> GLdouble -> GLdouble matrixToList :: [[a]] -> [a] matrixSize :: [[a]] -> (Int, Int) inv2color3 :: InvList -> Maybe ColorList3 pathAndInv2color3List :: (FilePath, InvList) -> (FilePath, Maybe ColorList3) point2DtoVertex3 :: [Point2D] -> [Vertex3 GLdouble] isEmpty :: [a] -> Bool when :: Monad m => Bool -> m () -> m () unless :: Monad m => Bool -> m () -> m () bindTexture :: TextureTarget -> TextureObject -> IO () -- | This FunGEn module loads [bmp] files. module Graphics.UI.Fungen.Loader loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap loadBitmapList :: [(FilePath, Maybe ColorList3)] -> IO [AwbfBitmap] type FilePictureList = [(FilePath, InvList)] -- | This module contains the FunGEn objects procedures module Graphics.UI.Fungen.Objects data GameObject t getGameObjectId :: GameObject t -> Integer getGameObjectName :: GameObject t -> String getGameObjectManagerName :: GameObject t -> String getGameObjectAsleep :: GameObject t -> Bool getGameObjectPosition :: GameObject t -> (GLdouble, GLdouble) getGameObjectSize :: GameObject t -> (GLdouble, GLdouble) getGameObjectSpeed :: GameObject t -> (GLdouble, GLdouble) getGameObjectAttribute :: GameObject t -> t getObjectManagerName :: ObjectManager t -> String getObjectManagerCounter :: ObjectManager t -> Integer getObjectManagerObjects :: ObjectManager t -> [(GameObject t)] data ObjectPicture Tex :: (GLdouble, GLdouble) -> Int -> ObjectPicture Basic :: Primitive -> ObjectPicture data Primitive Polyg :: [Point2D] -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive Circle :: GLdouble -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive data FillMode Filled :: FillMode Unfilled :: FillMode object :: String -> ObjectPicture -> Bool -> (GLdouble, GLdouble) -> (GLdouble, GLdouble) -> t -> GameObject t drawGameObjects :: [(ObjectManager t)] -> QuadricPrimitive -> [TextureObject] -> IO () drawGameObject :: GameObject t -> QuadricPrimitive -> [TextureObject] -> IO () objectGroup :: String -> [(GameObject t)] -> (ObjectManager t) data ObjectManager t findObjectFromId :: GameObject t -> [(ObjectManager t)] -> GameObject t searchObjectManager :: String -> [(ObjectManager t)] -> ObjectManager t searchGameObject :: String -> ObjectManager t -> GameObject t updateObject :: (GameObject t -> GameObject t) -> Integer -> String -> [(ObjectManager t)] -> [(ObjectManager t)] updateObjectAsleep :: Bool -> GameObject t -> GameObject t updateObjectSize :: (GLdouble, GLdouble) -> GameObject t -> GameObject t updateObjectPosition :: (GLdouble, GLdouble) -> GameObject t -> GameObject t updateObjectSpeed :: (GLdouble, GLdouble) -> GameObject t -> GameObject t updateObjectAttribute :: t -> GameObject t -> GameObject t updateObjectPicture :: Int -> Int -> GameObject t -> GameObject t addObjectsToManager :: [(GameObject t)] -> String -> [(ObjectManager t)] -> [(ObjectManager t)] moveGameObjects :: [(ObjectManager t)] -> [(ObjectManager t)] destroyGameObject :: String -> String -> [(ObjectManager t)] -> [(ObjectManager t)] instance Eq FillMode -- | This FunGEn module contains the map (game background) routines. module Graphics.UI.Fungen.Map data GameMap t type Tile t = (Int, Bool, Float, t) type TileMatrix t = [[(Tile t)]] getTilePictureIndex :: Tile t -> Int getTileBlocked :: Tile t -> Bool getTileMoveCost :: Tile t -> Float getTileSpecialAttribute :: Tile t -> t colorMap :: GLclampf -> GLclampf -> GLclampf -> GLdouble -> GLdouble -> GameMap t textureMap :: Int -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameMap t tileMap :: TileMatrix t -> GLdouble -> GLdouble -> GameMap t multiMap :: [(GameMap t)] -> Int -> GameMap t getMapSize :: GameMap t -> Point2D isTileMap :: GameMap t -> Bool getTileMapTileMatrix :: GameMap t -> TileMatrix t getTileMapScroll :: GameMap t -> Point2D getTileMapSize :: GameMap t -> Point2D getTileMapTileSize :: GameMap t -> Point2D getCurrentMap :: GameMap t -> GameMap t updateCurrentMap :: GameMap t -> GameMap t -> GameMap t updateCurrentIndex :: GameMap t -> Int -> GameMap t isMultiMap :: GameMap t -> Bool drawGameMap :: GameMap t -> Point2D -> [TextureObject] -> IO () clearGameScreen :: GLclampf -> GLclampf -> GLclampf -> IO () -- | This FunGEn module contains some important game routines. module Graphics.UI.Fungen.Game -- | A game has the type Game t s u v, where -- --
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