FunGEn 0.4 → 0.4.1
raw patch · 15 files changed
+251/−149 lines, 15 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.UI.Fungen.Display: display :: Game t s u v -> IOGame t s u v () -> DisplayCallback
- Graphics.UI.Fungen.Game: addObjectsToGroup :: [(GameObject s)] -> String -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: addObjectsToNewGroup :: [(GameObject s)] -> String -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: clearScreen :: GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: createGame :: GameMap v -> [(ObjectManager s)] -> WindowConfig -> u -> t -> FilePictureList -> IO (Game t s u v)
- Graphics.UI.Fungen.Game: data Game t s u v
- Graphics.UI.Fungen.Game: data IOGame t s u v a
- Graphics.UI.Fungen.Game: destroyObject :: GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: destroyObjects :: [(GameObject s)] -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: disableGameFlags :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: disableMapDrawing :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: disableObjectsDrawing :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: disableObjectsMoving :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: drawAllObjects :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: drawMap :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: drawObject :: GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: enableGameFlags :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: enableMapDrawing :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: enableObjectsDrawing :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: enableObjectsMoving :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: findObject :: String -> String -> IOGame t s u v (GameObject s)
- Graphics.UI.Fungen.Game: findObjectManager :: String -> IOGame t s u v (ObjectManager s)
- Graphics.UI.Fungen.Game: funExit :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: getGameAttribute :: IOGame t s u v t
- Graphics.UI.Fungen.Game: getGameFlags :: IOGame t s u v GameFlags
- Graphics.UI.Fungen.Game: getGameState :: IOGame t s u v u
- Graphics.UI.Fungen.Game: getObjectAsleep :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: getObjectAttribute :: GameObject s -> IOGame t s u v s
- Graphics.UI.Fungen.Game: getObjectGroupName :: GameObject s -> IOGame t s u v String
- Graphics.UI.Fungen.Game: getObjectManagers :: IOGame t s u v [(ObjectManager s)]
- Graphics.UI.Fungen.Game: getObjectName :: GameObject s -> IOGame t s u v String
- Graphics.UI.Fungen.Game: getObjectPosition :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- Graphics.UI.Fungen.Game: getObjectSize :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- Graphics.UI.Fungen.Game: getObjectSpeed :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
- Graphics.UI.Fungen.Game: getObjectsFromGroup :: String -> IOGame t s u v [(GameObject s)]
- Graphics.UI.Fungen.Game: getTileFromIndex :: (Int, Int) -> IOGame t s u v (Tile v)
- Graphics.UI.Fungen.Game: getTileFromWindowPosition :: (GLdouble, GLdouble) -> IOGame t s u v (Tile v)
- Graphics.UI.Fungen.Game: instance Monad (IOGame t s u v)
- Graphics.UI.Fungen.Game: liftIOtoIOGame :: IO a -> IOGame t s u v a
- Graphics.UI.Fungen.Game: liftIOtoIOGame' :: (a -> IO ()) -> a -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: moveAllObjects :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: objectBottomMapCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectBottomMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectLeftMapCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectLeftMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectListObjectCollision :: [(GameObject s)] -> GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectListObjectFutureCollision :: [(GameObject s)] -> GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectRightMapCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectRightMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectTopMapCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectTopMapFutureCollision :: GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectsCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: objectsFutureCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: pointsObjectListCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> [(GameObject s)] -> IOGame t s u v Bool
- Graphics.UI.Fungen.Game: printOnPrompt :: Show a => a -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: printOnScreen :: String -> BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: printText :: IOGame t s u v ()
- Graphics.UI.Fungen.Game: randomDouble :: (Double, Double) -> IOGame t s u v Double
- Graphics.UI.Fungen.Game: randomFloat :: (Float, Float) -> IOGame t s u v Float
- Graphics.UI.Fungen.Game: randomInt :: (Int, Int) -> IOGame t s u v Int
- Graphics.UI.Fungen.Game: replaceObject :: GameObject s -> (GameObject s -> GameObject s) -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: reverseXSpeed :: GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: reverseYSpeed :: GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: runIOGame :: IOGame t s u v a -> Game t s u v -> IO (Game t s u v, a)
- Graphics.UI.Fungen.Game: runIOGameM :: IOGame t s u v a -> Game t s u v -> IO ()
- Graphics.UI.Fungen.Game: setCurrentMapIndex :: Int -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setGameAttribute :: t -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setGameFlags :: GameFlags -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setGameState :: u -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectAsleep :: Bool -> GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectAttribute :: s -> GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectCurrentPicture :: Int -> GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectManagers :: [(ObjectManager s)] -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectPosition :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: setObjectSpeed :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: showFPS :: BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
- Graphics.UI.Fungen.Game: wait :: Int -> IOGame t s u v ()
- Graphics.UI.Fungen.Init: funInit :: WindowConfig -> GameMap v -> [(ObjectManager s)] -> u -> t -> [InputBinding t s u v] -> IOGame t s u v () -> RefreshType -> FilePictureList -> IO ()
- Graphics.UI.Fungen.Input: AdditionalButton :: Int -> MouseButton
- Graphics.UI.Fungen.Input: Char :: Char -> Key
- Graphics.UI.Fungen.Input: KeyBegin :: SpecialKey
- Graphics.UI.Fungen.Input: KeyDelete :: SpecialKey
- Graphics.UI.Fungen.Input: KeyDown :: SpecialKey
- Graphics.UI.Fungen.Input: KeyEnd :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF1 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF10 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF11 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF12 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF2 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF3 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF4 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF5 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF6 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF7 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF8 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyF9 :: SpecialKey
- Graphics.UI.Fungen.Input: KeyHome :: SpecialKey
- Graphics.UI.Fungen.Input: KeyInsert :: SpecialKey
- Graphics.UI.Fungen.Input: KeyLeft :: SpecialKey
- Graphics.UI.Fungen.Input: KeyNumLock :: SpecialKey
- Graphics.UI.Fungen.Input: KeyPageDown :: SpecialKey
- Graphics.UI.Fungen.Input: KeyPageUp :: SpecialKey
- Graphics.UI.Fungen.Input: KeyRight :: SpecialKey
- Graphics.UI.Fungen.Input: KeyUnknown :: Int -> SpecialKey
- Graphics.UI.Fungen.Input: KeyUp :: SpecialKey
- Graphics.UI.Fungen.Input: LeftButton :: MouseButton
- Graphics.UI.Fungen.Input: MiddleButton :: MouseButton
- Graphics.UI.Fungen.Input: Modifiers :: KeyState -> KeyState -> KeyState -> Modifiers
- Graphics.UI.Fungen.Input: MouseButton :: MouseButton -> Key
- Graphics.UI.Fungen.Input: Position :: !GLint -> !GLint -> Position
- Graphics.UI.Fungen.Input: Press :: KeyEvent
- Graphics.UI.Fungen.Input: Release :: KeyEvent
- Graphics.UI.Fungen.Input: RightButton :: MouseButton
- Graphics.UI.Fungen.Input: SpecialKey :: SpecialKey -> Key
- Graphics.UI.Fungen.Input: StillDown :: KeyEvent
- Graphics.UI.Fungen.Input: WheelDown :: MouseButton
- Graphics.UI.Fungen.Input: WheelUp :: MouseButton
- Graphics.UI.Fungen.Input: alt :: Modifiers -> KeyState
- Graphics.UI.Fungen.Input: ctrl :: Modifiers -> KeyState
- Graphics.UI.Fungen.Input: data Key :: *
- Graphics.UI.Fungen.Input: data KeyEvent
- Graphics.UI.Fungen.Input: data Modifiers :: *
- Graphics.UI.Fungen.Input: data MouseButton :: *
- Graphics.UI.Fungen.Input: data Position :: *
- Graphics.UI.Fungen.Input: data SpecialKey :: *
- Graphics.UI.Fungen.Input: funBinding :: [InputBinding t s u v] -> Game t s u v -> IO (KeyBinder, StillDownHandler)
- Graphics.UI.Fungen.Input: shift :: Modifiers -> KeyState
- Graphics.UI.Fungen.Input: type InputBinding t s u v = (Key, KeyEvent, InputHandler t s u v)
- Graphics.UI.Fungen.Input: type InputHandler t s u v = Modifiers -> Position -> IOGame t s u v ()
- Graphics.UI.Fungen.Loader: loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap
- Graphics.UI.Fungen.Loader: loadBitmapList :: [(FilePath, Maybe ColorList3)] -> IO [AwbfBitmap]
- Graphics.UI.Fungen.Loader: type FilePictureList = [(FilePath, InvList)]
- Graphics.UI.Fungen.Map: clearGameScreen :: GLclampf -> GLclampf -> GLclampf -> IO ()
- Graphics.UI.Fungen.Map: colorMap :: GLclampf -> GLclampf -> GLclampf -> GLdouble -> GLdouble -> GameMap t
- Graphics.UI.Fungen.Map: data GameMap t
- Graphics.UI.Fungen.Map: drawGameMap :: GameMap t -> Point2D -> [TextureObject] -> IO ()
- Graphics.UI.Fungen.Map: getCurrentMap :: GameMap t -> GameMap t
- Graphics.UI.Fungen.Map: getMapSize :: GameMap t -> Point2D
- Graphics.UI.Fungen.Map: getTileBlocked :: Tile t -> Bool
- Graphics.UI.Fungen.Map: getTileMapScroll :: GameMap t -> Point2D
- Graphics.UI.Fungen.Map: getTileMapSize :: GameMap t -> Point2D
- Graphics.UI.Fungen.Map: getTileMapTileMatrix :: GameMap t -> TileMatrix t
- Graphics.UI.Fungen.Map: getTileMapTileSize :: GameMap t -> Point2D
- Graphics.UI.Fungen.Map: getTileMoveCost :: Tile t -> Float
- Graphics.UI.Fungen.Map: getTilePictureIndex :: Tile t -> Int
- Graphics.UI.Fungen.Map: getTileSpecialAttribute :: Tile t -> t
- Graphics.UI.Fungen.Map: isMultiMap :: GameMap t -> Bool
- Graphics.UI.Fungen.Map: isTileMap :: GameMap t -> Bool
- Graphics.UI.Fungen.Map: multiMap :: [(GameMap t)] -> Int -> GameMap t
- Graphics.UI.Fungen.Map: textureMap :: Int -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameMap t
- Graphics.UI.Fungen.Map: tileMap :: TileMatrix t -> GLdouble -> GLdouble -> GameMap t
- Graphics.UI.Fungen.Map: type Tile t = (Int, Bool, Float, t)
- Graphics.UI.Fungen.Map: type TileMatrix t = [[(Tile t)]]
- Graphics.UI.Fungen.Map: updateCurrentIndex :: GameMap t -> Int -> GameMap t
- Graphics.UI.Fungen.Map: updateCurrentMap :: GameMap t -> GameMap t -> GameMap t
- Graphics.UI.Fungen.Objects: Basic :: Primitive -> ObjectPicture
- Graphics.UI.Fungen.Objects: Circle :: GLdouble -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive
- Graphics.UI.Fungen.Objects: Filled :: FillMode
- Graphics.UI.Fungen.Objects: Polyg :: [Point2D] -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive
- Graphics.UI.Fungen.Objects: Tex :: (GLdouble, GLdouble) -> Int -> ObjectPicture
- Graphics.UI.Fungen.Objects: Unfilled :: FillMode
- Graphics.UI.Fungen.Objects: addObjectsToManager :: [(GameObject t)] -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
- Graphics.UI.Fungen.Objects: data FillMode
- Graphics.UI.Fungen.Objects: data GameObject t
- Graphics.UI.Fungen.Objects: data ObjectManager t
- Graphics.UI.Fungen.Objects: data ObjectPicture
- Graphics.UI.Fungen.Objects: data Primitive
- Graphics.UI.Fungen.Objects: destroyGameObject :: String -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
- Graphics.UI.Fungen.Objects: drawGameObject :: GameObject t -> QuadricPrimitive -> [TextureObject] -> IO ()
- Graphics.UI.Fungen.Objects: drawGameObjects :: [(ObjectManager t)] -> QuadricPrimitive -> [TextureObject] -> IO ()
- Graphics.UI.Fungen.Objects: findObjectFromId :: GameObject t -> [(ObjectManager t)] -> GameObject t
- Graphics.UI.Fungen.Objects: getGameObjectAsleep :: GameObject t -> Bool
- Graphics.UI.Fungen.Objects: getGameObjectAttribute :: GameObject t -> t
- Graphics.UI.Fungen.Objects: getGameObjectId :: GameObject t -> Integer
- Graphics.UI.Fungen.Objects: getGameObjectManagerName :: GameObject t -> String
- Graphics.UI.Fungen.Objects: getGameObjectName :: GameObject t -> String
- Graphics.UI.Fungen.Objects: getGameObjectPosition :: GameObject t -> (GLdouble, GLdouble)
- Graphics.UI.Fungen.Objects: getGameObjectSize :: GameObject t -> (GLdouble, GLdouble)
- Graphics.UI.Fungen.Objects: getGameObjectSpeed :: GameObject t -> (GLdouble, GLdouble)
- Graphics.UI.Fungen.Objects: getObjectManagerCounter :: ObjectManager t -> Integer
- Graphics.UI.Fungen.Objects: getObjectManagerName :: ObjectManager t -> String
- Graphics.UI.Fungen.Objects: getObjectManagerObjects :: ObjectManager t -> [(GameObject t)]
- Graphics.UI.Fungen.Objects: instance Eq FillMode
- Graphics.UI.Fungen.Objects: moveGameObjects :: [(ObjectManager t)] -> [(ObjectManager t)]
- Graphics.UI.Fungen.Objects: object :: String -> ObjectPicture -> Bool -> (GLdouble, GLdouble) -> (GLdouble, GLdouble) -> t -> GameObject t
- Graphics.UI.Fungen.Objects: objectGroup :: String -> [(GameObject t)] -> (ObjectManager t)
- Graphics.UI.Fungen.Objects: searchGameObject :: String -> ObjectManager t -> GameObject t
- Graphics.UI.Fungen.Objects: searchObjectManager :: String -> [(ObjectManager t)] -> ObjectManager t
- Graphics.UI.Fungen.Objects: updateObject :: (GameObject t -> GameObject t) -> Integer -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
- Graphics.UI.Fungen.Objects: updateObjectAsleep :: Bool -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Objects: updateObjectAttribute :: t -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Objects: updateObjectPicture :: Int -> Int -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Objects: updateObjectPosition :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Objects: updateObjectSize :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Objects: updateObjectSpeed :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
- Graphics.UI.Fungen.Text: Fixed8By13 :: BitmapFont
- Graphics.UI.Fungen.Text: Fixed9By15 :: BitmapFont
- Graphics.UI.Fungen.Text: Helvetica10 :: BitmapFont
- Graphics.UI.Fungen.Text: Helvetica12 :: BitmapFont
- Graphics.UI.Fungen.Text: Helvetica18 :: BitmapFont
- Graphics.UI.Fungen.Text: TimesRoman10 :: BitmapFont
- Graphics.UI.Fungen.Text: TimesRoman24 :: BitmapFont
- Graphics.UI.Fungen.Text: data BitmapFont :: *
- Graphics.UI.Fungen.Text: putGameText :: [Text] -> IO ()
- Graphics.UI.Fungen.Text: type Text = (String, BitmapFont, (GLdouble, GLdouble), GLclampf, GLclampf, GLclampf)
- Graphics.UI.Fungen.Timer: Idle :: RefreshType
- Graphics.UI.Fungen.Timer: Timer :: Int -> RefreshType
- Graphics.UI.Fungen.Timer: data RefreshType
- Graphics.UI.Fungen.Timer: setRefresh :: RefreshType -> StillDownHandler -> IO ()
- Graphics.UI.Fungen.Types: type AwbfBitmap = (GLsizei, GLsizei, PixelData GLubyte)
- Graphics.UI.Fungen.Types: type ColorList3 = [(GLubyte, GLubyte, GLubyte)]
- Graphics.UI.Fungen.Types: type InvList = Maybe [(Int, Int, Int)]
- Graphics.UI.Fungen.Types: type Point2D = (GLdouble, GLdouble)
- Graphics.UI.Fungen.Types: type WindowConfig = ((Int, Int), (Int, Int), String)
- Graphics.UI.Fungen.Util: addNoInvisibility :: [FilePath] -> [(FilePath, Maybe ColorList3)]
- Graphics.UI.Fungen.Util: bindTexture :: TextureTarget -> TextureObject -> IO ()
- Graphics.UI.Fungen.Util: dropGLsizei :: GLsizei -> [a] -> [a]
- Graphics.UI.Fungen.Util: inv2color3 :: InvList -> Maybe ColorList3
- Graphics.UI.Fungen.Util: isEmpty :: [a] -> Bool
- Graphics.UI.Fungen.Util: make0 :: Int -> String
- Graphics.UI.Fungen.Util: matrixSize :: [[a]] -> (Int, Int)
- Graphics.UI.Fungen.Util: matrixToList :: [[a]] -> [a]
- Graphics.UI.Fungen.Util: ord2 :: Char -> GLubyte
- Graphics.UI.Fungen.Util: pathAndInv2color3List :: (FilePath, InvList) -> (FilePath, Maybe ColorList3)
- Graphics.UI.Fungen.Util: point2DtoVertex3 :: [Point2D] -> [Vertex3 GLdouble]
- Graphics.UI.Fungen.Util: pow2 :: GLsizei -> GLsizei
- Graphics.UI.Fungen.Util: racMod :: GLdouble -> GLdouble -> GLdouble
- Graphics.UI.Fungen.Util: randDouble :: (Double, Double) -> IO Double
- Graphics.UI.Fungen.Util: randFloat :: (Float, Float) -> IO Float
- Graphics.UI.Fungen.Util: randInt :: (Int, Int) -> IO Int
- Graphics.UI.Fungen.Util: shiftLeft :: String -> Int -> String
- Graphics.UI.Fungen.Util: texCoord2 :: GLdouble -> GLdouble -> IO ()
- Graphics.UI.Fungen.Util: texStuff :: [TextureObject] -> [AwbfBitmap] -> IO ()
- Graphics.UI.Fungen.Util: toBinary :: Int -> String
- Graphics.UI.Fungen.Util: toDecimal :: String -> GLsizei
- Graphics.UI.Fungen.Util: toRad :: Float -> Float
- Graphics.UI.Fungen.Util: unless :: Monad m => Bool -> m () -> m ()
- Graphics.UI.Fungen.Util: vertex3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
- Graphics.UI.Fungen.Util: when :: Monad m => Bool -> m () -> m ()
+ Graphics.UI.Fungen: AdditionalButton :: Int -> MouseButton
+ Graphics.UI.Fungen: Basic :: Primitive -> ObjectPicture
+ Graphics.UI.Fungen: Char :: Char -> Key
+ Graphics.UI.Fungen: Circle :: GLdouble -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive
+ Graphics.UI.Fungen: Filled :: FillMode
+ Graphics.UI.Fungen: Fixed8By13 :: BitmapFont
+ Graphics.UI.Fungen: Fixed9By15 :: BitmapFont
+ Graphics.UI.Fungen: Helvetica10 :: BitmapFont
+ Graphics.UI.Fungen: Helvetica12 :: BitmapFont
+ Graphics.UI.Fungen: Helvetica18 :: BitmapFont
+ Graphics.UI.Fungen: Idle :: RefreshType
+ Graphics.UI.Fungen: KeyBegin :: SpecialKey
+ Graphics.UI.Fungen: KeyDelete :: SpecialKey
+ Graphics.UI.Fungen: KeyDown :: SpecialKey
+ Graphics.UI.Fungen: KeyEnd :: SpecialKey
+ Graphics.UI.Fungen: KeyF1 :: SpecialKey
+ Graphics.UI.Fungen: KeyF10 :: SpecialKey
+ Graphics.UI.Fungen: KeyF11 :: SpecialKey
+ Graphics.UI.Fungen: KeyF12 :: SpecialKey
+ Graphics.UI.Fungen: KeyF2 :: SpecialKey
+ Graphics.UI.Fungen: KeyF3 :: SpecialKey
+ Graphics.UI.Fungen: KeyF4 :: SpecialKey
+ Graphics.UI.Fungen: KeyF5 :: SpecialKey
+ Graphics.UI.Fungen: KeyF6 :: SpecialKey
+ Graphics.UI.Fungen: KeyF7 :: SpecialKey
+ Graphics.UI.Fungen: KeyF8 :: SpecialKey
+ Graphics.UI.Fungen: KeyF9 :: SpecialKey
+ Graphics.UI.Fungen: KeyHome :: SpecialKey
+ Graphics.UI.Fungen: KeyInsert :: SpecialKey
+ Graphics.UI.Fungen: KeyLeft :: SpecialKey
+ Graphics.UI.Fungen: KeyNumLock :: SpecialKey
+ Graphics.UI.Fungen: KeyPageDown :: SpecialKey
+ Graphics.UI.Fungen: KeyPageUp :: SpecialKey
+ Graphics.UI.Fungen: KeyRight :: SpecialKey
+ Graphics.UI.Fungen: KeyUnknown :: Int -> SpecialKey
+ Graphics.UI.Fungen: KeyUp :: SpecialKey
+ Graphics.UI.Fungen: LeftButton :: MouseButton
+ Graphics.UI.Fungen: MiddleButton :: MouseButton
+ Graphics.UI.Fungen: Modifiers :: KeyState -> KeyState -> KeyState -> Modifiers
+ Graphics.UI.Fungen: MouseButton :: MouseButton -> Key
+ Graphics.UI.Fungen: Polyg :: [Point2D] -> GLfloat -> GLfloat -> GLfloat -> FillMode -> Primitive
+ Graphics.UI.Fungen: Position :: !GLint -> !GLint -> Position
+ Graphics.UI.Fungen: Press :: KeyEvent
+ Graphics.UI.Fungen: Release :: KeyEvent
+ Graphics.UI.Fungen: RightButton :: MouseButton
+ Graphics.UI.Fungen: SpecialKey :: SpecialKey -> Key
+ Graphics.UI.Fungen: StillDown :: KeyEvent
+ Graphics.UI.Fungen: Tex :: (GLdouble, GLdouble) -> Int -> ObjectPicture
+ Graphics.UI.Fungen: Timer :: Int -> RefreshType
+ Graphics.UI.Fungen: TimesRoman10 :: BitmapFont
+ Graphics.UI.Fungen: TimesRoman24 :: BitmapFont
+ Graphics.UI.Fungen: Unfilled :: FillMode
+ Graphics.UI.Fungen: WheelDown :: MouseButton
+ Graphics.UI.Fungen: WheelUp :: MouseButton
+ Graphics.UI.Fungen: addNoInvisibility :: [FilePath] -> [(FilePath, Maybe ColorList3)]
+ Graphics.UI.Fungen: addObjectsToGroup :: [(GameObject s)] -> String -> IOGame t s u v ()
+ Graphics.UI.Fungen: addObjectsToManager :: [(GameObject t)] -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
+ Graphics.UI.Fungen: addObjectsToNewGroup :: [(GameObject s)] -> String -> IOGame t s u v ()
+ Graphics.UI.Fungen: alt :: Modifiers -> KeyState
+ Graphics.UI.Fungen: bindTexture :: TextureTarget -> TextureObject -> IO ()
+ Graphics.UI.Fungen: clearGameScreen :: GLclampf -> GLclampf -> GLclampf -> IO ()
+ Graphics.UI.Fungen: clearScreen :: GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
+ Graphics.UI.Fungen: colorMap :: GLclampf -> GLclampf -> GLclampf -> GLdouble -> GLdouble -> GameMap t
+ Graphics.UI.Fungen: createGame :: GameMap v -> [(ObjectManager s)] -> WindowConfig -> u -> t -> FilePictureList -> IO (Game t s u v)
+ Graphics.UI.Fungen: ctrl :: Modifiers -> KeyState
+ Graphics.UI.Fungen: data BitmapFont :: *
+ Graphics.UI.Fungen: data FillMode
+ Graphics.UI.Fungen: data Game t s u v
+ Graphics.UI.Fungen: data GameMap t
+ Graphics.UI.Fungen: data GameObject t
+ Graphics.UI.Fungen: data IOGame t s u v a
+ Graphics.UI.Fungen: data Key :: *
+ Graphics.UI.Fungen: data KeyEvent
+ Graphics.UI.Fungen: data Modifiers :: *
+ Graphics.UI.Fungen: data MouseButton :: *
+ Graphics.UI.Fungen: data ObjectManager t
+ Graphics.UI.Fungen: data ObjectPicture
+ Graphics.UI.Fungen: data Position :: *
+ Graphics.UI.Fungen: data Primitive
+ Graphics.UI.Fungen: data RefreshType
+ Graphics.UI.Fungen: data SpecialKey :: *
+ Graphics.UI.Fungen: destroyGameObject :: String -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
+ Graphics.UI.Fungen: destroyObject :: GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: destroyObjects :: [(GameObject s)] -> IOGame t s u v ()
+ Graphics.UI.Fungen: disableGameFlags :: IOGame t s u v ()
+ Graphics.UI.Fungen: disableMapDrawing :: IOGame t s u v ()
+ Graphics.UI.Fungen: disableObjectsDrawing :: IOGame t s u v ()
+ Graphics.UI.Fungen: disableObjectsMoving :: IOGame t s u v ()
+ Graphics.UI.Fungen: display :: Game t s u v -> IOGame t s u v () -> DisplayCallback
+ Graphics.UI.Fungen: drawAllObjects :: IOGame t s u v ()
+ Graphics.UI.Fungen: drawGameMap :: GameMap t -> Point2D -> [TextureObject] -> IO ()
+ Graphics.UI.Fungen: drawGameObject :: GameObject t -> QuadricPrimitive -> [TextureObject] -> IO ()
+ Graphics.UI.Fungen: drawGameObjects :: [(ObjectManager t)] -> QuadricPrimitive -> [TextureObject] -> IO ()
+ Graphics.UI.Fungen: drawMap :: IOGame t s u v ()
+ Graphics.UI.Fungen: drawObject :: GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: dropGLsizei :: GLsizei -> [a] -> [a]
+ Graphics.UI.Fungen: enableGameFlags :: IOGame t s u v ()
+ Graphics.UI.Fungen: enableMapDrawing :: IOGame t s u v ()
+ Graphics.UI.Fungen: enableObjectsDrawing :: IOGame t s u v ()
+ Graphics.UI.Fungen: enableObjectsMoving :: IOGame t s u v ()
+ Graphics.UI.Fungen: findObject :: String -> String -> IOGame t s u v (GameObject s)
+ Graphics.UI.Fungen: findObjectFromId :: GameObject t -> [(ObjectManager t)] -> GameObject t
+ Graphics.UI.Fungen: findObjectManager :: String -> IOGame t s u v (ObjectManager s)
+ Graphics.UI.Fungen: funBinding :: [InputBinding t s u v] -> Game t s u v -> IO (KeyBinder, StillDownHandler)
+ Graphics.UI.Fungen: funExit :: IOGame t s u v ()
+ Graphics.UI.Fungen: funInit :: WindowConfig -> GameMap v -> [(ObjectManager s)] -> u -> t -> [InputBinding t s u v] -> IOGame t s u v () -> RefreshType -> FilePictureList -> IO ()
+ Graphics.UI.Fungen: getCurrentMap :: GameMap t -> GameMap t
+ Graphics.UI.Fungen: getGameAttribute :: IOGame t s u v t
+ Graphics.UI.Fungen: getGameFlags :: IOGame t s u v GameFlags
+ Graphics.UI.Fungen: getGameObjectAsleep :: GameObject t -> Bool
+ Graphics.UI.Fungen: getGameObjectAttribute :: GameObject t -> t
+ Graphics.UI.Fungen: getGameObjectId :: GameObject t -> Integer
+ Graphics.UI.Fungen: getGameObjectManagerName :: GameObject t -> String
+ Graphics.UI.Fungen: getGameObjectName :: GameObject t -> String
+ Graphics.UI.Fungen: getGameObjectPosition :: GameObject t -> (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getGameObjectSize :: GameObject t -> (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getGameObjectSpeed :: GameObject t -> (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getGameState :: IOGame t s u v u
+ Graphics.UI.Fungen: getMapSize :: GameMap t -> Point2D
+ Graphics.UI.Fungen: getObjectAsleep :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: getObjectAttribute :: GameObject s -> IOGame t s u v s
+ Graphics.UI.Fungen: getObjectGroupName :: GameObject s -> IOGame t s u v String
+ Graphics.UI.Fungen: getObjectManagerCounter :: ObjectManager t -> Integer
+ Graphics.UI.Fungen: getObjectManagerName :: ObjectManager t -> String
+ Graphics.UI.Fungen: getObjectManagerObjects :: ObjectManager t -> [(GameObject t)]
+ Graphics.UI.Fungen: getObjectManagers :: IOGame t s u v [(ObjectManager s)]
+ Graphics.UI.Fungen: getObjectName :: GameObject s -> IOGame t s u v String
+ Graphics.UI.Fungen: getObjectPosition :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getObjectSize :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getObjectSpeed :: GameObject s -> IOGame t s u v (GLdouble, GLdouble)
+ Graphics.UI.Fungen: getObjectsFromGroup :: String -> IOGame t s u v [(GameObject s)]
+ Graphics.UI.Fungen: getTileBlocked :: Tile t -> Bool
+ Graphics.UI.Fungen: getTileFromIndex :: (Int, Int) -> IOGame t s u v (Tile v)
+ Graphics.UI.Fungen: getTileFromWindowPosition :: (GLdouble, GLdouble) -> IOGame t s u v (Tile v)
+ Graphics.UI.Fungen: getTileMapScroll :: GameMap t -> Point2D
+ Graphics.UI.Fungen: getTileMapSize :: GameMap t -> Point2D
+ Graphics.UI.Fungen: getTileMapTileMatrix :: GameMap t -> TileMatrix t
+ Graphics.UI.Fungen: getTileMapTileSize :: GameMap t -> Point2D
+ Graphics.UI.Fungen: getTileMoveCost :: Tile t -> Float
+ Graphics.UI.Fungen: getTilePictureIndex :: Tile t -> Int
+ Graphics.UI.Fungen: getTileSpecialAttribute :: Tile t -> t
+ Graphics.UI.Fungen: inv2color3 :: InvList -> Maybe ColorList3
+ Graphics.UI.Fungen: isEmpty :: [a] -> Bool
+ Graphics.UI.Fungen: isMultiMap :: GameMap t -> Bool
+ Graphics.UI.Fungen: isTileMap :: GameMap t -> Bool
+ Graphics.UI.Fungen: liftIOtoIOGame :: IO a -> IOGame t s u v a
+ Graphics.UI.Fungen: liftIOtoIOGame' :: (a -> IO ()) -> a -> IOGame t s u v ()
+ Graphics.UI.Fungen: loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap
+ Graphics.UI.Fungen: loadBitmapList :: [(FilePath, Maybe ColorList3)] -> IO [AwbfBitmap]
+ Graphics.UI.Fungen: make0 :: Int -> String
+ Graphics.UI.Fungen: matrixSize :: [[a]] -> (Int, Int)
+ Graphics.UI.Fungen: matrixToList :: [[a]] -> [a]
+ Graphics.UI.Fungen: moveAllObjects :: IOGame t s u v ()
+ Graphics.UI.Fungen: moveGameObjects :: [(ObjectManager t)] -> [(ObjectManager t)]
+ Graphics.UI.Fungen: multiMap :: [(GameMap t)] -> Int -> GameMap t
+ Graphics.UI.Fungen: object :: String -> ObjectPicture -> Bool -> (GLdouble, GLdouble) -> (GLdouble, GLdouble) -> t -> GameObject t
+ Graphics.UI.Fungen: objectBottomMapCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectBottomMapFutureCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectGroup :: String -> [(GameObject t)] -> (ObjectManager t)
+ Graphics.UI.Fungen: objectLeftMapCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectLeftMapFutureCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectListObjectCollision :: [(GameObject s)] -> GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectListObjectFutureCollision :: [(GameObject s)] -> GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectRightMapCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectRightMapFutureCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectTopMapCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectTopMapFutureCollision :: GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectsCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: objectsFutureCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: ord2 :: Char -> GLubyte
+ Graphics.UI.Fungen: pathAndInv2color3List :: (FilePath, InvList) -> (FilePath, Maybe ColorList3)
+ Graphics.UI.Fungen: point2DtoVertex3 :: [Point2D] -> [Vertex3 GLdouble]
+ Graphics.UI.Fungen: pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v Bool
+ Graphics.UI.Fungen: pointsObjectListCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> [(GameObject s)] -> IOGame t s u v Bool
+ Graphics.UI.Fungen: pow2 :: GLsizei -> GLsizei
+ Graphics.UI.Fungen: printOnPrompt :: Show a => a -> IOGame t s u v ()
+ Graphics.UI.Fungen: printOnScreen :: String -> BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
+ Graphics.UI.Fungen: printText :: IOGame t s u v ()
+ Graphics.UI.Fungen: putGameText :: [Text] -> IO ()
+ Graphics.UI.Fungen: racMod :: GLdouble -> GLdouble -> GLdouble
+ Graphics.UI.Fungen: randDouble :: (Double, Double) -> IO Double
+ Graphics.UI.Fungen: randFloat :: (Float, Float) -> IO Float
+ Graphics.UI.Fungen: randInt :: (Int, Int) -> IO Int
+ Graphics.UI.Fungen: randomDouble :: (Double, Double) -> IOGame t s u v Double
+ Graphics.UI.Fungen: randomFloat :: (Float, Float) -> IOGame t s u v Float
+ Graphics.UI.Fungen: randomInt :: (Int, Int) -> IOGame t s u v Int
+ Graphics.UI.Fungen: replaceObject :: GameObject s -> (GameObject s -> GameObject s) -> IOGame t s u v ()
+ Graphics.UI.Fungen: reverseXSpeed :: GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: reverseYSpeed :: GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: runIOGame :: IOGame t s u v a -> Game t s u v -> IO (Game t s u v, a)
+ Graphics.UI.Fungen: runIOGameM :: IOGame t s u v a -> Game t s u v -> IO ()
+ Graphics.UI.Fungen: searchGameObject :: String -> ObjectManager t -> GameObject t
+ Graphics.UI.Fungen: searchObjectManager :: String -> [(ObjectManager t)] -> ObjectManager t
+ Graphics.UI.Fungen: setCurrentMapIndex :: Int -> IOGame t s u v ()
+ Graphics.UI.Fungen: setGameAttribute :: t -> IOGame t s u v ()
+ Graphics.UI.Fungen: setGameFlags :: GameFlags -> IOGame t s u v ()
+ Graphics.UI.Fungen: setGameState :: u -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectAsleep :: Bool -> GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectAttribute :: s -> GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectCurrentPicture :: Int -> GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectManagers :: [(ObjectManager s)] -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectPosition :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: setObjectSpeed :: (GLdouble, GLdouble) -> GameObject s -> IOGame t s u v ()
+ Graphics.UI.Fungen: setRefresh :: RefreshType -> StillDownHandler -> IO ()
+ Graphics.UI.Fungen: shift :: Modifiers -> KeyState
+ Graphics.UI.Fungen: shiftLeft :: String -> Int -> String
+ Graphics.UI.Fungen: showFPS :: BitmapFont -> (GLdouble, GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v ()
+ Graphics.UI.Fungen: texCoord2 :: GLdouble -> GLdouble -> IO ()
+ Graphics.UI.Fungen: texStuff :: [TextureObject] -> [AwbfBitmap] -> IO ()
+ Graphics.UI.Fungen: textureMap :: Int -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameMap t
+ Graphics.UI.Fungen: tileMap :: TileMatrix t -> GLdouble -> GLdouble -> GameMap t
+ Graphics.UI.Fungen: toBinary :: Int -> String
+ Graphics.UI.Fungen: toDecimal :: String -> GLsizei
+ Graphics.UI.Fungen: toRad :: Float -> Float
+ Graphics.UI.Fungen: type AwbfBitmap = (GLsizei, GLsizei, PixelData GLubyte)
+ Graphics.UI.Fungen: type ColorList3 = [(GLubyte, GLubyte, GLubyte)]
+ Graphics.UI.Fungen: type FilePictureList = [(FilePath, InvList)]
+ Graphics.UI.Fungen: type InputBinding t s u v = (Key, KeyEvent, InputHandler t s u v)
+ Graphics.UI.Fungen: type InputHandler t s u v = Modifiers -> Position -> IOGame t s u v ()
+ Graphics.UI.Fungen: type InvList = Maybe [(Int, Int, Int)]
+ Graphics.UI.Fungen: type Point2D = (GLdouble, GLdouble)
+ Graphics.UI.Fungen: type Text = (String, BitmapFont, Point2D, GLclampf, GLclampf, GLclampf)
+ Graphics.UI.Fungen: type Tile t = (Int, Bool, Float, t)
+ Graphics.UI.Fungen: type TileMatrix t = [[(Tile t)]]
+ Graphics.UI.Fungen: type WindowConfig = ((Int, Int), (Int, Int), String)
+ Graphics.UI.Fungen: unless :: Monad m => Bool -> m () -> m ()
+ Graphics.UI.Fungen: updateCurrentIndex :: GameMap t -> Int -> GameMap t
+ Graphics.UI.Fungen: updateCurrentMap :: GameMap t -> GameMap t -> GameMap t
+ Graphics.UI.Fungen: updateObject :: (GameObject t -> GameObject t) -> Integer -> String -> [(ObjectManager t)] -> [(ObjectManager t)]
+ Graphics.UI.Fungen: updateObjectAsleep :: Bool -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: updateObjectAttribute :: t -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: updateObjectPicture :: Int -> Int -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: updateObjectPosition :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: updateObjectSize :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: updateObjectSpeed :: (GLdouble, GLdouble) -> GameObject t -> GameObject t
+ Graphics.UI.Fungen: vertex3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
+ Graphics.UI.Fungen: wait :: Int -> IOGame t s u v ()
+ Graphics.UI.Fungen: when :: Monad m => Bool -> m () -> m ()
Files
- FunGEn.cabal +1/−1
- Graphics/UI/Fungen.hs +51/−14
- Graphics/UI/Fungen/Display.hs +4/−1
- Graphics/UI/Fungen/Game.hs +96/−85
- Graphics/UI/Fungen/Init.hs +20/−2
- Graphics/UI/Fungen/Input.hs +6/−5
- Graphics/UI/Fungen/Loader.hs +4/−3
- Graphics/UI/Fungen/Map.hs +26/−20
- Graphics/UI/Fungen/Objects.hs +24/−13
- Graphics/UI/Fungen/Text.hs +6/−3
- Graphics/UI/Fungen/Timer.hs +4/−0
- Graphics/UI/Fungen/Types.hs +1/−0
- Graphics/UI/Fungen/Util.hs +3/−2
- Graphics/UI/GLUT/Input.hs +1/−0
- README.md +4/−0
FunGEn.cabal view
@@ -1,5 +1,5 @@ name: FunGEn -version: 0.4 +version: 0.4.1 copyright: (C) 2002 Andre Furtado <awbf@cin.ufpe.br> license: BSD3 license-file: LICENSE
Graphics/UI/Fungen.hs view
@@ -1,10 +1,13 @@-{- | This is the main module of FunGEN - Functional Game Engine. +{- | +This is the main module of FunGEN (Functional Game Engine), which re-exports the rest. -} {- FunGEN - Functional Game Engine -http://www.cin.ufpe.br/~haskell/fungen -Copyright (C) 2002 Andre Furtado <awbf@cin.ufpe.br> +http://joyful.com/fungen +Copyright (C) +2002 Andre Furtado <awbf@cin.ufpe.br> +2008, 2011-2013 Simon Michael <simon@joyful.com> This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,17 +16,51 @@ -} module Graphics.UI.Fungen ( - module Graphics.UI.Fungen.Types, - module Graphics.UI.Fungen.Util, - module Graphics.UI.Fungen.Loader, - module Graphics.UI.Fungen.Objects, - module Graphics.UI.Fungen.Map, - module Graphics.UI.Fungen.Game, - module Graphics.UI.Fungen.Display, - module Graphics.UI.Fungen.Input, - module Graphics.UI.Fungen.Timer, - module Graphics.UI.Fungen.Text, - module Graphics.UI.Fungen.Init + + -- * Execution + -- | Starting and stopping a game. + module Graphics.UI.Fungen.Init, + + -- * Types + -- | Some basic types. + module Graphics.UI.Fungen.Types, + + -- * Images + -- | Loading BMP image files. + module Graphics.UI.Fungen.Loader, + + -- * Text + -- | Printing text on the screen. + module Graphics.UI.Fungen.Text, + + -- * Tile Maps + -- | Tile maps (backgrounds). + module Graphics.UI.Fungen.Map, + + -- * Objects + -- | Game objects (sprites). + module Graphics.UI.Fungen.Objects, + + -- * Input + -- | User input from mouse and keyboard. + module Graphics.UI.Fungen.Input, + + -- * Timing + -- | Timing control. + module Graphics.UI.Fungen.Timer, + + -- * Game + -- | Game management and various game utilities. + module Graphics.UI.Fungen.Game, + + -- * Display + -- | Rendering the game window. + module Graphics.UI.Fungen.Display, + + -- * Util + -- | Miscellaneous utilities. + module Graphics.UI.Fungen.Util + ) where import Graphics.UI.Fungen.Types
Graphics/UI/Fungen/Display.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module renders the game window. -} {- @@ -21,7 +22,9 @@ import Graphics.Rendering.OpenGL import Graphics.UI.GLUT --- | Given a fungen Game and IOGame, generate an opengl display handler. +-- | Given a fungen Game and IOGame step action, generate a GLUT +-- display callback that steps the game and renders its resulting +-- state. 'Graphics.UI.Fungen.funInit' runs this automatically. display :: Game t s u v -> IOGame t s u v () -> DisplayCallback display g gameCycle = do clear [ColorBuffer]
Graphics/UI/Fungen/Game.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains some important game routines. -} @@ -15,45 +16,57 @@ module Graphics.UI.Fungen.Game ( - Game, IOGame, runIOGame, runIOGameM, liftIOtoIOGame, liftIOtoIOGame', - getGameState, setGameState, - getGameFlags, setGameFlags, - enableGameFlags, disableGameFlags, - enableMapDrawing, disableMapDrawing, - enableObjectsDrawing, disableObjectsDrawing, - enableObjectsMoving, disableObjectsMoving, - getObjectManagers, setObjectManagers, - getGameAttribute, setGameAttribute, - createGame, funExit, - drawMap, clearScreen, getTileFromIndex, getTileFromWindowPosition, setCurrentMapIndex, - drawAllObjects, drawObject, moveAllObjects, destroyObjects, destroyObject, - getObjectsFromGroup, addObjectsToGroup, addObjectsToNewGroup, findObjectManager,findObject, - getObjectName, getObjectGroupName, getObjectAsleep, getObjectSize, - getObjectPosition, getObjectSpeed, getObjectAttribute, - setObjectPosition, setObjectAsleep, setObjectSpeed, setObjectCurrentPicture, setObjectAttribute, - replaceObject, - reverseXSpeed, reverseYSpeed, - objectsCollision, objectsFutureCollision, - objectListObjectCollision, objectListObjectFutureCollision, - objectTopMapCollision, objectBottomMapCollision, objectRightMapCollision, objectLeftMapCollision, - pointsObjectCollision, pointsObjectListCollision, - objectTopMapFutureCollision, objectBottomMapFutureCollision, objectRightMapFutureCollision, objectLeftMapFutureCollision, - printOnPrompt, printOnScreen, printText, randomFloat, randomInt, randomDouble, - showFPS, - wait + Game, IOGame, + -- ** creating + createGame, + -- ** IO utilities + runIOGame, runIOGameM, liftIOtoIOGame, liftIOtoIOGame', + -- ** game state + getGameState, setGameState, + getGameAttribute, setGameAttribute, + -- ** game flags + getGameFlags, setGameFlags, + enableGameFlags, disableGameFlags, + enableMapDrawing, disableMapDrawing, + enableObjectsDrawing, disableObjectsDrawing, + enableObjectsMoving, disableObjectsMoving, + -- ** map operations + drawMap, clearScreen, getTileFromIndex, getTileFromWindowPosition, setCurrentMapIndex, + -- ** object operations + getObjectManagers, setObjectManagers, + drawAllObjects, drawObject, moveAllObjects, destroyObjects, destroyObject, + getObjectsFromGroup, addObjectsToGroup, addObjectsToNewGroup, findObjectManager,findObject, + getObjectName, getObjectGroupName, getObjectAsleep, getObjectSize, + getObjectPosition, getObjectSpeed, getObjectAttribute, + setObjectPosition, setObjectAsleep, setObjectSpeed, setObjectCurrentPicture, setObjectAttribute, + replaceObject, + reverseXSpeed, reverseYSpeed, + -- ** collision detection + objectsCollision, objectsFutureCollision, + objectListObjectCollision, objectListObjectFutureCollision, + objectTopMapCollision, objectBottomMapCollision, objectRightMapCollision, objectLeftMapCollision, + pointsObjectCollision, pointsObjectListCollision, + objectTopMapFutureCollision, objectBottomMapFutureCollision, objectRightMapFutureCollision, objectLeftMapFutureCollision, + -- ** text operations + printOnPrompt, printOnScreen, printText, + -- ** random numbers + randomFloat, randomInt, randomDouble, + -- ** utilities + showFPS, + wait ) where import Graphics.UI.Fungen.Types import Graphics.UI.Fungen.Util import Graphics.UI.Fungen.Loader import Graphics.UI.Fungen.Text +import Graphics.UI.Fungen.Timer import Graphics.UI.Fungen.Map import Graphics.UI.Fungen.Objects import Graphics.Rendering.OpenGL import Graphics.Rendering.OpenGL.GLU import Graphics.UI.GLUT import Control.Monad -import System.Exit import Data.IORef import Text.Printf @@ -78,8 +91,7 @@ -- -- * v - /V/icinity (map tile) attribute type. -- --- A Game consists of the following attributes, accessible via the --- accessor functions below: +-- Internally, a Game consists of: -- -- * @gameMap :: IORef (GameMap v) -- a map (background)@ -- @@ -114,12 +126,16 @@ 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). +-- | IOGame is the monad in which game actions run. An IOGame action +-- takes a Game (with type parameters @t s u v@), performs some IO, +-- and returns an updated Game along with a result value (@a@): +-- +-- @newtype IOGame t s u v a = IOG (Game t s u v -> IO (Game t s u v,a))@ +-- +-- 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). newtype IOGame t s u v a = IOG (Game t s u v -> IO (Game t s u v,a)) -- | Game flags: mapDrawing, objectsDrawing, objectsMoving @@ -250,7 +266,7 @@ fpsInfo = gFPS }) --- loads all of the pictures used in the game +-- | loads all of the pictures used in the game loadPictures :: [(FilePath,InvList)] -> IO [TextureObject] loadPictures pathsAndInvLists = do bmps <- loadBitmapList (map pathAndInv2color3List pathsAndInvLists) @@ -258,17 +274,11 @@ texStuff texBmList bmps return texBmList ---------------------------------- --- ending the game ---------------------------------- -funExit :: IOGame t s u v () -funExit = liftIOtoIOGame' exitWith ExitSuccess - ---------------------------------- -- map routines ---------------------------------- --- draws the background map +-- | draws the background map drawMap :: IOGame t s u v () drawMap = do m <- getMap @@ -276,7 +286,7 @@ (_,(winWidth, winHeight),_) <- getWindowConfig liftIOtoIOGame $ drawGameMap m (fromIntegral winWidth, fromIntegral winHeight) p --- returns a mapTile, given its pixel position (x,y) in the screen +-- | returns a mapTile, given its pixel position (x,y) in the screen getTileFromWindowPosition :: (GLdouble,GLdouble) -> IOGame t s u v (Tile v) getTileFromWindowPosition (preX,preY) = do m <- getMap @@ -290,7 +300,7 @@ else getTileFromIndex (fromEnum (y/tileXsize),fromEnum (x/tileYsize)) -- (x,y) window orientation is different than index (x,y)! else error "Game.getTileFromWindowPosition error: game map is not a tile map!" --- returns a mapTile, given its index (x,y) in the tile map +-- | returns a mapTile, given its index (x,y) in the tile map getTileFromIndex :: (Int,Int) -> IOGame t s u v (Tile v) getTileFromIndex (x,y) = do m <- getMap @@ -302,11 +312,11 @@ else error ("Game.getTileFromIndex error: tile index " ++ (show (x,y)) ++ " out of map range!") else error "Game.getTileFromIndex error: game map is not a tile map!" --- paint the whole screen with a specified RGB color +-- | paint the whole screen with a specified RGB color clearScreen :: GLclampf -> GLclampf -> GLclampf -> IOGame t s u v () clearScreen r g b = liftIOtoIOGame $ clearGameScreen r g b --- set the current map for a MultiMap +-- | set the current map for a MultiMap setCurrentMapIndex :: Int -> IOGame t s u v () setCurrentMapIndex i = do m <- getRealMap @@ -358,7 +368,7 @@ -- objects routines ---------------------------------- --- draws all visible objects +-- | draws all visible objects drawAllObjects :: IOGame t s u v () drawAllObjects = do o <- getObjectManagers @@ -366,26 +376,26 @@ p <- getPictureList liftIOtoIOGame $ drawGameObjects o q p --- draw one object +-- | draw one object drawObject :: GameObject s -> IOGame t s u v () drawObject o = do q <- getQuadric p <- getPictureList liftIOtoIOGame $ drawGameObject o q p --- changes objects position according to its speed +-- | changes objects position according to its speed moveAllObjects :: IOGame t s u v () moveAllObjects = do m <- getObjectManagers let newManagers = moveGameObjects m setObjectManagers newManagers --- destroys objects from the game +-- | destroys objects from the game destroyObjects :: [(GameObject s)] -> IOGame t s u v () destroyObjects [] = return () destroyObjects (o:os) = destroyObject o >> destroyObjects os --- destroys an object from the game +-- | destroys an object from the game destroyObject :: GameObject s -> IOGame t s u v () destroyObject obj = do m <- getObjectManagers @@ -394,13 +404,13 @@ let newManagers = destroyGameObject objName mngName m setObjectManagers newManagers --- returns the list of all objects from the group whose name is given +-- | returns the list of all objects from the group whose name is given getObjectsFromGroup :: String -> IOGame t s u v [(GameObject s)] getObjectsFromGroup mngName = do mng <- findObjectManager mngName return (getObjectManagerObjects mng) --- adds an object to a previously created group +-- | adds an object to a previously created group addObjectsToGroup :: [(GameObject s)] -> String -> IOGame t s u v () addObjectsToGroup objs managerName = do manager <- findObjectManager managerName @@ -408,96 +418,96 @@ let newManagers = addObjectsToManager objs managerName managers setObjectManagers newManagers --- adds an object to a new group +-- | adds an object to a new group addObjectsToNewGroup :: [(GameObject s)] -> String -> IOGame t s u v () addObjectsToNewGroup objs newMngName = do let newManager = objectGroup newMngName objs managers <- getObjectManagers setObjectManagers (newManager:managers) --- returns an object manager of the game, given its name (internal use) +-- | returns an object manager of the game, given its name (internal use) findObjectManager :: String -> IOGame t s u v (ObjectManager s) findObjectManager mngName = do objectManagers <- getObjectManagers return (searchObjectManager mngName objectManagers) --- returns an object of the game, given its name and is object manager name +-- | returns an object of the game, given its name and is object manager name findObject :: String -> String -> IOGame t s u v (GameObject s) findObject objName mngName = do objectManagers <- getObjectManagers let m = searchObjectManager mngName objectManagers return (searchGameObject objName m) --- there is no need to search through the managers, because the name of an object is +-- | there is no need to search through the managers, because the name of an object is -- never modified so the result of this function will always be safe. getObjectName :: GameObject s -> IOGame t s u v String getObjectName o = return (getGameObjectName o) --- because an object can have its group (manager) name modified, it is necessary +-- | because an object can have its group (manager) name modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectGroupName :: GameObject s -> IOGame t s u v String getObjectGroupName o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectManagerName obj) --- because an object can have its sleeping status modified, it is necessary +-- | because an object can have its sleeping status modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectAsleep :: GameObject s -> IOGame t s u v Bool getObjectAsleep o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectAsleep obj) --- because an object can have its size modified, it is necessary +-- | because an object can have its size modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectSize :: GameObject s -> IOGame t s u v (GLdouble,GLdouble) getObjectSize o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectSize obj) --- because an object can have its position modified, it is necessary +-- | because an object can have its position modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectPosition :: GameObject s -> IOGame t s u v (GLdouble,GLdouble) getObjectPosition o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectPosition obj) --- because an object can have its speed modified, it is necessary +-- | because an object can have its speed modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectSpeed :: GameObject s -> IOGame t s u v (GLdouble,GLdouble) getObjectSpeed o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectSpeed obj) --- because an object can have its attribute modified, it is necessary +-- | because an object can have its attribute modified, it is necessary -- to search through the managers to find it, otherwise this functions won't be safe. getObjectAttribute :: GameObject s -> IOGame t s u v s getObjectAttribute o = do managers <- getObjectManagers let obj = findObjectFromId o managers return (getGameObjectAttribute obj) --- changes the sleeping status of an object, given its new status +-- | changes the sleeping status of an object, given its new status setObjectAsleep :: Bool -> GameObject s -> IOGame t s u v () setObjectAsleep asleep obj = replaceObject obj (updateObjectAsleep asleep) --- changes the position of an object, given its new position +-- | changes the position of an object, given its new position setObjectPosition :: (GLdouble,GLdouble) -> GameObject s -> IOGame t s u v () setObjectPosition pos obj = replaceObject obj (updateObjectPosition pos) --- changes the speed of an object, given its new speed +-- | changes the speed of an object, given its new speed setObjectSpeed :: (GLdouble,GLdouble) -> GameObject s -> IOGame t s u v () setObjectSpeed speed obj = replaceObject obj (updateObjectSpeed speed) --- changes the current picture of a multitextured object +-- | changes the current picture of a multitextured object setObjectCurrentPicture :: Int -> GameObject s -> IOGame t s u v () setObjectCurrentPicture n obj = do picList <- getPictureList replaceObject obj (updateObjectPicture n ((length picList) - 1)) --- changes the attribute of an object, given its new attribute +-- | changes the attribute of an object, given its new attribute setObjectAttribute :: s -> GameObject s -> IOGame t s u v () setObjectAttribute a obj = replaceObject obj (updateObjectAttribute a) --- replaces an object by a new one, given the old object and the function that must be applied to it. +-- | replaces an object by a new one, given the old object and the function that must be applied to it. replaceObject :: GameObject s -> (GameObject s -> GameObject s) -> IOGame t s u v () replaceObject obj f = do managerName <- getObjectGroupName obj @@ -518,7 +528,7 @@ -- collision routines ----------------------- --- checks the collision between an object and the top of the map +-- | checks the collision between an object and the top of the map objectTopMapCollision :: GameObject s -> IOGame t s u v Bool objectTopMapCollision o = do asleep <- getObjectAsleep o @@ -530,7 +540,7 @@ let (_,mY) = getMapSize m return (pY + (sY/2) > (realToFrac mY)) --- checks the collision between an object and the top of the map in the next game cicle +-- | checks the collision between an object and the top of the map in the next game cicle objectTopMapFutureCollision :: GameObject s -> IOGame t s u v Bool objectTopMapFutureCollision o = do asleep <- getObjectAsleep o @@ -543,7 +553,7 @@ let (_,mY) = getMapSize m return (pY + (sY/2) + vY > (realToFrac mY)) --- checks the collision between an object and the bottom of the map +-- | checks the collision between an object and the bottom of the map objectBottomMapCollision :: GameObject s -> IOGame t s u v Bool objectBottomMapCollision o = do asleep <- getObjectAsleep o @@ -553,7 +563,7 @@ (_,sY) <- getObjectSize o return (pY - (sY/2) < 0) --- checks the collision between an object and the bottom of the map in the next game cicle +-- | checks the collision between an object and the bottom of the map in the next game cicle objectBottomMapFutureCollision :: GameObject s -> IOGame t s u v Bool objectBottomMapFutureCollision o = do asleep <- getObjectAsleep o @@ -564,7 +574,7 @@ (_,vY) <- getObjectSpeed o return (pY - (sY/2) + vY < 0) --- checks the collision between an object and the right side of the map +-- | checks the collision between an object and the right side of the map objectRightMapCollision :: GameObject s -> IOGame t s u v Bool objectRightMapCollision o = do asleep <- getObjectAsleep o @@ -576,7 +586,7 @@ let (mX,_) = getMapSize m return (pX + (sX/2) > (realToFrac mX)) --- checks the collision between an object and the right side of the map in the next game cicle +-- | checks the collision between an object and the right side of the map in the next game cicle objectRightMapFutureCollision :: GameObject s -> IOGame t s u v Bool objectRightMapFutureCollision o = do asleep <- getObjectAsleep o @@ -589,7 +599,7 @@ let (mX,_) = getMapSize m return (pX + (sX/2) + vX > (realToFrac mX)) --- checks the collision between an object and the left side of the map +-- | checks the collision between an object and the left side of the map objectLeftMapCollision :: GameObject s -> IOGame t s u v Bool objectLeftMapCollision o = do asleep <- getObjectAsleep o @@ -599,7 +609,7 @@ (sX,_) <- getObjectSize o return (pX - (sX/2) < 0) --- checks the collision between an object and the left side of the map in the next game cicle +-- | checks the collision between an object and the left side of the map in the next game cicle objectLeftMapFutureCollision :: GameObject s -> IOGame t s u v Bool objectLeftMapFutureCollision o = do asleep <- getObjectAsleep o @@ -610,7 +620,7 @@ (vX,_) <- getObjectSpeed o return (pX - (sX/2) + vX < 0) --- checks the collision between two objects +-- | checks the collision between two objects objectsCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool objectsCollision o1 o2 = do asleep1 <- getObjectAsleep o1 @@ -634,7 +644,7 @@ return ((bX1 < aX2) && (aX1 < bX2) && (bY1 < aY2) && (aY1 < bY2)) --- checks the collision between two objects in the next game cicle +-- | checks the collision between two objects in the next game cicle objectsFutureCollision :: GameObject s -> GameObject s -> IOGame t s u v Bool objectsFutureCollision o1 o2 = do asleep1 <- getObjectAsleep o1 @@ -705,17 +715,17 @@ ----------------------------------------------- -- TEXT ROUTINES -- ----------------------------------------------- --- prints a string in the prompt +-- | prints a string in the prompt printOnPrompt :: Show a => a -> IOGame t s u v () printOnPrompt a = liftIOtoIOGame' print a --- prints a string in the current window +-- | prints a string in the current window printOnScreen :: String -> BitmapFont -> (GLdouble,GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v () printOnScreen text font pos r g b = do t <- getTextList setTextList ([(text,font,pos,r,g,b)] ++ t) --- internal use of the engine +-- | internal use of the engine printText :: IOGame t s u v () printText = do t <- getTextList @@ -738,7 +748,7 @@ -- DEBUGGING ROUTINES -- ----------------------------------------------- --- shows the frame rate (or frame per seconds) +-- | shows the frame rate (or frame per seconds) showFPS :: BitmapFont -> (GLdouble,GLdouble) -> GLclampf -> GLclampf -> GLclampf -> IOGame t s u v () showFPS font pos r g b = do (framei,timebasei,fps) <- getFpsInfo @@ -751,10 +761,11 @@ else setFpsInfo ((framei + 1),timebasei,fps) printOnScreen (printf "%.1f" fps) font pos r g b --- get the elapsed time of the game +-- | get the elapsed time of the game getElapsedTime :: IOGame t s u v Int getElapsedTime = liftIOtoIOGame $ get elapsedTime +-- | delay for N seconds while continuing essential game functions wait :: Int -> IOGame t s u v () wait delay = do printText -- force text messages to be printed (is not working properly!)
Graphics/UI/Fungen/Init.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains the initialization procedures. -} @@ -15,6 +16,7 @@ module Graphics.UI.Fungen.Init ( funInit + ,funExit )where import Graphics.UI.Fungen.Types @@ -27,8 +29,19 @@ import Graphics.UI.Fungen.Timer import Graphics.Rendering.OpenGL import Graphics.UI.GLUT +import System.Exit -funInit :: WindowConfig -> GameMap v -> [(ObjectManager s)] -> u -> t -> [InputBinding t s u v] -> IOGame t s u v () -> RefreshType -> FilePictureList -> IO () +-- | Build a FunGEn game and start it running. +funInit :: WindowConfig -- ^ main window config + -> GameMap v -- ^ background tile map + -> [(ObjectManager s)] -- ^ object (sprite) groups + -> u -- ^ initial game state + -> t -- ^ initial game attribute + -> [InputBinding t s u v] -- ^ input bindings + -> IOGame t s u v () -- ^ step action + -> RefreshType -- ^ timing type + -> FilePictureList -- ^ image files to load + -> IO () funInit winConfig@((px,py),(sx,sy),t) userMap objectGroups gState gAttrib i gameCicle r picList = do initialize "FunGen app" [] createWindow t -- (return ()) [ Double, RGBA ] @@ -52,4 +65,9 @@ loadIdentity ortho 0.0 (fromIntegral sx) 0.0 (fromIntegral sy) (-1.0) 1.0 matrixMode $= Modelview 0 - loadIdentity+ loadIdentity + +-- | Exit the program successfully. +funExit :: IOGame t s u v () +funExit = liftIOtoIOGame' exitWith ExitSuccess +
Graphics/UI/Fungen/Input.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module controls the user input (mouse, keyboard, joystick...) -} @@ -15,7 +16,7 @@ module Graphics.UI.Fungen.Input ( InputBinding, InputHandler, - Key(..), KeyEvent(..), SpecialKey(..), MouseButton(..), Modifiers(..), Position(..), + KeyEvent(..), Key(..), SpecialKey(..), MouseButton(..), Modifiers(..), Position(..), funBinding ) where @@ -23,10 +24,10 @@ import Graphics.UI.GLUT import Graphics.UI.GLUT.Input (KeyEvent(..), KeyBinder, StillDownHandler, initGLUTInput) --- | A FunGEn input handler (which we use instead of GLUTInput's) is --- an IOGame (game action) that takes two extra arguments: the current --- keyboard modifiers state, and the current mouse position. (For a StillDown --- event, these will be the original state and position from the Press event.) +-- | A FunGEn input handler is like an IOGame (game action) that takes +-- two extra arguments: the current keyboard modifiers state, and the +-- current mouse position. (For a StillDown event, these will be the +-- original state and position from the Press event.) type InputHandler t s u v = Modifiers -> Position -> IOGame t s u v () -- | A mapping from an input event to an input handler.
Graphics/UI/Fungen/Loader.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module loads [bmp] files. -} @@ -15,7 +16,7 @@ module Graphics.UI.Fungen.Loader ( loadBitmap, loadBitmapList, FilePictureList -)where +) where import Graphics.Rendering.OpenGL import System.IO @@ -30,7 +31,7 @@ type BmpList = [(GLubyte, GLubyte, GLubyte, GLubyte)] type FilePictureList = [(FilePath,InvList)] ---loads a bitmap from a file +-- | Loads a bitmap from a file. loadBitmap :: FilePath -> Maybe ColorList3 -> IO AwbfBitmap loadBitmap bmName invList = do bmFile <- openBinaryFile bmName (ReadMode) @@ -40,7 +41,7 @@ hClose bmFile return (bmW,bmH,bmData) - -- loads n bitmaps from n files +-- | Loads n bitmaps from n files. loadBitmapList :: [(FilePath, Maybe ColorList3)] -> IO [AwbfBitmap] loadBitmapList bmps = do bmList <- loadBmListAux bmps []
Graphics/UI/Fungen/Map.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains the map (game background) routines. -} @@ -14,15 +15,18 @@ -} module Graphics.UI.Fungen.Map ( - GameMap, - Tile, TileMatrix, - getTilePictureIndex, getTileBlocked, getTileMoveCost, getTileSpecialAttribute, - colorMap, textureMap, tileMap, multiMap, - getMapSize, - isTileMap, getTileMapTileMatrix, getTileMapScroll, getTileMapSize, getTileMapTileSize, - getCurrentMap, updateCurrentMap, updateCurrentIndex, isMultiMap, - drawGameMap, clearGameScreen -)where + GameMap, Tile, TileMatrix, + -- ** creating + colorMap, textureMap, tileMap, multiMap, + -- ** map attributes + isTileMap, isMultiMap, getMapSize, getTileMapTileMatrix, getTileMapScroll, getTileMapSize, getTileMapTileSize, + -- ** map tiles + getTilePictureIndex, getTileBlocked, getTileMoveCost, getTileSpecialAttribute, + -- ** setting the current map + getCurrentMap, updateCurrentMap, updateCurrentIndex, + -- ** drawing + drawGameMap, clearGameScreen, +) where import Graphics.UI.Fungen.Types import Graphics.UI.Fungen.Util @@ -46,7 +50,7 @@ getMapSize (MultiMap _ _) = error "Map.getMapSize error: getMapSize cannot be applied with MultiMaps!" ---------------------------- --- special TileMap routines +-- * special TileMap routines ---------------------------- isTileMap :: GameMap t -> Bool @@ -71,7 +75,7 @@ ------------------------------ --- get routines for a Tile +-- * get routines for a Tile ------------------------------ getTilePictureIndex :: Tile t -> Int @@ -88,7 +92,7 @@ ------------------------------- --- get routines for a MultiMap +-- * get routines for a MultiMap ------------------------------- getCurrentMap :: GameMap t -> GameMap t @@ -115,25 +119,25 @@ updateCurrentIndex _ _ = error "Map.updateCurrentIndex error: the game map is not a MultiMap!" ----------------------------- --- creation of maps +-- * creation of maps ----------------------------- --- creates a PreColorMap +-- | creates a PreColorMap colorMap :: GLclampf -> GLclampf -> GLclampf -> GLdouble -> GLdouble -> GameMap t colorMap r g b sX sY = ColorMap (Color4 r g b 1.0) (sX,sY) --- creates a PreTextureMap +-- | creates a PreTextureMap textureMap :: Int -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameMap t textureMap texId tX tY sX sY = TextureMap texId (tX,tY) (0,0) (0,0) (sX,sY) --- creates a PreTileMap, cheking if the tileMatrix given is valid and automatically defining the map size +-- | creates a PreTileMap, cheking if the tileMatrix given is valid and automatically defining the map size tileMap :: TileMatrix t -> GLdouble -> GLdouble -> GameMap t tileMap matrix tX tY | matrixOk matrix = TileMap matrix (tX,tY) (0,0) (0,0) (sX,sY) | otherwise = error "Map.tileMap error: each line of your TileMap must have the same number of tiles!" where sX = ((fromIntegral.length.head) matrix) * tX sY = ((fromIntegral.length) matrix) * tY --- creates a multimap +-- | creates a multimap multiMap :: [(GameMap t)] -> Int -> GameMap t multiMap [] _ = error "Map.multiMap error: the MultiMap map list should not be empty!" multiMap mapList currentMap | (currentMap >= (length mapList)) = error "Map.multiMap error: map index out of range!" @@ -146,7 +150,7 @@ mapListContainsMultiMap (a:as) | (isMultiMap a) = True | otherwise = mapListContainsMultiMap as --- cheks if the tile matrix is a square matrix +-- checks if the tile matrix is a square matrix matrixOk :: TileMatrix t -> Bool matrixOk [] = False matrixOk (m:ms) = matrixOkAux (length m) ms @@ -158,14 +162,16 @@ ---------------------------------------- --- MAP DRAWING ROUTINES -- +-- * map drawing ---------------------------------------- + +-- | clear the screen clearGameScreen :: GLclampf -> GLclampf -> GLclampf -> IO () clearGameScreen r g b = do clearColor $= (Color4 r g b 1.0) clear [ColorBuffer] --- draws the background map +-- | draw the background map drawGameMap :: GameMap t -> Point2D -> [TextureObject] -> IO () drawGameMap (ColorMap c _) _ _ = do clearColor $= c
Graphics/UI/Fungen/Objects.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This module contains the FunGEn objects procedures -} @@ -13,19 +14,29 @@ -} module Graphics.UI.Fungen.Objects ( - GameObject, - getGameObjectId, getGameObjectName, getGameObjectManagerName, getGameObjectAsleep, getGameObjectPosition, getGameObjectSize, getGameObjectSpeed, getGameObjectAttribute, - getObjectManagerName, getObjectManagerCounter , getObjectManagerObjects, - ObjectPicture(..), Primitive(..), - FillMode (..), - object, drawGameObjects, drawGameObject, - objectGroup, ObjectManager, - findObjectFromId, searchObjectManager, searchGameObject, - updateObject, updateObjectAsleep, updateObjectSize, updateObjectPosition, - updateObjectSpeed, updateObjectAttribute, updateObjectPicture, - addObjectsToManager, - moveGameObjects, - destroyGameObject + ObjectManager, + GameObject, + ObjectPicture(..), Primitive(..), + FillMode (..), + -- ** creating + object, + -- ** object attributes + getGameObjectId, getGameObjectName, getGameObjectManagerName, getGameObjectAsleep, + getGameObjectPosition, getGameObjectSize, getGameObjectSpeed, getGameObjectAttribute, + -- ** updating + updateObject, updateObjectAsleep, updateObjectSize, updateObjectPosition, + updateObjectSpeed, updateObjectAttribute, updateObjectPicture, + -- ** drawing + drawGameObjects, drawGameObject, + -- ** moving + moveGameObjects, + -- ** destroying + destroyGameObject, + -- ** groups of objects + objectGroup, addObjectsToManager, + getObjectManagerName, getObjectManagerCounter , getObjectManagerObjects, + -- ** searching + findObjectFromId, searchObjectManager, searchGameObject, ) where import Graphics.UI.Fungen.Types
Graphics/UI/Fungen/Text.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains some functions to print text on the screen. Fonts supported: Bitmap9By15, Bitmap8By13, BitmapTimesRoman10, BitmapTimesRoman24 @@ -16,17 +17,19 @@ -} module Graphics.UI.Fungen.Text ( - Text, BitmapFont(..), + Text, putGameText ) where import Graphics.UI.GLUT +import Graphics.UI.Fungen.Types import Graphics.Rendering.OpenGL -type Text = (String,BitmapFont,(GLdouble,GLdouble),GLclampf,GLclampf,GLclampf) +-- | String to be printed, font, screen position, color RGB. +type Text = (String,BitmapFont,Point2D,GLclampf,GLclampf,GLclampf) --- string to be printed, type of font, screen position, color RGB +-- | Display these texts on screen. putGameText :: [Text] -> IO () putGameText [] = return () putGameText ((text,font,(x,y),r,g,b):ts) = do
Graphics/UI/Fungen/Timer.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module controls timing (how time-based functions will behave). -} @@ -21,14 +22,17 @@ import Graphics.UI.GLUT import Graphics.UI.GLUT.Input +-- | Used by 'Graphics.UI.Fungen.funInit' to configure the main loop's timing strategy. data RefreshType = Idle | Timer Int +-- | Change the current timing strategy. setRefresh :: RefreshType -> StillDownHandler -> IO () setRefresh Idle stillDown = idleCallback $= Just (stillDown >> postRedisplay Nothing) setRefresh (Timer t) stillDown = addTimerCallback t (timer stillDown t) +-- | Generate a GLUT timer callback. timer :: StillDownHandler -> Int -> TimerCallback timer stillDown t = do stillDown
Graphics/UI/Fungen/Types.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains the FunGEN basic types. -} {-
Graphics/UI/Fungen/Util.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK hide #-} {- | This FunGEn module contains some auxiliary functions. -} @@ -99,7 +100,7 @@ dropGLsizei n (_:xs) | n>0 = dropGLsizei (n-1) xs dropGLsizei _ _ = error "Util.dropGLsizei error: negative argument" --- to be used when no invisibility must be added when loading a file +-- | to be used when no invisibility must be added when loading a file addNoInvisibility :: [FilePath] -> [(FilePath, Maybe ColorList3)] addNoInvisibility [] = [] addNoInvisibility (a:as) = (a, Nothing):(addNoInvisibility as) @@ -120,7 +121,7 @@ matrixToList [] = [] matrixToList (a:as) = a ++ (matrixToList as) --- return the max indexes of a matrix (assumed that its lines have the same length) +-- | return the max indexes of a matrix (assumed that its lines have the same length) matrixSize :: [[a]] -> (Int,Int) matrixSize [] = (0,0) matrixSize m@(a:_) = ((length m) - 1,(length a) - 1)
Graphics/UI/GLUT/Input.hs view
@@ -1,3 +1,4 @@+-- {-# OPTIONS_HADDOCK hide #-} {- | GLUT-based keyboard/mouse handling.
README.md view
@@ -71,6 +71,10 @@ ## Release notes +### 0.4.1 (2013/08/06)++* reorganised and exposed more haddocks+ ### 0.4 (2013/08/05) * a new hakyll-based website, incorporating the old site