-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings to libtcod roguelike engine -- -- Haskell bindings for popular library for making roguelike games @package tcod-haskell @version 0.2.0.0 module Game.TCOD.FovTypes -- | Supported FOV algorithms data TCODFovAlgorithm -- | -- http://roguebasin.roguelikedevelopment.org/index.php?title=Ray_casting FovBasic :: TCODFovAlgorithm -- | http://www.geocities.com/temerra/los_rays.html FovDiamond :: TCODFovAlgorithm -- | -- http://roguebasin.roguelikedevelopment.org/index.php?title=FOV_using_recursive_shadowcasting FovShadow :: TCODFovAlgorithm -- | -- http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Permissive_Field_of_View FovPermissive0 :: TCODFovAlgorithm FovPermissive1 :: TCODFovAlgorithm FovPermissive2 :: TCODFovAlgorithm FovPermissive3 :: TCODFovAlgorithm FovPermissive4 :: TCODFovAlgorithm FovPermissive5 :: TCODFovAlgorithm FovPermissive6 :: TCODFovAlgorithm FovPermissive7 :: TCODFovAlgorithm FovPermissive8 :: TCODFovAlgorithm -- | Mingos' Restrictive Precise Angle Shadowcasting (contribution by -- Mingos) FovRestrictive :: TCODFovAlgorithm instance GHC.Generics.Generic Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Enum.Bounded Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Read.Read Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Show.Show Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Enum.Enum Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Classes.Ord Game.TCOD.FovTypes.TCODFovAlgorithm instance GHC.Classes.Eq Game.TCOD.FovTypes.TCODFovAlgorithm -- | Where we define C-side types to handle in inline-c module Game.TCOD.Context tcodContext :: Context -- | 24 bit color data Color Color :: {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> Color [colorR] :: Color -> {-# UNPACK #-} !Word8 [colorG] :: Color -> {-# UNPACK #-} !Word8 [colorB] :: Color -> {-# UNPACK #-} !Word8 -- | TCOD heighmap object is represented via 2-dimensional array newtype TCODHeightMap TCODHeightMap :: Array F DIM2 CFloat -> TCODHeightMap [unTCODHeightMap] :: TCODHeightMap -> Array F DIM2 CFloat -- | Dice roll data Dice Dice :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> Dice [diceNbRolls] :: Dice -> {-# UNPACK #-} !Int [diceNbFaces] :: Dice -> {-# UNPACK #-} !Int [diceMultiplier] :: Dice -> {-# UNPACK #-} !Double [diceAddSub] :: Dice -> {-# UNPACK #-} !Double -- | Mouse event data data TCODMouse TCODMouse :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> TCODMouse -- | Absolute X position [mouseX] :: TCODMouse -> !Int -- | Absolute Y position [mouseY] :: TCODMouse -> !Int -- | Movement X since last update in pixels [mouseDx] :: TCODMouse -> !Int -- | Movement Y since last update in pixels [mouseDy] :: TCODMouse -> !Int -- | Cell X coordinate in the root console [mouseCx] :: TCODMouse -> !Int -- | Cell Y coordinate in the root console [mouseCy] :: TCODMouse -> !Int -- | Movement X since last update in console cells [mouseDcx] :: TCODMouse -> !Int -- | Movement Y since last update in console cells [mouseDcy] :: TCODMouse -> !Int -- | Left button status [mouseLButton] :: TCODMouse -> !Bool -- | Right button status [mouseRButton] :: TCODMouse -> !Bool -- | Middle button status [mouseMButton] :: TCODMouse -> !Bool -- | Left button pressed event [mouseLButtonPressed] :: TCODMouse -> !Bool -- | Right button pressed event [mouseRButtonPressed] :: TCODMouse -> !Bool -- | Middle button pressed event [mouseMButtonPressed] :: TCODMouse -> !Bool -- | Wheel up event [mouseWheelUp] :: TCODMouse -> !Bool -- | Wheel down event [mouseWheelDown] :: TCODMouse -> !Bool context :: Context -> DecsQ include :: String -> DecsQ verbatim :: String -> DecsQ exp :: QuasiQuoter block :: QuasiQuoter funCtx :: Context instance GHC.Generics.Generic Game.TCOD.Context.TCODMouse instance GHC.Show.Show Game.TCOD.Context.TCODMouse instance GHC.Classes.Eq Game.TCOD.Context.TCODMouse instance GHC.Generics.Generic Game.TCOD.Context.Dice instance GHC.Show.Show Game.TCOD.Context.Dice instance GHC.Classes.Eq Game.TCOD.Context.Dice instance GHC.Generics.Generic Game.TCOD.Context.Color instance GHC.Show.Show Game.TCOD.Context.Color instance GHC.Classes.Ord Game.TCOD.Context.Color instance GHC.Classes.Eq Game.TCOD.Context.Color module Game.TCOD.Fov -- | Map reference for FOV algorithm newtype TCODMap TCODMap :: Ptr () -> TCODMap [unTCODMap] :: TCODMap -> Ptr () -- | Creating the map object -- -- First, you have to allocate a map of the same size as your dungeon. mapNew :: Int -> Int -> IO TCODMap -- | Clearing the map -- -- You can clear an existing map (setting all cells to the chosen -- walkable/transparent values) mapClear :: TCODMap -> Bool -> Bool -> IO () -- | Copy a map to another, reallocating it when needed mapCopy :: TCODMap -> TCODMap -> IO () -- | Defining the cell properties -- -- Then, build your dungeon by defining which cells let the light pass -- (by default, all cells block the light) and which cells are walkable -- (by default, all cells are not-walkable). mapSetProperties :: TCODMap -> Int -> Int -> Bool -> Bool -> IO () -- | Destroy a map mapDelete :: TCODMap -> IO () -- | Computing the field of view -- -- Once your map is allocated and empty cells have been defined, you can -- calculate the field of view mapComputeFov :: TCODMap -> Int -> Int -> Int -> Bool -> TCODFovAlgorithm -> IO () -- | Check if a cell is in the last computed field of view mapIsInFov :: TCODMap -> Int -> Int -> IO Bool -- | Manually setting a cell in fov mapSetInFov :: TCODMap -> Int -> Int -> Bool -> IO () -- | Getting transparency flag for cell mapIsTransparent :: TCODMap -> Int -> Int -> IO Bool -- | Getting walkability flag for cell mapIsWalkable :: TCODMap -> Int -> Int -> IO Bool -- | Getting width of the map mapGetWidth :: TCODMap -> IO Int -- | Getting height of the map mapGetHeight :: TCODMap -> IO Int -- | Getting number of cells of the map mapGetNumberCells :: TCODMap -> IO Int instance GHC.Generics.Generic Game.TCOD.Fov.TCODMap instance GHC.Show.Show Game.TCOD.Fov.TCODMap instance GHC.Classes.Ord Game.TCOD.Fov.TCODMap instance GHC.Classes.Eq Game.TCOD.Fov.TCODMap module Game.TCOD.HeightmapInst instance Foreign.Storable.Storable Game.TCOD.Context.TCODHeightMap module Game.TCOD.List -- | This is a fast, lightweight and generic container, that provides -- array, list and stack paradigms. newtype TCODList a TCODList :: Ptr () -> TCODList a [unTCODList] :: TCODList a -> Ptr () -- | Creating a list listNew :: IO (TCODList a) -- | You can also create an empty list and pre-allocate memory for -- elements. Use this if you know the list size and want the memory to -- fit it perfectly. listAllocate :: Int -> IO (TCODList a) -- | You can create a list by duplicating an existing list. listDuplicated :: TCODList a -> IO (TCODList a) -- | You can delete a list, freeing any allocated resources. Note that -- deleting the list does not delete it's elements. You have to use -- clearAndDelete before deleting the list if you want to destroy the -- elements too. listDelete :: TCODList a -> IO () -- | You can push an element on the stack (append it to the end of the -- list) listPush :: Storable a => TCODList a -> a -> IO () -- | You can push an element on the stack (append it to the end of the -- list) listPushPtr :: TCODList a -> Ptr a -> IO () -- | You can pop an element from the stack (remove the last element of the -- list). listPop :: Storable a => TCODList a -> IO (Maybe a) -- | You can pop an element from the stack (remove the last element of the -- list). listPopPtr :: TCODList a -> IO (Ptr a) -- | You can read the last element of the stack without removing it : listPeek :: Storable a => TCODList a -> IO (Maybe a) -- | You can read the last element of the stack without removing it : listPeekPtr :: TCODList a -> IO (Ptr a) -- | You can concatenate two lists. Every element of l2 will be added to -- current list listAddAll :: TCODList a -> TCODList a -> IO () -- | You can retrieve a value with get. listGet :: Storable a => TCODList a -> Int -> IO (Maybe a) -- | You can retrieve a value with get. listGetPtr :: TCODList a -> Int -> IO (Ptr a) -- | You can assign a value with set. If needed, the array will allocate -- new elements up to idx. listSet :: Storable a => TCODList a -> a -> Int -> IO () -- | You can assign a value with set. If needed, the array will allocate -- new elements up to idx. listSetPtr :: TCODList a -> Ptr a -> Int -> IO () -- | You can iterate through the elements of the list using an iterator. -- begin() returns the address of the first element of the list. You go -- to the next element using the increment operator ++. When the -- iterator's value is equal to end(), you've gone through all the -- elements. -- -- Warning ! You cannot insert elements in the list while iterating -- through it. Inserting elements can result in reallocation of the list -- and your iterator will not longer be valid. listBeginPtr :: TCODList a -> IO (Ptr (Ptr a)) -- | You can iterate through the elements of the list using an iterator. -- begin() returns the address of the first element of the list. You go -- to the next element using the increment operator ++. When the -- iterator's value is equal to end(), you've gone through all the -- elements. -- -- Warning ! You cannot insert elements in the list while iterating -- through it. Inserting elements can result in reallocation of the list -- and your iterator will not longer be valid. listEndPtr :: TCODList a -> IO (Ptr (Ptr a)) -- | This function reverses the order of the elements in the list. listReverse :: TCODList a -> IO () -- | You can remove an element from the list while iterating. The element -- at the iterator position will be removed. The function returns the new -- iterator. The _fast versions replace the element to remove with the -- last element of the list. They're faster, but do not preserve the list -- order. listRemoveIterator :: TCODList a -> Ptr (Ptr a) -> IO (Ptr (Ptr a)) -- | You can remove an element from the list while iterating. The element -- at the iterator position will be removed. The function returns the new -- iterator. The _fast versions replace the element to remove with the -- last element of the list. They're faster, but do not preserve the list -- order. listRemoveIteratorFast :: TCODList a -> Ptr (Ptr a) -> IO (Ptr (Ptr a)) -- | Removing an element from the list listRemovePtr :: TCODList a -> Ptr a -> IO () -- | Removing an element from the list listRemove :: Storable a => TCODList a -> a -> IO () -- | The _fast versions replace the element to remove with the last element -- of the list. They're faster, but do not preserve the list order. listRemoveFastPtr :: TCODList a -> Ptr a -> IO () -- | The _fast versions replace the element to remove with the last element -- of the list. They're faster, but do not preserve the list order. listRemoveFast :: Storable a => TCODList a -> a -> IO () -- | Checking if an element is in the list listContainsPtr :: TCODList a -> Ptr a -> IO Bool -- | Checking if an element is in the list listContains :: Storable a => TCODList a -> a -> IO Bool -- | Emptying a list listClear :: TCODList a -> IO () -- | For lists containing pointers, you can clear the list and delete (or -- free for C) the elements : listClearAndDelete :: TCODList a -> IO () -- | Getting the list size listSize :: TCODList a -> IO Int -- | Insert an element in the list listInsertBeforePtr :: TCODList a -> Ptr a -> Int -> IO (Ptr (Ptr a)) -- | Insert an element in the list listInsertBefore :: Storable a => TCODList a -> a -> Int -> IO (Ptr (Ptr a)) -- | Checking if a list is empty listIsEmpty :: TCODList a -> IO Bool -- | Load to Haskell list O(N) listToList :: forall a. Storable a => TCODList a -> IO [a] -- | Unload Haskell list to TCOD container O(N) listFromList :: forall a f. (Foldable f, Storable a) => f a -> IO (TCODList a) -- | Convert TCOD list to Haskell storable vector. O(1) -- -- Note: The vector reuses memory of the list and valid until the TCOD -- list is not deleted or reallocated (due mutation). listToVectorUnsafe :: forall a. Storable a => TCODList a -> IO (Vector a) -- | Convert TCOD list to Haskell storable vector. O(N) -- -- Note: The vector content is copied into haskell heap. listToVector :: forall a. Storable a => TCODList a -> IO (Vector a) instance GHC.Generics.Generic (Game.TCOD.List.TCODList a) instance GHC.Show.Show (Game.TCOD.List.TCODList a) instance GHC.Classes.Ord (Game.TCOD.List.TCODList a) instance GHC.Classes.Eq (Game.TCOD.List.TCODList a) module Game.TCOD.MersenneTypes -- | Reference to TCOD pseudo random generator newtype TCODRandom TCODRandom :: Ptr () -> TCODRandom [unTCODRandom] :: TCODRandom -> Ptr () -- | Dice roll data Dice Dice :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> Dice [diceNbRolls] :: Dice -> {-# UNPACK #-} !Int [diceNbFaces] :: Dice -> {-# UNPACK #-} !Int [diceMultiplier] :: Dice -> {-# UNPACK #-} !Double [diceAddSub] :: Dice -> {-# UNPACK #-} !Double -- | Pseudo random number algorithm data RandomAlgorithm -- | a Mersenne twister generator RngMT :: RandomAlgorithm -- | a Complementary-Multiply-With-Carry generator. RngCMWC :: RandomAlgorithm -- | Random number distribution laws data Distribution -- | This is the default distribution. It will return a number from a range -- min-max. The numbers will be evenly distributed, ie, each number from -- the range has the exact same chance of being selected. DistributionLinear :: Distribution -- | This distribution does not have minimum and maximum values. Instead, a -- mean and a standard deviation are used. The mean is the central value. -- It will appear with the greatest frequency. The farther away from the -- mean, the less the probability of appearing the possible results have. -- Although extreme values are possible, 99.7% of the results will be -- within the radius of 3 standard deviations from the mean. So, if the -- mean is 0 and the standard deviation is 5, the numbers will mostly -- fall in the (-15,15) range. DistributionGaussian :: Distribution -- | This one takes minimum and maximum values. Under the hood, it computes -- the mean (which falls right between the minimum and maximum) and the -- standard deviation and applies a standard Gaussian distribution to the -- values. The difference is that the result is always guaranteed to be -- in the min-max range. DistributionGaussianRange :: Distribution -- | Essentially, this is the same as DistributionGaussian. The -- difference is that the values near +3 and -3 standard deviations from -- the mean have the highest possibility of appearing, while the mean has -- the lowest. DistributionGaussianInverse :: Distribution -- | Essentially, this is the same as DistributionGaussianRange, but -- the min and max values have the greatest probability of appearing, -- while the values between them, the lowest. DistributionGaussianRangeInverse :: Distribution instance GHC.Generics.Generic Game.TCOD.MersenneTypes.Distribution instance GHC.Enum.Bounded Game.TCOD.MersenneTypes.Distribution instance GHC.Enum.Enum Game.TCOD.MersenneTypes.Distribution instance GHC.Read.Read Game.TCOD.MersenneTypes.Distribution instance GHC.Show.Show Game.TCOD.MersenneTypes.Distribution instance GHC.Classes.Ord Game.TCOD.MersenneTypes.Distribution instance GHC.Classes.Eq Game.TCOD.MersenneTypes.Distribution instance GHC.Generics.Generic Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Enum.Bounded Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Enum.Enum Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Read.Read Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Show.Show Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Classes.Ord Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Classes.Eq Game.TCOD.MersenneTypes.RandomAlgorithm instance GHC.Generics.Generic Game.TCOD.MersenneTypes.TCODRandom instance GHC.Show.Show Game.TCOD.MersenneTypes.TCODRandom instance GHC.Classes.Ord Game.TCOD.MersenneTypes.TCODRandom instance GHC.Classes.Eq Game.TCOD.MersenneTypes.TCODRandom instance Foreign.Storable.Storable Game.TCOD.Context.Dice module Game.TCOD.MouseTypes -- | Mouse event data data TCODMouse TCODMouse :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> TCODMouse -- | Absolute X position [mouseX] :: TCODMouse -> !Int -- | Absolute Y position [mouseY] :: TCODMouse -> !Int -- | Movement X since last update in pixels [mouseDx] :: TCODMouse -> !Int -- | Movement Y since last update in pixels [mouseDy] :: TCODMouse -> !Int -- | Cell X coordinate in the root console [mouseCx] :: TCODMouse -> !Int -- | Cell Y coordinate in the root console [mouseCy] :: TCODMouse -> !Int -- | Movement X since last update in console cells [mouseDcx] :: TCODMouse -> !Int -- | Movement Y since last update in console cells [mouseDcy] :: TCODMouse -> !Int -- | Left button status [mouseLButton] :: TCODMouse -> !Bool -- | Right button status [mouseRButton] :: TCODMouse -> !Bool -- | Middle button status [mouseMButton] :: TCODMouse -> !Bool -- | Left button pressed event [mouseLButtonPressed] :: TCODMouse -> !Bool -- | Right button pressed event [mouseRButtonPressed] :: TCODMouse -> !Bool -- | Middle button pressed event [mouseMButtonPressed] :: TCODMouse -> !Bool -- | Wheel up event [mouseWheelUp] :: TCODMouse -> !Bool -- | Wheel down event [mouseWheelDown] :: TCODMouse -> !Bool -- | Get TCODMouse with default values defaultTCODMouse :: TCODMouse instance Foreign.Storable.Storable Game.TCOD.Context.TCODMouse -- | This tool allows one to generate random names out of custom made -- syllable sets. module Game.TCOD.NameGen -- | Reference to name generator state newtype TCODNameGen TCODNameGen :: Ptr () -> TCODNameGen [unTCODNameGen] :: TCODNameGen -> Ptr () -- | Parse a file with syllable sets -- -- In order to be able to generate names, the name generator needs to be -- fed proper data. It will then be ready to generate random names -- defined in the file(s) it is fed. Syllable set parsing is achieved via -- the following. -- -- Note 1: Each file will be parsed once only. If, for some reason, you -- would like to parse the same file twice, you will need to destroy the -- generator first, which will empty the list of parsed files along with -- erasing all the data retrieved from those files. -- -- Note 2: The generator can be fed data multiple times if you have it in -- separate files. Just make sure the structure names in them aren't -- duplicated, otherwise they will be silently ignored. namegenParse :: FilePath -> TCODRandom -> IO () -- | Destroy name generator namegenDestroy :: IO () -- | Generating a default name -- -- The following will output a random name generated using one of the -- generation rules specified in the syllable set: The name you specify -- needs to be in one of the files the generator has previously parsed -- (see Creating a generator). If such a name doesn't exist, a warning -- will be displayed and NULL will be returned. namegenGenerate :: String -> IO (Maybe String) -- | Generating a custom name -- -- It is also possible to generate a name using custom generation rules. -- This overrides the random choice of a generation rule from the -- syllable set. Please refer to tcod docs chapter 16.5 to learn about -- the name generation rules syntax. namegenGenerateCustom :: String -> String -> IO (Maybe String) -- | Retrieve the list of all available syllable set names namegenGetSets :: IO (TCODList String) instance GHC.Generics.Generic Game.TCOD.NameGen.TCODNameGen instance GHC.Show.Show Game.TCOD.NameGen.TCODNameGen instance GHC.Classes.Ord Game.TCOD.NameGen.TCODNameGen instance GHC.Classes.Eq Game.TCOD.NameGen.TCODNameGen module Game.TCOD.Noise -- | Reference to TCOD noise object newtype TCODNoise TCODNoise :: Ptr () -> TCODNoise [unTCODNoise] :: TCODNoise -> Ptr () -- | Supported noise generator types data TCODNoiseType NoiseDefault :: TCODNoiseType NoisePerlin :: TCODNoiseType NoiseSimplex :: TCODNoiseType NoiseWavelet :: TCODNoiseType noiseMaxOctaves :: Int noiseMaxDimensions :: Int noiseDefaultHurst :: Double noiseDefaultLacunarity :: Double -- | Create a new noise object noiseNew :: Int -> Double -> Double -> TCODRandom -> IO TCODNoise -- | Delete noise object noiseDelete :: TCODNoise -> IO () -- | Choosing a noise type -- -- Use this function to define the default algorithm used by the noise -- functions. The default algorithm is simplex. It's much faster than -- Perlin, especially in 4 dimensions. It has a better contrast too. noiseSetType :: TCODNoise -> TCODNoiseType -> IO () -- | Getting flat noise -- -- his function returns the noise function value between -1.0 and 1.0 at -- given coordinates. noiseGetEx :: TCODNoise -> Vector Double -> TCODNoiseType -> IO Double -- | This function returns the fbm function value between -1.0 and 1.0 at -- given coordinates, using fractal hurst and lacunarity defined when the -- generator has been created. noiseGetFbmEx :: TCODNoise -> Vector Double -> Float -> TCODNoiseType -> IO Float -- | Getting turbulence -- -- This function returns the turbulence function value between -1.0 and -- 1.0 at given coordinates, using fractal hurst and lacunarity defined -- when the generator has been created. noiseGetTurbulenceEx :: TCODNoise -> Vector Double -> Float -> TCODNoiseType -> IO Float -- | Getting flat noise -- -- his function returns the noise function value between -1.0 and 1.0 at -- given coordinates. noiseGet :: TCODNoise -> Vector Double -> IO Double -- | This function returns the fbm function value between -1.0 and 1.0 at -- given coordinates, using fractal hurst and lacunarity defined when the -- generator has been created. noiseGetFbm :: TCODNoise -> Vector Double -> Float -> IO Float -- | Getting turbulence -- -- This function returns the turbulence function value between -1.0 and -- 1.0 at given coordinates, using fractal hurst and lacunarity defined -- when the generator has been created. noiseGetTurbulence :: TCODNoise -> Vector Double -> Float -> IO Float instance GHC.Generics.Generic Game.TCOD.Noise.TCODNoiseType instance GHC.Enum.Bounded Game.TCOD.Noise.TCODNoiseType instance GHC.Enum.Enum Game.TCOD.Noise.TCODNoiseType instance GHC.Read.Read Game.TCOD.Noise.TCODNoiseType instance GHC.Show.Show Game.TCOD.Noise.TCODNoiseType instance GHC.Classes.Ord Game.TCOD.Noise.TCODNoiseType instance GHC.Classes.Eq Game.TCOD.Noise.TCODNoiseType instance GHC.Generics.Generic Game.TCOD.Noise.TCODNoise instance GHC.Show.Show Game.TCOD.Noise.TCODNoise instance GHC.Classes.Ord Game.TCOD.Noise.TCODNoise instance GHC.Classes.Eq Game.TCOD.Noise.TCODNoise module Game.TCOD.Heightmap -- | Allocate new heightmap with given sizes heightmapNew :: Int -> Int -> IO TCODHeightMap -- | Destroy inner buffers of heightmap heightmapDelete :: TCODHeightMap -> IO () -- | Get value of heightmap at given point heightmapGetValue :: TCODHeightMap -> Int -> Int -> IO Double -- | This function returns the interpolated height at non integer -- coordinates. heightmapGetInterpolatedValue :: TCODHeightMap -> Double -> Double -> IO Double -- | Once the heightmap has been created, you can do some basic operations -- on the values inside it. heightmapSetValue :: TCODHeightMap -> Int -> Int -> Double -> IO () -- | This function returns the slope between 0 and PI/2 at given -- coordinates. heightmapGetSlope :: TCODHeightMap -> Int -> Int -> IO Double -- | This function returns the map normal at given coordinates. heightmapGetNormal :: TCODHeightMap -> Double -> Double -> Double -> IO (Double, Double, Double) -- | Count the map cells inside a height range -- -- This function returns the number of map cells which value is between -- min and max. heightmapCountCells :: TCODHeightMap -> Double -> Double -> IO Int -- | Check if the map is an island -- -- This function checks if the cells on the map border are below a -- certain height. heightmapHasLandOnBorder :: TCODHeightMap -> Double -> IO Bool -- | Get the map min and max values heightmapGetMinMax :: TCODHeightMap -> IO (Double, Double) -- | Copy contents of heightmap from one to another heightmapCopy :: TCODHeightMap -> TCODHeightMap -> IO () -- | Adding a float value to all cells heightmapAdd :: TCODHeightMap -> Double -> IO () -- | Clamping all values heightmapScale :: TCODHeightMap -> Double -> IO () -- | Clamping all values heightmapClamp :: TCODHeightMap -> Double -> Double -> IO () -- | The whole heightmap is translated and scaled so that the lowest cell -- value becomes min and the highest cell value becomes max heightmapNormalize :: TCODHeightMap -> Double -> Double -> IO () -- | Resetting all values to 0.0 heightmapClear :: TCODHeightMap -> IO () -- | Doing a lerp operation between two heightmaps heightmapLerp :: TCODHeightMap -> TCODHeightMap -> TCODHeightMap -> Double -> IO () -- | Adding two heightmaps heightmapAddHm :: TCODHeightMap -> TCODHeightMap -> TCODHeightMap -> IO () -- | Multiplying values of two heightmaps heightmapMultiplyHm :: TCODHeightMap -> TCODHeightMap -> TCODHeightMap -> IO () -- | Add hills -- -- This function adds a hill (a half spheroid) at given position. heightmapAddHill :: TCODHeightMap -> Double -> Double -> Double -> Double -> IO () -- | Digg hills -- -- This function digs a hill (a half spheroid) at given position. heightmapDigHill :: TCODHeightMap -> Double -> Double -> Double -> Double -> IO () -- | Helper struct for heightmapDigBezier data DigBezier DigBezier :: (Int, Int) -> (Int, Int) -> (Int, Int) -> (Int, Int) -> !Double -> !Double -> !Double -> !Double -> DigBezier [bezierP1] :: DigBezier -> (Int, Int) [bezierP2] :: DigBezier -> (Int, Int) [bezierP3] :: DigBezier -> (Int, Int) [bezierP4] :: DigBezier -> (Int, Int) [bezierStartRadius] :: DigBezier -> !Double [bezierStartDepth] :: DigBezier -> !Double [bezierEndRadius] :: DigBezier -> !Double [bezierEndDepth] :: DigBezier -> !Double -- | Digg hills -- -- This function digs a hill (a half spheroid) at given position. heightmapDigBezier :: TCODHeightMap -> DigBezier -> IO () -- | Simulate rain erosion -- -- This function simulates the effect of rain drops on the terrain, -- resulting in erosion patterns. heightmapRainErosion :: TCODHeightMap -> Int -> Double -> Double -> TCODRandom -> IO () -- | Do a generic transformation -- -- This function allows you to apply a generic transformation on the map, -- so that each resulting cell value is the weighted sum of several -- neighbour cells. This can be used to smooth/sharpen the map. See -- examples below for a simple horizontal smoothing kernel : replace -- value(x,y) with 0.33*value(x-1,y) + 0.33*value(x,y) + -- 0.33*value(x+1,y). -- -- To do this, you need a kernel of size 3 (the sum involves 3 -- surrounding cells). heightmapKernelTransform :: TCODHeightMap -> Int -> Vector Int -> Vector Int -> Vector Double -> Double -> Double -> IO () -- | Add a Voronoi diagram -- -- This function adds values from a Voronoi diagram to the map. heightmapAddVoronoi :: TCODHeightMap -> Int -> Vector Double -> TCODRandom -> IO () -- | Generate a map with mid-point displacement -- -- This algorithm generates a realistic fractal heightmap using the -- href="http://en.wikipedia.org/wiki/Diamond-square_algorithm"diamond-square/a -- (or random midpoint displacement) algorithm. The roughness range -- should be comprised between 0.4 and 0.6. The image below show the same -- map with roughness varying from 0.4 to 0.6. src="midpoint.png" -- / It's also a good habit to normalize the map after using this -- algorithm to avoid unexpected heights. heightmapMidPointDisplacement :: TCODHeightMap -> TCODRandom -> Double -> IO () -- | This function adds values from a simplex fbm function to the map. heightmapAddFbm :: TCODHeightMap -> TCODNoise -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> IO () -- | This function adds values from a simplex fbm function to the map. heightmapScaleFbm :: TCODHeightMap -> TCODNoise -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> IO () -- | Lowers the terrain near the heightmap borders heightmapIslandify :: TCODHeightMap -> Double -> TCODRandom -> IO () -- | This toolkit is an implementation of two fast and high quality -- pseudorandom number generators: * a Mersenne twister generator, * a -- Complementary-Multiply-With-Carry generator. CMWC is faster than MT -- (see table below) and has a much better period (1039460 vs. 106001). -- It is the default algo since libtcod 1.5.0. module Game.TCOD.Mersenne -- | Default generator -- -- The simplest way to get random number is to use the default generator. -- The first time you get this generator, it is initialized by calling -- TCOD_random_new. Then, on successive calls, this function returns the -- same generator (singleton pattern). randomGetInstance :: IO TCODRandom -- | Generators with random seeds -- -- You can also create as many generators as you want with a random seed -- (the number of seconds since Jan 1 1970 at the time the constructor is -- called). Warning ! If you call this function several times in the same -- second, it will return the same generator. randomNew :: RandomAlgorithm -> IO TCODRandom -- | Saving a RNG state into generator-backup randomSave :: TCODRandom -> IO TCODRandom -- | Restoring a saved state -- -- And restore it later. This makes it possible to get the same series of -- number several times with a single generator. randomRestore :: TCODRandom -> TCODRandom -> IO () -- | Generators with user defined seeds -- -- Finally, you can create generators with a specific seed. Those allow -- you to get a reproducible set of random numbers. You can for example -- save a dungeon in a file by saving only the seed used for its -- generation (provided you have a determinist generation algorithm) randomNewFromSeed :: RandomAlgorithm -> Word -> IO TCODRandom -- | Destroying a RNG -- -- To release resources used by a generator, use the function. NB : do -- not delete the default random generator ! randomDelete :: TCODRandom -> IO () -- | Setting the default RNG distribution -- -- Note: See docs for Distribution randomSetDistribution :: TCODRandom -> Distribution -> IO () -- | Getting an integer -- -- Once you obtained a generator (using one of those methods), you can -- get random numbers using the following functions, using either the -- explicit or simplified API where applicable: randomGetInt :: TCODRandom -> Int -> Int -> IO Int -- | Getting a floating point number -- -- Once you obtained a generator (using one of those methods), you can -- get random numbers using the following functions, using either the -- explicit or simplified API where applicable: randomGetDouble :: TCODRandom -> Double -> Double -> IO Double -- | Getting an integer -- -- Once you obtained a generator (using one of those methods), you can -- get random numbers using the following functions, using either the -- explicit or simplified API where applicable: randomGetIntMean :: TCODRandom -> Int -> Int -> Int -> IO Int -- | Getting a floating point number -- -- Once you obtained a generator (using one of those methods), you can -- get random numbers using the following functions, using either the -- explicit or simplified API where applicable: randomGetDoubleMean :: TCODRandom -> Double -> Double -> Double -> IO Double -- | Create dnd-like dice from description string like "3d6+2" randomDiceNew :: String -> IO Dice -- | Roll dice and return resulted dice side randomDiceRoll :: TCODRandom -> Dice -> IO Int -- | Roll dice without initiating, see randomDiceNew randomDiceRollS :: TCODRandom -> String -> IO Int module Game.TCOD.Mouse -- | Display and hide the mouse cursor -- -- By default, the mouse cursor in visible in windowed mode, hidden in -- fullscreen mode. mouseShowCursor :: Bool -> IO () -- | Get the last known mouse cursor position -- -- This function is only valid, and only returns updated values, after -- you have called event-related functions. Whether to check for events, -- or wait for events. It does not provide the actual mouse position at -- the time the call is made. mouseGetStatus :: IO TCODMouse -- | Getting the cursor status mouseIsCursorVisible :: IO Bool -- | Setting the mouse cursor's position -- -- You can set the cursor position (in pixel coordinates, where [0,0] is -- the window's top left corner) mouseMove :: Int -> Int -> IO () -- | Count touches as clicks mouseIncludesTouch :: Bool -> IO () -- | This toolkit allows one to easily calculate the optimal path between -- two points in your dungeon by using either the -- href="http://en.wikipedia.org/wiki/A*"A* algorithm/a or -- href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm"Dijkstra's -- algorithm/a. Please note that the paths generated with the two -- algorithms may differ slightly. Due to how they're implemented, A* -- will usually prefer diagonal moves over orthogonal, while Dijkstra -- will have the opposite preference. In other words, paths from point X -- to point Y will look like this: @ Dijkstra: A*: .......... -- .......... .X........ .X*....... ..*....... ...**..... ...*...... -- .....**... ....****Y. .......*Y. .......... .......... @ module Game.TCOD.Path -- | Callback path function, takes from (x, y) and to (x, y), returns cell -- cost -- -- A custom function that must return the walk cost from coordinates -- xFrom,yFrom to coordinates xTo,yTo. The cost must be > 0.0f if the -- cell xTo,yTo is walkable. It must be equal to 0.0f if it's not. You -- must not take additional cost due to diagonal movements into account -- as it's already done by the pathfinder. type TCODPathFunc = Int -> Int -> Int -> Int -> IO Double -- | C type of TCODPathFunc type TCODPathFuncRaw = CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CFloat -- | Reference to TCOD path finder state data TCODPath TCODPath :: Ptr () -> Maybe (FunPtr TCODPathFuncRaw) -> TCODPath -- | Original pointer | Stored reference to callback that need to be freed -- after cleanup of the path object [unTCODPath] :: TCODPath -> Ptr () [pathHaskFun] :: TCODPath -> Maybe (FunPtr TCODPathFuncRaw) -- | Allocating a pathfinder from a map -- -- First, you have to allocate a path using a map from Fov module. pathNewUsingMap :: TCODMap -> Float -> IO TCODPath -- | Allocating a pathfinder using a callback -- -- Since the walkable status of a cell may depend on a lot of parameters -- (the creature type, the weather, the terrain type...), you can also -- create a path by providing a function rather than relying on a -- TCODMap. pathNewUsingFunction :: Int -> Int -> TCODPathFunc -> Float -> IO TCODPath -- | To release the resources used by a path, destroy it pathDelete :: TCODPath -> IO () -- | Computing an A* path -- -- Once you created a TCODPath object, you can compute the path between -- two points. Both points should be inside the map, and at a walkable -- position. The function returns false if there is no possible path. pathCompute :: TCODPath -> Int -> Int -> Int -> Int -> IO Bool -- | Walking the path -- -- You can walk the path and go to the next step with : Note that walking -- the path consume one step (and decrease the path size by one). The -- function returns false if recalculateWhenNeeded is false and the next -- cell on the path is no longer walkable, or if recalculateWhenNeeded is -- true, the next cell on the path is no longer walkable and no other -- path has been found. Also note that recalculateWhenNeeded only applies -- to A*. pathWalk :: TCODPath -> Bool -> IO (Bool, Int, Int) -- | Check is path has no steps pathIsEmpty :: TCODPath -> IO Bool -- | Get number of steps the path consists of pathSize :: TCODPath -> IO Int -- | Reversing a path -- -- Once you computed a path, you can exchange origin and destination pathReverse :: TCODPath -> IO () -- | Read the path cells' coordinates -- -- You can get the coordinates of each point along the path pathGet :: TCODPath -> Int -> IO (Int, Int) -- | Get origin/start of the path pathGetOrigin :: TCODPath -> IO (Int, Int) -- | Get destination/end of the path pathGetDesitnation :: TCODPath -> IO (Int, Int) instance GHC.Generics.Generic Game.TCOD.Path.TCODPath instance GHC.Classes.Ord Game.TCOD.Path.TCODPath instance GHC.Show.Show Game.TCOD.Path.TCODPath instance GHC.Classes.Eq Game.TCOD.Path.TCODPath module Game.TCOD.Tree -- | Rose tree implemented in TCOD data TCODTree a TCODTree :: {-# UNPACK #-} !(Ptr (TCODTree a)) -> {-# UNPACK #-} !(Ptr (TCODTree a)) -> {-# UNPACK #-} !(Ptr (TCODTree a)) -> TCODTree a [treeNext] :: TCODTree a -> {-# UNPACK #-} !(Ptr (TCODTree a)) [treeFather] :: TCODTree a -> {-# UNPACK #-} !(Ptr (TCODTree a)) [treeSons] :: TCODTree a -> {-# UNPACK #-} !(Ptr (TCODTree a)) -- | Allocating new tree node treeNew :: IO (TCODTree a) -- | Adding a new son to tree treeAddSon :: TCODTree a -> TCODTree a -> IO () instance GHC.Generics.Generic (Game.TCOD.Tree.TCODTree a) instance GHC.Show.Show (Game.TCOD.Tree.TCODTree a) instance GHC.Classes.Eq (Game.TCOD.Tree.TCODTree a) instance Foreign.Storable.Storable (Game.TCOD.Tree.TCODTree a) module Game.TCOD.Version tcodHexVersion :: Word tcodVersion :: String tcodVersionName :: String tcodTechVersion :: Word module Game.TCOD.ConsoleTypes -- | Tag to track pointer to TCOD_console_t newtype TCODConsole TCODConsole :: Ptr () -> TCODConsole [unTCODConsole] :: TCODConsole -> Ptr () -- | Names for keyboard keys data TCODKeyCode KeyNone :: TCODKeyCode KeyEscape :: TCODKeyCode KeyBackspace :: TCODKeyCode KeyTab :: TCODKeyCode KeyEnter :: TCODKeyCode KeyShift :: TCODKeyCode KeyControl :: TCODKeyCode KeyAlt :: TCODKeyCode KeyPause :: TCODKeyCode KeyCapslock :: TCODKeyCode KeyPageUp :: TCODKeyCode KeyPageDown :: TCODKeyCode KeyEnd :: TCODKeyCode KeyHome :: TCODKeyCode KeyUp :: TCODKeyCode KeyLeft :: TCODKeyCode KeyRight :: TCODKeyCode KeyDown :: TCODKeyCode KeyPrintScreen :: TCODKeyCode KeyInsert :: TCODKeyCode KeyDelete :: TCODKeyCode KeyLWin :: TCODKeyCode KeyRWin :: TCODKeyCode KeyApps :: TCODKeyCode Key0 :: TCODKeyCode Key1 :: TCODKeyCode Key2 :: TCODKeyCode Key3 :: TCODKeyCode Key4 :: TCODKeyCode Key5 :: TCODKeyCode Key6 :: TCODKeyCode Key7 :: TCODKeyCode Key8 :: TCODKeyCode Key9 :: TCODKeyCode KeyKp0 :: TCODKeyCode KeyKp1 :: TCODKeyCode KeyKp2 :: TCODKeyCode KeyKp3 :: TCODKeyCode KeyKp4 :: TCODKeyCode KeyKp5 :: TCODKeyCode KeyKp6 :: TCODKeyCode KeyKp7 :: TCODKeyCode KeyKp8 :: TCODKeyCode KeyKp9 :: TCODKeyCode KeyKpAdd :: TCODKeyCode KeyKpSub :: TCODKeyCode KeyKpDiv :: TCODKeyCode KeyKpMul :: TCODKeyCode KeyKpDec :: TCODKeyCode KeyKpEnter :: TCODKeyCode KeyF1 :: TCODKeyCode KeyF2 :: TCODKeyCode KeyF3 :: TCODKeyCode KeyF4 :: TCODKeyCode KeyF5 :: TCODKeyCode KeyF6 :: TCODKeyCode KeyF7 :: TCODKeyCode KeyF8 :: TCODKeyCode KeyF9 :: TCODKeyCode KeyF10 :: TCODKeyCode KeyF11 :: TCODKeyCode KeyF12 :: TCODKeyCode KeyNumLock :: TCODKeyCode KeyScrollLock :: TCODKeyCode KeySpace :: TCODKeyCode KeyChar :: TCODKeyCode KeyText :: TCODKeyCode -- | Key data: special code or character or text data TCODKey TCODKey :: !TCODKeyCode -> !(Maybe Char) -> !(Maybe String) -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> TCODKey [keyCode] :: TCODKey -> !TCODKeyCode [keyChar] :: TCODKey -> !(Maybe Char) [keyText] :: TCODKey -> !(Maybe String) -- | does this correspond to a key press or key release event ? [keyPressed] :: TCODKey -> !Bool [keyLAlt] :: TCODKey -> !Bool [keyLCtrl] :: TCODKey -> !Bool [keyLMeta] :: TCODKey -> !Bool [keyRAlt] :: TCODKey -> !Bool [keyRCtrl] :: TCODKey -> !Bool [keyRMeta] :: TCODKey -> !Bool [keyShift] :: TCODKey -> !Bool -- | Get TCODKey with default values defaultTCODKey :: TCODKey tcodKeyTextSize :: Int -- | Special characters data TCODChar CharHline :: TCODChar CharVline :: TCODChar CharNe :: TCODChar CharNw :: TCODChar CharSe :: TCODChar CharSw :: TCODChar CharTeew :: TCODChar CharTeee :: TCODChar CharTeen :: TCODChar CharTees :: TCODChar CharCross :: TCODChar CharDhline :: TCODChar CharDvline :: TCODChar CharDne :: TCODChar CharDnw :: TCODChar CharDse :: TCODChar CharDsw :: TCODChar CharDteew :: TCODChar CharDteee :: TCODChar CharDteen :: TCODChar CharDtees :: TCODChar CharDcross :: TCODChar CharBlock1 :: TCODChar CharBlock2 :: TCODChar CharBlock3 :: TCODChar CharArrowN :: TCODChar CharArrowS :: TCODChar CharArrowE :: TCODChar CharArrowW :: TCODChar CharArrow2N :: TCODChar CharArrow2S :: TCODChar CharArrow2E :: TCODChar CharArrow2W :: TCODChar CharDarrowH :: TCODChar CharDarrowV :: TCODChar CharCheckboxUnset :: TCODChar CharCheckboxSet :: TCODChar CharRadioUnset :: TCODChar CharRadioSet :: TCODChar CharSubpNw :: TCODChar CharSubpNe :: TCODChar CharSubpN :: TCODChar CharSubpSe :: TCODChar CharSubpDiag :: TCODChar CharSubpE :: TCODChar CharSubpSw :: TCODChar CharSmilie :: TCODChar CharSmilieInv :: TCODChar CharHeart :: TCODChar CharDiamond :: TCODChar CharClub :: TCODChar CharSpade :: TCODChar CharBullet :: TCODChar CharBulletInv :: TCODChar CharMale :: TCODChar CharFemale :: TCODChar CharNote :: TCODChar CharNoteDouble :: TCODChar CharLight :: TCODChar CharExclamDouble :: TCODChar CharPilcrow :: TCODChar CharSection :: TCODChar CharPound :: TCODChar CharMultiplication :: TCODChar CharFunction :: TCODChar CharReserved :: TCODChar CharHalf :: TCODChar CharOneQuarter :: TCODChar CharCopyright :: TCODChar CharCent :: TCODChar CharYen :: TCODChar CharCurrency :: TCODChar CharThreeQuarters :: TCODChar CharDivision :: TCODChar CharGrade :: TCODChar CharUmlaut :: TCODChar CharPow1 :: TCODChar CharPow3 :: TCODChar CharPow2 :: TCODChar CharBulletSquare :: TCODChar -- | Color control flags for console data TCODColorControl Ctrl_1 :: TCODColorControl Ctrl_2 :: TCODColorControl Ctrl_3 :: TCODColorControl Ctrl_4 :: TCODColorControl Ctrl_5 :: TCODColorControl CtrlForeRgb :: TCODColorControl CtrlBackRgb :: TCODColorControl CtrlStop :: TCODColorControl -- | Background flag data TCODBackgroundFlag BackgroundNone :: TCODBackgroundFlag BackgroundSet :: TCODBackgroundFlag BackgroundMultiply :: TCODBackgroundFlag BackgroundLighten :: TCODBackgroundFlag BackgroundDarken :: TCODBackgroundFlag BackgroundScreen :: TCODBackgroundFlag BackgroundColorDodge :: TCODBackgroundFlag BackgroundColorBurn :: TCODBackgroundFlag BackgroundAdd :: TCODBackgroundFlag BackgroundAdda :: TCODBackgroundFlag BackgroundBurn :: TCODBackgroundFlag BackgroundOverlay :: TCODBackgroundFlag BackgroundAlph :: TCODBackgroundFlag BackgroundDefault :: TCODBackgroundFlag -- | Key status data TCODKeyStatus KeyPressed :: TCODKeyStatus KeyReleased :: TCODKeyStatus -- | Custom font flag data TCODFontFlag FontLayoutAsciiInCol :: TCODFontFlag FontLayoutAsciiInRow :: TCODFontFlag FontTypeGreyScale :: TCODFontFlag FontLayoutTcod :: TCODFontFlag -- | Assemble flags into int field combineFontFlags :: Foldable f => f TCODFontFlag -> Int -- | Availiable renderers data TCODRenderer RendererGLSL :: TCODRenderer RendererOpenGL :: TCODRenderer RendererSDL :: TCODRenderer -- | Different text/element alignments data TCODAlignment AlignLeft :: TCODAlignment AlignRight :: TCODAlignment AlignCenter :: TCODAlignment instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODAlignment instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODRenderer instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODFontFlag instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODBackgroundFlag instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODChar instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODChar instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODChar instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODChar instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODChar instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODKey instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODKey instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODKey instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Enum.Bounded Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Read.Read Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODKeyCode instance GHC.Generics.Generic Game.TCOD.ConsoleTypes.TCODConsole instance GHC.Show.Show Game.TCOD.ConsoleTypes.TCODConsole instance GHC.Classes.Ord Game.TCOD.ConsoleTypes.TCODConsole instance GHC.Classes.Eq Game.TCOD.ConsoleTypes.TCODConsole instance Foreign.Storable.Storable Game.TCOD.ConsoleTypes.TCODKey instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODChar instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODColorControl instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODKeyStatus instance GHC.Enum.Enum Game.TCOD.ConsoleTypes.TCODFontFlag module Game.TCOD.Color -- | 24 bit color data Color Color :: {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> Color [colorR] :: Color -> {-# UNPACK #-} !Word8 [colorG] :: Color -> {-# UNPACK #-} !Word8 [colorB] :: Color -> {-# UNPACK #-} !Word8 -- | Color names data ColorName ColorRed :: ColorName ColorFlame :: ColorName ColorOrange :: ColorName ColorAmber :: ColorName ColorYellow :: ColorName ColorLime :: ColorName ColorChartreuse :: ColorName ColorGreen :: ColorName ColorSea :: ColorName ColorTurquoise :: ColorName ColorCyan :: ColorName ColorSky :: ColorName ColorAzure :: ColorName ColorBlue :: ColorName ColorHan :: ColorName ColorViolet :: ColorName ColorPurple :: ColorName ColorFuchsia :: ColorName ColorMagenta :: ColorName ColorPink :: ColorName ColorCrimson :: ColorName -- | Color levels data ColorLevel ColorDesaturated :: ColorLevel ColorLightest :: ColorLevel ColorLighter :: ColorLevel ColorLight :: ColorLevel ColorNormal :: ColorLevel ColorDark :: ColorLevel ColorDarker :: ColorLevel ColorDarkest :: ColorLevel ColorLevels :: ColorLevel -- | Construct RGB color from int8 on C side colorRGB :: Word8 -> Word8 -> Word8 -> Color -- | Construct HSV (hue-saturation-value) colors from words on C side colorHSV :: Float -> Float -> Float -> Color -- | Compare two colors using C side colorEquals :: Color -> Color -> Bool -- | Add two colors using C side colorAdd :: Color -> Color -> Color -- | Subtract two colors using C side colorSubtract :: Color -> Color -> Color -- | Multiply two colors using C side colorMultiply :: Color -> Color -> Color -- | Multiply color and scalar using C side colorMultiplyScalar :: Color -> Float -> Color -- | Linear interpolation between two colors colorLerp :: Color -> Color -> Float -> Color -- | Set hue, saturation and value colorPtrSetHSV :: Ptr Color -> Float -> Float -> Float -> IO () -- | Pure version of colorPtrSetHSV colorSetHSV :: Float -> Float -> Float -> Color -> Color -- | Extract hue, saturation and value colorGetHSV :: Color -> (Float, Float, Float) -- | Extract hue from color colorGetHue :: Color -> Float -- | Set hue value for color in C-side colorPtrSetHue :: Ptr Color -> Float -> IO () -- | Pure version of colorPtrSetHue colorSetHue :: Float -> Color -> Color -- | Extract saturation from color colorGetSaturation :: Color -> Float -- | Set saturation value for color in C-side colorPtrSetSaturation :: Ptr Color -> Float -> IO () -- | Pure version of colorPtrSetSaturation colorSetSaturation :: Float -> Color -> Color -- | Extract value from color colorGetValue :: Color -> Float -- | Set value value for color in C-side colorPtrSetValue :: Ptr Color -> Float -> IO () -- | Pure version of colorPtrSetValue colorSetValue :: Float -> Color -> Color -- | Shift hue for color in C-side colorPtrShiftHue :: Ptr Color -> Float -> IO () -- | Pure version of colorPtrShiftHue colorShiftHue :: Float -> Color -> Color -- | Scale HSV for color in C-side colorPtrScaleHSV :: Ptr Color -> Float -> Float -> IO () -- | Pure version of colorPtrScaleHSV colorScaleHSV :: Float -> Float -> Color -> Color -- | Raw binding for TCOD_color_gen_map colorGenMapRaw :: Ptr Color -> CInt -> Ptr Color -> Ptr CInt -> IO () -- | High-level binding that allows to generate smooth color range from -- given key colors. colorGenMap :: Map Color Int -> Vector Color -- | Get color by name and level colors :: ColorName -> ColorLevel -> Color black :: Color darkestGrey :: Color darkerGrey :: Color darkGrey :: Color grey :: Color lightGrey :: Color lighterGrey :: Color lightestGrey :: Color darkestGray :: Color darkerGray :: Color darkGray :: Color gray :: Color lightGray :: Color lighterGray :: Color lightestGray :: Color white :: Color darkestSepia :: Color darkerSepia :: Color darkSepia :: Color sepia :: Color lightSepia :: Color lighterSepia :: Color lightestSepia :: Color red :: Color flame :: Color orange :: Color amber :: Color yellow :: Color lime :: Color chartreuse :: Color green :: Color sea :: Color turquoise :: Color cyan :: Color sky :: Color azure :: Color blue :: Color han :: Color violet :: Color purple :: Color fuchsia :: Color magenta :: Color pink :: Color crimson :: Color darkRed :: Color darkFlame :: Color darkOrange :: Color darkAmber :: Color darkYellow :: Color darkLime :: Color darkChartreuse :: Color darkGreen :: Color darkSea :: Color darkTurquoise :: Color darkCyan :: Color darkSky :: Color darkAzure :: Color darkBlue :: Color darkHan :: Color darkViolet :: Color darkPurple :: Color darkFuchsia :: Color darkMagenta :: Color darkPink :: Color darkCrimson :: Color darkerRed :: Color darkerFlame :: Color darkerOrange :: Color darkerAmber :: Color darkerYellow :: Color darkerLime :: Color darkerChartreuse :: Color darkerGreen :: Color darkerSea :: Color darkerTurquoise :: Color darkerCyan :: Color darkerSky :: Color darkerAzure :: Color darkerBlue :: Color darkerHan :: Color darkerViolet :: Color darkerPurple :: Color darkerFuchsia :: Color darkerMagenta :: Color darkerPink :: Color darkerCrimson :: Color darkestRed :: Color darkestFlame :: Color darkestOrange :: Color darkestAmber :: Color darkestYellow :: Color darkestLime :: Color darkestChartreuse :: Color darkestGreen :: Color darkestSea :: Color darkestTurquoise :: Color darkestCyan :: Color darkestSky :: Color darkestAzure :: Color darkestBlue :: Color darkestHan :: Color darkestViolet :: Color darkestPurple :: Color darkestFuchsia :: Color darkestMagenta :: Color darkestPink :: Color darkestCrimson :: Color lightRed :: Color lightFlame :: Color lightOrange :: Color lightAmber :: Color lightYellow :: Color lightLime :: Color lightChartreuse :: Color lightGreen :: Color lightSea :: Color lightTurquoise :: Color lightCyan :: Color lightSky :: Color lightAzure :: Color lightBlue :: Color lightHan :: Color lightViolet :: Color lightPurple :: Color lightFuchsia :: Color lightMagenta :: Color lightPink :: Color lightCrimson :: Color lighterRed :: Color lighterFlame :: Color lighterOrange :: Color lighterAmber :: Color lighterYellow :: Color lighterLime :: Color lighterChartreuse :: Color lighterGreen :: Color lighterSea :: Color lighterTurquoise :: Color lighterCyan :: Color lighterSky :: Color lighterAzure :: Color lighterBlue :: Color lighterHan :: Color lighterViolet :: Color lighterPurple :: Color lighterFuchsia :: Color lighterMagenta :: Color lighterPink :: Color lighterCrimson :: Color lightestRed :: Color lightestFlame :: Color lightestOrange :: Color lightestAmber :: Color lightestYellow :: Color lightestLime :: Color lightestChartreuse :: Color lightestGreen :: Color lightestSea :: Color lightestTurquoise :: Color lightestCyan :: Color lightestSky :: Color lightestAzure :: Color lightestBlue :: Color lightestHan :: Color lightestViolet :: Color lightestPurple :: Color lightestFuchsia :: Color lightestMagenta :: Color lightestPink :: Color lightestCrimson :: Color desaturatedRed :: Color desaturatedFlame :: Color desaturatedOrange :: Color desaturatedAmber :: Color desaturatedYellow :: Color desaturatedLime :: Color desaturatedChartreuse :: Color desaturatedGreen :: Color desaturatedSea :: Color desaturatedTurquoise :: Color desaturatedCyan :: Color desaturatedSky :: Color desaturatedAzure :: Color desaturatedBlue :: Color desaturatedHan :: Color desaturatedViolet :: Color desaturatedPurple :: Color desaturatedFuchsia :: Color desaturatedMagenta :: Color desaturatedPink :: Color desaturatedCrimson :: Color brass :: Color copper :: Color gold :: Color silver :: Color celadon :: Color peach :: Color instance GHC.Generics.Generic Game.TCOD.Color.ColorLevel instance GHC.Enum.Bounded Game.TCOD.Color.ColorLevel instance GHC.Enum.Enum Game.TCOD.Color.ColorLevel instance GHC.Read.Read Game.TCOD.Color.ColorLevel instance GHC.Show.Show Game.TCOD.Color.ColorLevel instance GHC.Classes.Ord Game.TCOD.Color.ColorLevel instance GHC.Classes.Eq Game.TCOD.Color.ColorLevel instance GHC.Generics.Generic Game.TCOD.Color.ColorName instance GHC.Enum.Bounded Game.TCOD.Color.ColorName instance GHC.Enum.Enum Game.TCOD.Color.ColorName instance GHC.Read.Read Game.TCOD.Color.ColorName instance GHC.Show.Show Game.TCOD.Color.ColorName instance GHC.Classes.Ord Game.TCOD.Color.ColorName instance GHC.Classes.Eq Game.TCOD.Color.ColorName instance Foreign.Storable.Storable Game.TCOD.Context.Color module Game.TCOD.Image -- | TCOD image newtype TCODImage TCODImage :: Ptr () -> TCODImage [unTCODImage] :: TCODImage -> Ptr () -- | You can create an image of any size, filled with black with this -- function. imageNew :: Int -> Int -> IO TCODImage -- | You can create an image from any console (either the root console or -- an offscreen console). The image size will depend on the console size -- and the font characters size. You can then save the image to a file -- with the save function. imageFromConsole :: TCODConsole -> IO TCODImage -- | If you need to refresh the image with the console's new content, you -- don't have to delete it and create another one. Instead, use this -- function. Note that you must use the same console that was used in the -- TCOD_image_from_console call (or at least a console with the same -- size). imageRefreshConsole :: TCODImage -> TCODConsole -> IO () -- | You can read data from a .bmp or .png file (for example to draw an -- image using the background color of the console cells). Note that only -- 24bits and 32bits PNG files are currently supported. imageLoad :: FilePath -> IO TCODImage -- | Filling an image with a color imageClear :: TCODImage -> Color -> IO () -- | Inverting the colors of the image imageInvert :: TCODImage -> IO () -- | Flipping the image horizontally imageHFlip :: TCODImage -> IO () -- | Flipping the image vertically imageVFlip :: TCODImage -> IO () -- | Rotate the image clockwise by increment of 90 degrees. imageRotate90 :: TCODImage -> Int -> IO () -- | Rotate the image clockwise by increment of 90 degrees. imageScale :: TCODImage -> Int -> Int -> IO () -- | You can save an image to a 24 bits .bmp or .png file. imageSave :: TCODImage -> FilePath -> IO () -- | You can read the size of an image in pixels with this function. imageGetSize :: TCODImage -> IO (Int, Int) -- | You can read the colors from an image with this function. imageGetPixel :: TCODImage -> Int -> Int -> IO Color -- | If you have set a key color for this image with setKeyColor, or if -- this image was created from a 32 bits PNG file (with alpha layer), you -- can get the pixel transparency with this function. This function -- returns a value between 0 (transparent pixel) and 255 (opaque pixel). imageGetAlpha :: TCODImage -> Int -> Int -> IO Int -- | This method uses mipmaps to get the average color of an arbitrary -- rectangular region of the image. It can be used to draw a scaled-down -- version of the image. It's used by libtcod's blitting functions. imageGetMipmapPixel :: TCODImage -> Float -> Float -> Float -> Float -> IO Color -- | Changing the color of a pixel imagePutPixel :: TCODImage -> Int -> Int -> Color -> IO () -- | Blitting with scaling and/or rotation -- -- This function allows you to specify the floating point coordinates of -- the center of the image, its scale and its rotation angle. imageBlit :: TCODImage -> TCODConsole -> Float -> Float -> TCODBackgroundFlag -> Float -> Float -> Float -> IO () -- | This function blits a rectangular part of the image on a console -- without scaling it or rotating it. Each pixel of the image fills a -- console cell. imageBlitRect :: TCODImage -> TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> IO () -- | Blitting with subcell resolution -- -- Eventually, you can use some special characters in the libtcod fonts -- to double the console resolution using this blitting function. imageBlit2X :: TCODImage -> TCODConsole -> Int -> Int -> Int -> Int -> Int -> Int -> IO () -- | Free memory of the image imageDelete :: TCODImage -> IO () -- | When blitting an image, you can define a key color that will be -- ignored by the blitting function. This makes it possible to blit non -- rectangular images or images with transparent pixels. imageSetKeyColor :: TCODImage -> Color -> IO () -- | You can use this simpler version (for images with alpha layer, returns -- true only if alpha == 0) : imageIsPixelTransparent :: TCODImage -> Int -> Int -> IO Bool instance GHC.Generics.Generic Game.TCOD.Image.TCODImage instance GHC.Show.Show Game.TCOD.Image.TCODImage instance GHC.Classes.Ord Game.TCOD.Image.TCODImage instance GHC.Classes.Eq Game.TCOD.Image.TCODImage module Game.TCOD.Console -- | Creating the game window consoleInitRoot :: Int -> Int -> String -> Bool -> TCODRenderer -> IO () -- | Changing the window title -- -- This function dynamically changes the title of the game window. Note -- that the window title is not visible while in fullscreen. consoleSetWindowTitle :: String -> IO () -- | Switching between windowed and fullscreen modes -- -- This function switches the root console to fullscreen or windowed -- mode. Note that there is no predefined key combination to switch -- to/from fullscreen. You have to do this in your own code. consoleSetFullScreen :: Bool -> IO () -- | Getting the current mode -- -- This function returns true if the current mode is fullscreen. consoleIsFullScreen :: IO Bool -- | Handling "close window" events -- -- When you start the program, this returns false. Once a "close window" -- event has been sent by the window manager, it will always return true. -- You're supposed to exit cleanly the game. consoleIsWindowClosed :: IO Bool -- | Check if the mouse cursor is inside the game window -- -- Returns true if the mouse cursor is inside the game window area and -- the game window is the active application. consoleHasMouseFocus :: IO Bool -- | Check if the game application is active -- -- Returns false if the game window is not the active window or is -- iconified. consoleConsoleIsActive :: IO Bool -- | This function allows you to use a bitmap font (png or bmp) with custom -- character size or layout. It should be called before initializing the -- root console with initRoot. Once this function is called, you can -- define your own custom mappings using mapping functions consoleSetCustomFont :: Foldable f => FilePath -> f TCODFontFlag -> Int -> Int -> IO () -- | Mapping a single ASCII code to a character -- -- These functions allow you to map characters in the bitmap font to -- ASCII codes. They should be called after initializing the root console -- with initRoot. You can dynamically change the characters mapping at -- any time, allowing to use several fonts in the same screen. consoleMapAsciiCodeToFont :: Int -> Int -> Int -> IO () -- | Mapping consecutive ASCII codes to consecutive characters consoleMapAsciiCodesToFont :: Int -> Int -> Int -> Int -> IO () -- | Mapping ASCII code from a string to consecutive characters -- -- Note: none ascii characters in the string are ignored consoleMapStringToFont :: String -> Int -> Int -> IO () -- | Mark region of console for rerender consoleSetDirty :: Int -> Int -> Int -> Int -> IO () -- | TCOD uses null pointer to reference root console, we wrap it to our -- type for ease of use and hiding the subtle implementation detail. rootConsole :: TCODConsole -- | Setting the default background color -- -- This function changes the default background color for a console. The -- default background color is used by several drawing functions like -- clear, putChar, ... consoleSetDefaultBackground :: TCODConsole -> Color -> IO () -- | Setting the default foreground color -- -- This function changes the default foreground color for a console. The -- default foreground color is used by several drawing functions like -- clear, putChar, ... consoleSetDefaultForeground :: TCODConsole -> Color -> IO () -- | Clearing a console -- -- This function modifies all cells of a console : * set the cell's -- background color to the console default background color * set the -- cell's foreground color to the console default foreground color * set -- the cell's ASCII code to 32 (space) consoleClear :: TCODConsole -> IO () -- | Setting the background color of a cell -- -- This function modifies the background color of a cell, leaving other -- properties (foreground color and ASCII code) unchanged. consoleSetCharBackground :: TCODConsole -> Int -> Int -> Color -> TCODBackgroundFlag -> IO () -- | Setting the background color of a cell -- -- This function modifies the background color of a cell, leaving other -- properties (foreground color and ASCII code) unchanged. consoleSetCharForeground :: TCODConsole -> Int -> Int -> Color -> IO () -- | Setting the ASCII code of a cell -- -- This function modifies the ASCII code of a cell, leaving other -- properties (background and foreground colors) unchanged. Note that -- since a clear console has both background and foreground colors set to -- black for every cell, using setchar will produce black characters on -- black background. Use putchar instead. consoleSetChar :: TCODConsole -> Int -> Int -> Char -> IO () -- | Setting every property of a cell using default colors -- -- This function modifies every property of a cell : * update the cell's -- background color according to the console default background color -- (see TCOD_bkgnd_flag_t). * set the cell's foreground color to the -- console default foreground color * set the cell's ASCII code to c consolePutChar :: TCODConsole -> Int -> Int -> Char -> TCODBackgroundFlag -> IO () -- | Setting every property of a cell using specific colors -- -- This function modifies every property of a cell : * set the cell's -- background color to back. * set the cell's foreground color to fore. * -- set the cell's ASCII code to c. consolePutCharEx :: TCODConsole -> Int -> Int -> Char -> Color -> Color -> IO () -- | Setting the default background flag -- -- This function defines the background mode (see TCOD_bkgnd_flag_t) for -- the console. This default mode is used by several functions (print, -- printRect, ...) consoleSetBackgroundFlag :: TCODConsole -> TCODBackgroundFlag -> IO () -- | Getting the default background flag -- -- This function returns the background mode (see TCOD_bkgnd_flag_t) for -- the console. This default mode is used by several functions (print, -- printRect, ...) consoleGetBackgroundFlag :: TCODConsole -> IO TCODBackgroundFlag -- | Setting the default alignment -- -- This function defines the default alignment (see TCOD_alignment_t) for -- the console. This default alignment is used by several functions -- (print, printRect, ...). consoleSetAligment :: TCODConsole -> TCODAlignment -> IO () -- | Getting the default alignment -- -- This function returns the default alignment (see TCOD_alignment_t) for -- the console. This default mode is used by several functions (print, -- printRect, ...). consoleGetAligment :: TCODConsole -> IO TCODAlignment -- | Printing a string with default parameters -- -- This function print a string at a specific position using current -- default alignment, background flag, foreground and background colors. -- -- Note: works same as Printf functions consolePrintAscii :: PrintfArg r => TCODConsole -> Int -> Int -> String -> r -> IO () -- | Printing a string with specific alignment and background mode -- -- his function print a string at a specific position using specific -- alignment and background flag, but default foreground and background -- colors. -- -- Note: works same as Printf functions consolePrintExAscii :: PrintfArg r => TCODConsole -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO () -- | Printing a string with default parameters and autowrap -- -- This function draws a string in a rectangle inside the console, using -- default colors, alignment and background mode. If the string reaches -- the borders of the rectangle, carriage returns are inserted. If h > -- 0 and the bottom of the rectangle is reached, the string is truncated. -- If h = 0, the string is only truncated if it reaches the bottom of the -- console. The function returns the height (number of console lines) of -- the printed string. -- -- Note: works same as Printf functions consolePrintRectAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int -- | Printing a string with specific alignment and background mode and -- autowrap -- -- This function draws a string in a rectangle inside the console, using -- default colors, but specific alignment and background mode. If the -- string reaches the borders of the rectangle, carriage returns are -- inserted. If h > 0 and the bottom of the rectangle is reached, the -- string is truncated. If h = 0, the string is only truncated if it -- reaches the bottom of the console. The function returns the height -- (number of console lines) of the printed string. -- -- Note: works same as Printf functions consolePrintRectExAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO Int -- | Compute the height of an autowrapped string -- -- This function returns the expected height of an autowrapped string -- without actually printing the string with printRect or printRectEx -- -- Note: works same as Printf functions consoleGetHeightRectAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int -- | Filling a rectangle with the background color -- -- Fill a rectangle inside a console. For each cell in the rectangle : * -- set the cell's background color to the console default background -- color * if clear is true, set the cell's ASCII code to 32 (space) consoleRect :: TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> IO () -- | Drawing an horizontal line -- -- Draws an horizontal line in the console, using ASCII code -- TCOD_CHAR_HLINE (196), and the console's default background/foreground -- colors. consoleHLine :: TCODConsole -> Int -> Int -> Int -> TCODBackgroundFlag -> IO () -- | Drawing an horizontal line -- -- Draws an horizontal line in the console, using ASCII code -- TCOD_CHAR_HLINE (196), and the console's default background/foreground -- colors. consoleVLine :: TCODConsole -> Int -> Int -> Int -> TCODBackgroundFlag -> IO () -- | Drawing a window frame -- -- This function calls the rect function using the supplied background -- mode flag, then draws a rectangle with the console's default -- foreground color. fmt is printed on the top of the rectangle, using -- inverted colors. consolePrintFrame :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> String -> r -> IO () -- | Drawing a window frame -- -- This function calls the rect function using the supplied background -- mode flag, then draws a rectangle with the console's default -- foreground color. consolePrintFrame' :: TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> IO () -- | Printing a string with default parameters, unicode version -- -- This function print a string at a specific position using current -- default alignment, background flag, foreground and background colors. -- -- Those functions are similar to their ASCII equivalent, but work with -- unicode strings (wchar_t in C/C++). Note: works same as Printf -- functions consolePrint :: PrintfArg r => TCODConsole -> Int -> Int -> String -> r -> IO () -- | Printing a string with specific alignment and background mode -- -- his function print a string at a specific position using specific -- alignment and background flag, but default foreground and background -- colors. -- -- Note: works same as Printf functions consolePrintEx :: PrintfArg r => TCODConsole -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO () -- | Printing a string with default parameters and autowrap, unicode -- version -- -- This function draws a string in a rectangle inside the console, using -- default colors, alignment and background mode. If the string reaches -- the borders of the rectangle, carriage returns are inserted. If h > -- 0 and the bottom of the rectangle is reached, the string is truncated. -- If h = 0, the string is only truncated if it reaches the bottom of the -- console. The function returns the height (number of console lines) of -- the printed string. -- -- Note: works same as Printf functions consolePrintRect :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int -- | Printing a string with specific alignment and background mode and -- autowrap, unicode version -- -- This function draws a string in a rectangle inside the console, using -- default colors, but specific alignment and background mode. If the -- string reaches the borders of the rectangle, carriage returns are -- inserted. If h > 0 and the bottom of the rectangle is reached, the -- string is truncated. If h = 0, the string is only truncated if it -- reaches the bottom of the console. The function returns the height -- (number of console lines) of the printed string. -- -- Note: works same as Printf functions consolePrintRectEx :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO Int -- | Compute the height of an autowrapped string, utf version -- -- This function returns the expected height of an autowrapped string -- without actually printing the string with printRect or printRectEx -- -- Note: works same as Printf functions consoleGetHeightRect :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int -- | Reading the default background color -- -- This function returns the default background color of a console. consoleGetDefaultBackground :: TCODConsole -> IO Color -- | Reading the default foreground color -- -- This function returns the default foreground color of a console. consoleGetDefaultForeground :: TCODConsole -> IO Color -- | Reading the background color of a cell -- -- This function returns the background color of a cell. consoleGetCharBackground :: TCODConsole -> Int -> Int -> IO Color -- | Reading the foreground color of a cell -- -- This function returns the foreground color of a cell. consoleGetCharForeground :: TCODConsole -> Int -> Int -> IO Color -- | Reading the ASCII code of a cell consoleGetChar :: TCODConsole -> Int -> Int -> IO Char -- | Manipulating background colors as an image -- -- This function obtains the image containing the console background -- colors. consoleGetBackgroundColorImage :: TCODConsole -> IO TCODImage -- | Manipulating foreground colors as an image -- -- This function obtains the image containing the console foreground -- colors. consoleGetForegroundColorImage :: TCODConsole -> IO TCODImage -- | Changing the fading parameters -- -- This function defines the fading parameters, allowing to easily fade -- the game screen to/from a color. Once they are defined, the fading -- parameters are valid for ever. You don't have to call setFade for each -- rendered frame (unless you change the fading parameters). consoleSetFade :: Word8 -> Color -> IO () -- | Reading the fade amount -- -- This function returns the current fade amount, previously defined by -- setFade. consoleGetFade :: IO Word8 -- | Reading the fading color -- -- This function returns the current fading color, previously defined by -- setFade. consoleGetFadingColor :: IO Color -- | Once the root console is initialized, you can use one of the printing -- functions to change the background colors, the foreground colors or -- the ASCII characters on the console. -- -- Once you've finished rendering the root console, you have to actually -- apply the updates to the screen with this function. consoleFlush :: IO () -- | Changing the colors while printing a string -- -- If you want to draw a string using different colors for each word, the -- basic solution is to call a string printing function several times, -- changing the default colors between each call. -- -- The TCOD library offers a simpler way to do this, allowing you to draw -- a string using different colors in a single call. For this, you have -- to insert color control codes in your string. -- -- A color control code is associated with a color set (a foreground -- color and a background color). If you insert this code in your string, -- the next characters will use the colors associated with the color -- control code. -- -- There are 5 predefined color control codes : Ctrl_1 -- Ctrl_2 Ctrl_3 Ctrl_4 Ctrl_5 To associate a -- color with a code, use consoleSetColorControl. To go back to -- the console's default colors, insert in your string the color stop -- control code : CtrlStop -- -- You can also use any color without assigning it to a control code, -- using the generic control codes : CtrlForeRgb -- CtrlBackRgb -- -- Those controls respectively change the foreground and background color -- used to print the string characters. In the string, you must insert -- the r,g,b components of the color (between 1 and 255. The value 0 is -- forbidden because it represents the end of the string in C/C++) -- immediately after this code. consoleSetColorControl :: TCODColorControl -> Color -> Color -> IO () -- | Deprecated as of 1.5.1 -- | Deprecated: is deprecated as of 1.5.1 consoleCheckForKeyPress :: TCODKeyStatus -> IO TCODKey -- | Deprecated as of 1.5.1 -- | Deprecated: is deprecated as of 1.5.1 consoleWaitForKeyPress :: Bool -> IO TCODKey -- | The preferred way to check for user input is to use checkForEvent -- below, but you can also get the status of any special key at any time -- with the function consoleIsKeyPressed :: TCODKeyCode -> IO Bool -- | Creating an offscreen console from a .asc or .apf file -- -- You can create an offscreen console from a file created with Ascii -- Paint with this constructor consoleFromFile :: FilePath -> IO TCODConsole -- | Loading an offscreen console from a .asc file -- -- You can load data from a file created with Ascii Paint with this -- function. When needed, the console will be resized to fit the file -- size. The function returns false if it couldn't read the file. consoleLoadAsc :: TCODConsole -> FilePath -> IO Bool -- | Loading an offscreen console from a .apf file -- -- You can load data from a file created with Ascii Paint with this -- function. When needed, the console will be resized to fit the file -- size. The function returns false if it couldn't read the file. consoleLoadApf :: TCODConsole -> FilePath -> IO Bool -- | Saving a console to a .asc file -- -- You can save data from a console to Ascii Paint format with this -- function. The function returns false if it couldn't write the file. -- This is the only ASC function that works also with the root console ! consoleSaveAsc :: TCODConsole -> FilePath -> IO Bool -- | Saving a console to a .apf file -- -- You can save data from a console to Ascii Paint format with this -- function. The function returns false if it couldn't write the file. -- This is the only ASC function that works also with the root console ! consoleSaveApf :: TCODConsole -> FilePath -> IO Bool -- | Creating an offscreen console -- -- You can create as many off-screen consoles as you want by using this -- function. You can draw on them as you would do with the root console, -- but you cannot flush them to the screen. Else, you can blit them on -- other consoles, including the root console. See blit. The C version of -- this function returns a console handler that you can use in most -- console drawing functions. consoleNew :: Int -> Int -> IO TCODConsole -- | Get the console's width -- -- This function returns the width of a console (either the root console -- or an offscreen console) consoleGetWidth :: TCODConsole -> IO Int -- | Get the console's height -- -- This function returns the height of a console (either the root console -- or an offscreen console) consoleGetHeight :: TCODConsole -> IO Int -- | Define a blit-transparent color -- -- This function defines a transparent background color for an offscreen -- console. All cells with this background color are ignored by the blit -- operation. You can use it to blit only some parts of the console. consoleSetKeyColor :: TCODConsole -> Color -> IO () -- | Blitting a console on another one -- -- This function allows you to blit a rectangular area of the source -- console at a specific position on a destination console. It can also -- simulate alpha transparency with the fade parameter. consoleBlit :: TCODConsole -> Int -> Int -> Int -> Int -> TCODConsole -> Int -> Int -> Float -> Float -> IO () -- | Destroying an offscreen console -- -- Use this function to destroy an offscreen console and release any -- resources allocated. Don't use it on the root console. consoleDelete :: TCODConsole -> IO () -- | Using a separate credit page -- -- You can print a "Powered by libtcod x.y.z" screen during your game -- startup simply by calling this function after initRoot. The credits -- screen can be skipped by pressing any key. consoleCredits :: IO () -- | Restart the credits animation -- -- When using rederCredits, you can restart the credits animation from -- the beginning before it's finished by calling this function. consoleCreditsReset :: IO () -- | Embedding credits in an existing page -- -- You can also print the credits on one of your game screens (your main -- menu for example) by calling this function in your main loop. This -- function returns true when the credits screen is finished, indicating -- that you no longer need to call it. consoleCreditsRender :: Int -> Int -> Bool -> IO Bool -- | REXPaint support consoleFromXp :: FilePath -> IO TCODConsole -- | REXPaint support consoleLoadXp :: TCODConsole -> FilePath -> IO Bool -- | REXPaint support consoleSaveXp :: TCODConsole -> FilePath -> Int -> IO Bool -- | REXPaint support consoleListFromXp :: FilePath -> IO (TCODList TCODConsole) -- | REXPaint support consoleListSaveXp :: TCODList TCODConsole -> FilePath -> Int -> IO Bool module Game.TCOD.System -- | Initialize global TCOD reference for system systemStartup :: IO () -- | Deallocate global TCOD reference for system systemShutdown :: IO () -- | Run action with wrapped TCOD system startup/shutdown. Exception safe -- and intented to be used in main function. withSystem :: IO a -> IO a -- | Get global timer in milliseconds -- -- This function returns the number of milliseconds since the program has -- started. systemElapsedMilli :: IO Word -- | Get global timer in seconds -- -- This function returns the number of seconds since the program has -- started. systemElapsedSeconds :: IO Double -- | Pause the program -- -- Use this function to stop the program execution for a specified number -- of milliseconds. -- -- Note: all haskell threads on the same HEC will be paused too, try to -- use Haskell side delays instead of the function. systemSleepMilli :: Word -> IO () -- | Limit the frames per second -- -- The setFps function allows you to limit the number of frames per -- second. If a frame is rendered faster than expected, the -- consoleFlush function will wait so that the frame rate never -- exceed this value. You can call this function during your game -- initialization. You can dynamically change the frame rate. Just call -- this function once again. bYou should always limit the frame -- rate, except during benchmarks, else your game will use 100% of the -- CPU power/b systemSetFps :: Int -> IO () -- | Get the number of frames rendered during the last second -- -- The value returned by this function is updated every second. systemGetFps :: IO Int -- | Get the duration of the last frame -- -- This function returns the length in seconds of the last rendered -- frame. You can use this value to update every time dependent object in -- the world. systemGetLastFrameLength :: IO Float -- | This function allows you to save the current game screen in a png -- file, or possibly a bmp file if you provide a filename ending with -- .bmp. systemSaveScreenshot :: Maybe FilePath -> IO () -- | Using a custom resolution for the fullscreen mode -- -- This function allows you to force the use of a specific resolution in -- fullscreen mode. The default resolution depends on the root console -- size and the font character size. -- -- Will use the smallest available resolution so that : resolution width -- >= width and resolution width >= root console width * font char -- width resolution width >= height and resolution height >= root -- console height * font char height systemForceFullscreenResolution :: Int -> Int -> IO () -- | Dynamically change libtcod's internal renderer -- -- As of 1.5.1, libtcod contains 3 different renderers : * SDL : historic -- libtcod renderer. Should work and be pretty fast everywhere * OpenGL : -- requires OpenGL compatible video card. Might be much faster or much -- slower than SDL, depending on the drivers * GLSDL : requires OpenGL -- 1.4 compatible video card with GL_ARB_shader_objects extension. -- Blazing fast if you have the proper hardware and drivers. This -- function switches the current renderer dynamically. systemSetRenderer :: TCODRenderer -> IO () -- | Get the current internal renderer systemGetRenderer :: IO TCODRenderer -- | Get current resolution -- -- You can get the current screen resolution with getCurrentResolution. -- You can use it for example to get the desktop resolution before -- initializing the root console. systemGetCurrentResolution :: IO (Int, Int) -- | Get fullscreen offset -- -- If the fullscreen resolution does not matches the console size in -- pixels, black borders are added. This function returns the position in -- pixels of the console top left corner in the screen. systemGetFullscreenOffsets :: IO (Int, Int) -- | Get the font size -- -- You can get the size of the characters in the font systemGetCharSize :: IO (Int, Int) -- | Dynamically updating the font bitmap -- -- You can dynamically change the bitmap of a character in the font. All -- cells using this ascii code will be updated at next flush call. systemUpdateChar :: Char -> Int -> Int -> TCODImage -> Int -> Int -> IO () -- | Set current clipboard contents -- -- Takes UTF-8 text and copies it into the system clipboard. On Linux, -- because an application cannot access the system clipboard unless a -- window is open, if no window is open the call will do nothing. systemClipboardSet :: String -> IO Bool -- | Get current clipboard contents\ -- -- Returns the UTF-8 text currently in the system clipboard. On Linux, -- because an application cannot access the system clipboard unless a -- window is open, if no window is open an empty string will be returned. systemClipboardGet :: IO String -- | Returm reference to SDL window systemGetSDLWindow :: IO Window -- | Return reference to SDL renderer systemGetSDLRenderer :: IO Renderer -- | Flags to distinguish supported events data TCODEvent EventNone :: TCODEvent EventKeyPress :: TCODEvent EventKeyRelease :: TCODEvent EventKey :: TCODEvent EventMouseMove :: TCODEvent EventMousePress :: TCODEvent EventMouseRelease :: TCODEvent EventMouse :: TCODEvent EventFingerMove :: TCODEvent EventFingerPress :: TCODEvent EventFingerRelease :: TCODEvent EventFinger :: TCODEvent EventAny :: TCODEvent -- | Packing event flags into bitfield packTCODEvents :: Foldable f => f TCODEvent -> Int -- | Unpack events flags from bitfield. Note that EventKey, -- EventMouse and EventAny are in the set if any of -- dependent event is occured. EventNone is never occur in the set -- (empty set if no events) and EventAny is member of the set if -- any event occurs. unpackTCODEvents :: Int -> Set TCODEvent -- | Collected info about occured events in TCOD data TCODEventInfo TCODEventInfo :: TCODKey -> TCODMouse -> Set TCODEvent -> TCODEventInfo -- | Keyboard events [tcodKey] :: TCODEventInfo -> TCODKey -- | Mouse events [tcodMouse] :: TCODEventInfo -> TCODMouse -- | Set of occured event types [tcodEvents] :: TCODEventInfo -> Set TCODEvent -- | Waiting for any event (mouse or keyboard) -- -- This function waits for an event from the user. The eventMask shows -- what events we're waiting for. The return value indicate what event -- was actually triggered. Values in key and mouse structures are updated -- accordingly. If flush is false, the function waits only if there are -- no pending events, else it returns the first event in the buffer. systemWaitForEvent :: Foldable f => f TCODEvent -> Bool -> IO TCODEventInfo -- | Checking for any event (mouse or keyboard) -- -- This function checks if an event from the user is in the buffer. The -- eventMask shows what events we're waiting for. The return value -- indicate what event was actually found. Values in key and mouse -- structures are updated accordingly. systemCheckForEvent :: Foldable f => f TCODEvent -> IO TCODEventInfo -- | Create a directory -- -- All those functions return false if an error occurred. systemCreateDirectory :: FilePath -> IO Bool -- | Delete a file -- -- All those functions return false if an error occurred. systemDeleteFile :: FilePath -> IO Bool -- | Delete an empty directory -- -- All those functions return false if an error occurred. systemDeleteDirectory :: FilePath -> IO Bool -- | Check if a path is a directory -- -- All those functions return false if an error occurred. systemIsDirectory :: FilePath -> IO Bool -- | List files in a directory -- -- To get the list of entries in a directory (including sub-directories, -- except . and ..). The returned list is allocated by the function and -- must be deleted by you. All the const char * inside must be also freed -- with listClearAndDelete. systemGetDirectoryContent :: FilePath -> String -> IO (TCODList FilePath) -- | Check if a given file exists -- -- In order to check whether a given file exists in the filesystem. -- Useful for detecting errors caused by missing files. systemFileExists :: PrintfArg r => FilePath -> r -> IO Bool -- | Read the content of a file into memory -- -- This is a portable function to read the content of a file from disk or -- from the application apk (android). systemReadFile :: FilePath -> IO (Maybe ByteString) -- | Write the content of a memory buffer to a file -- -- This is a portable function to write some data to a file. systemWriteFile :: FilePath -> ByteString -> IO Bool -- | TCOD dynamic library reference newtype TCODLibrary TCODLibrary :: Ptr () -> TCODLibrary [unTCODLibrary] :: TCODLibrary -> Ptr () -- | Dynamic load of .so or .dll library. loadLibrary :: FilePath -> IO (Maybe TCODLibrary) -- | Dynamic load of function from library. Not safe as type of function is -- not checked. getFunctionAddress :: TCODLibrary -> String -> IO (Maybe (FunPtr a)) -- | Unload dynamic library from memory closeLibrary :: TCODLibrary -> IO () instance GHC.Generics.Generic Game.TCOD.System.TCODLibrary instance GHC.Show.Show Game.TCOD.System.TCODLibrary instance GHC.Classes.Ord Game.TCOD.System.TCODLibrary instance GHC.Classes.Eq Game.TCOD.System.TCODLibrary instance GHC.Generics.Generic Game.TCOD.System.TCODEventInfo instance GHC.Generics.Generic Game.TCOD.System.TCODEvent instance GHC.Show.Show Game.TCOD.System.TCODEvent instance GHC.Classes.Ord Game.TCOD.System.TCODEvent instance GHC.Classes.Eq Game.TCOD.System.TCODEvent instance GHC.Enum.Enum Game.TCOD.System.TCODEvent -- | This toolkit is a very simple and lightweight implementation of the -- bresenham line drawing algorithm. It allows you to follow straight -- paths on your map very easily. module Game.TCOD.Bresenham -- | Takes x y of point and tells when to stop type TCODLineListener = Int -> Int -> IO Bool -- | Initializing the line -- -- First, you have to initialize the toolkit with your starting and -- ending coordinates. lineInitGlobal :: Int -> Int -> Int -> Int -> IO () -- | Walking the line -- -- You can then step through each cell with this function. It returns -- true when you reach the line's ending point. lineStepGlobal :: IO (Bool, Int, Int) -- | Callback-based function. Stops when the callback returns false -- -- The function returns false if the line has been interrupted by the -- callback (it returned false before the last point). lineGlobal :: Int -> Int -> Int -> Int -> TCODLineListener -> IO Bool -- | Holds state of Bresenham algorithm for thread safe version of API data TCODBresenhamData TCODBresenhamData :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> TCODBresenhamData [bresenStepX] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenStepY] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenE] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenDeltaX] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenDeltaY] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenOrigX] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenOrigY] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenDestX] :: TCODBresenhamData -> {-# UNPACK #-} !Int [bresenDestY] :: TCODBresenhamData -> {-# UNPACK #-} !Int -- | Initializing the line, thread safe version -- -- First, you have to initialize the toolkit with your starting and -- ending coordinates. lineInit :: Int -> Int -> Int -> Int -> TCODBresenhamData -- | Walking the line, thread safe version -- -- You can then step through each cell with this function. It returns -- true when you reach the line's ending point. lineStep :: TCODBresenhamData -> (TCODBresenhamData, Bool, Int, Int) -- | Callback-based function. Stops when the callback returns false, thread -- safe version -- -- The function returns false if the line has been interrupted by the -- callback (it returned false before the last point). lineIO :: Int -> Int -> Int -> Int -> TCODLineListener -> IO Bool -- | Callback-based function. Stops when the callback returns false, thread -- safe version -- -- The function returns false if the line has been interrupted by the -- callback (it returned false before the last point). -- -- Note: that predicated is pure unlike in lineIO line :: Int -> Int -> Int -> Int -> (Int -> Int -> Bool) -> Bool instance GHC.Generics.Generic Game.TCOD.Bresenham.TCODBresenhamData instance GHC.Show.Show Game.TCOD.Bresenham.TCODBresenhamData instance GHC.Classes.Eq Game.TCOD.Bresenham.TCODBresenhamData instance Foreign.Storable.Storable Game.TCOD.Bresenham.TCODBresenhamData -- | This toolkit allows one to create and manipulate 2D Binary Space -- Partition trees. They can be used to split a rectangular region into -- non overlapping sub-regions. module Game.TCOD.BSP -- | Data for BSP of map data BSP BSP :: !(TCODTree BSP) -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Word8 -> !Bool -> BSP -- | BSP inherit tree [bspTree] :: BSP -> !(TCODTree BSP) -- | Node position & size -- | Node position & size -- | Node position & size -- | Node position & size [bspX, bspY, bspW, bspH] :: BSP -> {-# UNPACK #-} !Int -- | Position of splitting [bspPosition] :: BSP -> {-# UNPACK #-} !Int -- | level int the tree [bspLevel] :: BSP -> {-# UNPACK #-} !Word8 -- | horizontal splitting? [bspHorizontal] :: BSP -> !Bool -- | Callback for BSP traversal type BSPCallback = BSP -> IO Bool -- | Creating the root node -- -- First, you have to create the root node of the tree. This node -- encompasses the whole rectangular region. bspNew :: IO BSP -- | Creating the root node -- -- First, you have to create the root node of the tree. This node -- encompasses the whole rectangular region. bspNewWithSize :: Int -> Int -> Int -> Int -> IO BSP -- | Destroy BSP and all subtrees bspDelete :: BSP -> IO () -- | Get left subtree bspLeft :: BSP -> IO (Maybe BSP) -- | Get right subtree bspRight :: BSP -> IO (Maybe BSP) -- | Get parent subtree bspFather :: BSP -> IO (Maybe BSP) -- | You can know if a node is a leaf (not split, no sons) with this -- function bspIsLeaf :: BSP -> IO Bool -- | Traversing the tree -- -- You can scan all the nodes of the tree and have a custom function -- called back for each node. Each traversal function returns false if -- the traversal has been interrupted (a callback returned false). -- -- Pre-order : the callback is called for the current node, then for the -- left son, then for the right son. bspTraversePreOrder :: BSP -> BSPCallback -> IO Bool -- | Traversing the tree -- -- You can scan all the nodes of the tree and have a custom function -- called back for each node. Each traversal function returns false if -- the traversal has been interrupted (a callback returned false). -- -- In-order : the callback is called for the left son, then for current -- node, then for the right son. bspTraverseInOrder :: BSP -> BSPCallback -> IO Bool -- | Traversing the tree -- -- You can scan all the nodes of the tree and have a custom function -- called back for each node. Each traversal function returns false if -- the traversal has been interrupted (a callback returned false). -- -- Post-order : the callback is called for the left son, then for the -- right son, then for the current node. bspTraversePostOrder :: BSP -> BSPCallback -> IO Bool -- | Traversing the tree -- -- You can scan all the nodes of the tree and have a custom function -- called back for each node. Each traversal function returns false if -- the traversal has been interrupted (a callback returned false). -- -- Level-order : the callback is called for the nodes level by level, -- from left to right. bspTraverseLevelOrder :: BSP -> BSPCallback -> IO Bool -- | Traversing the tree -- -- You can scan all the nodes of the tree and have a custom function -- called back for each node. Each traversal function returns false if -- the traversal has been interrupted (a callback returned false). -- -- Inverted level-order : the callback is called in the exact inverse -- order as Level-order. bspTraverseInvertedLevelOrder :: BSP -> BSPCallback -> IO Bool -- | Check if a cell is inside a node bspContains :: BSP -> Int -> Int -> IO Bool -- | Getting the node containing a cell bspFindNode :: BSP -> Int -> Int -> IO (Maybe BSP) -- | This operation resets the size of the tree nodes without changing the -- splitting data (orientation/position). It should be called with the -- initial region size or a bigger size, else some splitting position may -- be out of the region. -- -- You can use it if you changed the nodes size and position while using -- the BSP tree, which happens typically when you use the tree to build a -- dungeon. You create rooms inside the tree leafs, then shrink the leaf -- to fit the room size. Calling resize on the root node with the -- original region size allows you to reset all nodes to their original -- size. bspResize :: BSP -> Int -> Int -> Int -> Int -> IO () -- | Splitting a node once -- -- Once you have the root node, you can split it into two smaller -- non-overlapping nodes. bspSplitOnce :: BSP -> Bool -> Int -> IO () -- | Recursively splitting a node -- -- You can also recursively split the bsp. At each step, a random -- orientation (horizontal/vertical) and position are chosen bspSplitRecursive :: BSP -> TCODRandom -> Int -> Int -> Int -> Float -> Float -> IO () -- | Deleting a part of the tree -- -- You can delete a part of the tree, releasing resources for all sub -- nodes with bspRemoveSons :: BSP -> IO () instance GHC.Generics.Generic Game.TCOD.BSP.BSP instance GHC.Show.Show Game.TCOD.BSP.BSP instance GHC.Classes.Eq Game.TCOD.BSP.BSP instance Foreign.Storable.Storable Game.TCOD.BSP.BSP module Game.TCOD