Safe Haskell | None |
---|---|
Language | Haskell2010 |
- consoleInitRoot :: Int -> Int -> String -> Bool -> TCODRenderer -> IO ()
- consoleSetWindowTitle :: String -> IO ()
- consoleSetFullScreen :: Bool -> IO ()
- consoleIsFullScreen :: IO Bool
- consoleIsWindowClosed :: IO Bool
- consoleHasMouseFocus :: IO Bool
- consoleConsoleIsActive :: IO Bool
- consoleSetCustomFont :: Foldable f => FilePath -> f TCODFontFlag -> Int -> Int -> IO ()
- consoleMapAsciiCodeToFont :: Int -> Int -> Int -> IO ()
- consoleMapAsciiCodesToFont :: Int -> Int -> Int -> Int -> IO ()
- consoleMapStringToFont :: String -> Int -> Int -> IO ()
- consoleSetDirty :: Int -> Int -> Int -> Int -> IO ()
- rootConsole :: TCODConsole
- consoleSetDefaultBackground :: TCODConsole -> Color -> IO ()
- consoleSetDefaultForeground :: TCODConsole -> Color -> IO ()
- consoleClear :: TCODConsole -> IO ()
- consoleSetCharBackground :: TCODConsole -> Int -> Int -> Color -> TCODBackgroundFlag -> IO ()
- consoleSetCharForeground :: TCODConsole -> Int -> Int -> Color -> IO ()
- consoleSetChar :: TCODConsole -> Int -> Int -> Char -> IO ()
- consolePutChar :: TCODConsole -> Int -> Int -> Char -> TCODBackgroundFlag -> IO ()
- consolePutCharEx :: TCODConsole -> Int -> Int -> Char -> Color -> Color -> IO ()
- consoleSetBackgroundFlag :: TCODConsole -> TCODBackgroundFlag -> IO ()
- consoleGetBackgroundFlag :: TCODConsole -> IO TCODBackgroundFlag
- consoleSetAligment :: TCODConsole -> TCODAlignment -> IO ()
- consoleGetAligment :: TCODConsole -> IO TCODAlignment
- consolePrintAscii :: PrintfArg r => TCODConsole -> Int -> Int -> String -> r -> IO ()
- consolePrintExAscii :: PrintfArg r => TCODConsole -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO ()
- consolePrintRectAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int
- consolePrintRectExAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO Int
- consoleGetHeightRectAscii :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int
- consoleRect :: TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> IO ()
- consoleHLine :: TCODConsole -> Int -> Int -> Int -> TCODBackgroundFlag -> IO ()
- consoleVLine :: TCODConsole -> Int -> Int -> Int -> TCODBackgroundFlag -> IO ()
- consolePrintFrame :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> String -> r -> IO ()
- consolePrintFrame' :: TCODConsole -> Int -> Int -> Int -> Int -> Bool -> TCODBackgroundFlag -> IO ()
- consolePrint :: PrintfArg r => TCODConsole -> Int -> Int -> String -> r -> IO ()
- consolePrintEx :: PrintfArg r => TCODConsole -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO ()
- consolePrintRect :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int
- consolePrintRectEx :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> TCODAlignment -> String -> r -> IO Int
- consoleGetHeightRect :: PrintfArg r => TCODConsole -> Int -> Int -> Int -> Int -> String -> r -> IO Int
- consoleGetDefaultBackground :: TCODConsole -> IO Color
- consoleGetDefaultForeground :: TCODConsole -> IO Color
- consoleGetCharBackground :: TCODConsole -> Int -> Int -> IO Color
- consoleGetCharForeground :: TCODConsole -> Int -> Int -> IO Color
- consoleGetChar :: TCODConsole -> Int -> Int -> IO Char
- consoleGetBackgroundColorImage :: TCODConsole -> IO TCODImage
- consoleGetForegroundColorImage :: TCODConsole -> IO TCODImage
- consoleSetFade :: Word8 -> Color -> IO ()
- consoleGetFade :: IO Word8
- consoleGetFadingColor :: IO Color
- consoleFlush :: IO ()
- consoleSetColorControl :: TCODColorControl -> Color -> Color -> IO ()
- consoleCheckForKeyPress :: TCODKeyStatus -> IO TCODKey
- consoleWaitForKeyPress :: Bool -> IO TCODKey
- consoleIsKeyPressed :: TCODKeyCode -> IO Bool
- consoleFromFile :: FilePath -> IO TCODConsole
- consoleLoadAsc :: TCODConsole -> FilePath -> IO Bool
- consoleLoadApf :: TCODConsole -> FilePath -> IO Bool
- consoleSaveAsc :: TCODConsole -> FilePath -> IO Bool
- consoleSaveApf :: TCODConsole -> FilePath -> IO Bool
- consoleNew :: Int -> Int -> IO TCODConsole
- consoleGetWidth :: TCODConsole -> IO Int
- consoleGetHeight :: TCODConsole -> IO Int
- consoleSetKeyColor :: TCODConsole -> Color -> IO ()
- consoleBlit :: TCODConsole -> Int -> Int -> Int -> Int -> TCODConsole -> Int -> Int -> Float -> Float -> IO ()
- consoleDelete :: TCODConsole -> IO ()
- consoleCredits :: IO ()
- consoleCreditsReset :: IO ()
- consoleCreditsRender :: Int -> Int -> Bool -> IO Bool
- consoleFromXp :: FilePath -> IO TCODConsole
- consoleLoadXp :: TCODConsole -> FilePath -> IO Bool
- consoleSaveXp :: TCODConsole -> FilePath -> Int -> IO Bool
- consoleListFromXp :: FilePath -> IO (TCODList TCODConsole)
- consoleListSaveXp :: TCODList TCODConsole -> FilePath -> Int -> IO Bool
Documentation
:: Int | w size of the console(in characters). The default font in libtcod (./terminal.png) uses 8x8 pixels characters. You can change the font by calling TCODConsole::setCustomFont before calling initRoot. |
-> Int | h |
-> String | Title of the window. It's not visible when you are in fullscreen.
Note 1 : you can dynamically change the window title with |
-> Bool | Fullscreen whether you start in windowed or fullscreen mode.
Note 1 : you can dynamically change this mode with |
-> TCODRenderer | renderer which renderer to use. Possible values are :
* RendererGLSL : works only on video cards with pixel shaders
* RendererOpenGL : works on all video cards supporting OpenGL 1.4
* RendererSDL : should work everywhere!
Note 1: if you select a renderer that is not supported by the player's machine, libtcod scan the lower renderers until it finds a working one.
Note 2: on recent video cards, GLSL results in up to 900% increase of framerates in the true color sample compared to SDL renderer.
Note 3: whatever renderer you use, it can always be overridden by the player through the libtcod.cfg file.
Note 4: you can dynamically change the renderer after calling consoleInitRoot with |
-> IO () |
Creating the game window
consoleSetWindowTitle :: String -> IO () Source #
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.
consoleSetFullScreen :: Bool -> IO () Source #
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.
consoleIsFullScreen :: IO Bool Source #
Getting the current mode
This function returns true if the current mode is fullscreen.
consoleIsWindowClosed :: IO Bool Source #
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.
consoleHasMouseFocus :: IO Bool Source #
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.
consoleConsoleIsActive :: IO Bool Source #
Check if the game application is active
Returns false if the game window is not the active window or is iconified.
:: Foldable f | |
=> FilePath | Name of a .bmp or .png file containing the font. |
-> f TCODFontFlag | Used to define the characters layout in the bitmap and the font type |
-> Int | Number of characters in the font (horizontal). Should be 16x16 for ASCII layouts, 32x8 for TCOD layout. But you can use any other layout. If set to 0, there are deduced from the font layout flag. |
-> Int | Number of characters in the font (vertical). |
-> IO () |
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
consoleMapAsciiCodeToFont Source #
:: Int | asciiCode ASCII code to map. |
-> Int | fontCharX Coordinate of the character in the bitmap font (in characters, not pixels). |
-> Int | fontCharY |
-> 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.
consoleMapAsciiCodesToFont Source #
:: Int | firstAsciiCode first ASCII code to map |
-> Int | nbCodes number of consecutive ASCII codes to map |
-> Int | fontCharX coordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code |
-> Int | fontCharY |
-> IO () |
Mapping consecutive ASCII codes to consecutive characters
consoleMapStringToFont Source #
:: String | string containing the ASCII codes to map |
-> Int | fontCharX of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code in the string |
-> Int | fontCharY |
-> IO () |
Mapping ASCII code from a string to consecutive characters
Note: none ascii characters in the string are ignored
rootConsole :: TCODConsole Source #
TCOD uses null pointer to reference root console, we wrap it to our type for ease of use and hiding the subtle implementation detail.
consoleSetDefaultBackground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Color | |
-> IO () |
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, ...
consoleSetDefaultForeground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> 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, ...
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> 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)
consoleSetCharBackground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y 0 <= y < console height |
-> Color | col the background color to use. You can use color constants |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> 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 Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y 0 <= y < console height |
-> Color | col the background color to use. You can use color constants |
-> 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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y 0 <= y < console height |
-> Char | the new ASCII code for the cell |
-> 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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y 0 <= y < console height |
-> Char | the new ASCII code for the cell |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> 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
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y 0 <= y < console height |
-> Char | the new ASCII code for the cell |
-> Color | foreground, new foreground and background colors for this cell |
-> Color | background, new foreground and background colors for this cell |
-> 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.
consoleSetBackgroundFlag Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> TCODBackgroundFlag | |
-> 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, ...)
consoleGetBackgroundFlag Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO TCODBackgroundFlag |
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, ...)
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> TCODAlignment | |
-> IO () |
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, ...).
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO TCODAlignment |
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, ...).
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> String | Formating string, see |
-> r | |
-> IO () |
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
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> TCODBackgroundFlag | this flag defines how the cell's background color is modified. See |
-> TCODAlignment | aligment defines how the strings are printed on screen. |
-> String | Formating string, see |
-> 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
consolePrintRectAscii Source #
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> String | Formating string, see |
-> r | |
-> IO Int |
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
consolePrintRectExAscii Source #
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> TCODBackgroundFlag | this flag defines how the cell's background color is modified. See |
-> TCODAlignment | aligment defines how the strings are printed on screen. |
-> String | Formating string, see |
-> 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
consoleGetHeightRectAscii Source #
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> String | Formating string, see |
-> 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
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of rectangle upper-left corner in the console. 0 <= x < console width |
-> Int | y coordinates of rectangle upper-left corner in the console. 0 <= y < console height |
-> Int | w size of the rectangle in the console. x <= x+w < console width |
-> Int | h size of the rectangle in the console. y <= y+h < console height |
-> Bool | clear if true, all characters inside the rectangle are set to ASCII code 32 (space). If false, only the background color is modified |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> IO () |
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)
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of rectangle upper-left corner in the console. 0 <= x < console width |
-> Int | y coordinates of rectangle upper-left corner in the console. 0 <= y < console height |
-> Int | l The length of the line in cells 1 <= l <= console width - x |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> 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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of rectangle upper-left corner in the console. 0 <= x < console width |
-> Int | y coordinates of rectangle upper-left corner in the console. 0 <= y < console height |
-> Int | l The length of the line in cells 1 <= l <= console width - x |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> 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.
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of rectangle upper-left corner in the console. 0 <= x < console width |
-> Int | y coordinates of rectangle upper-left corner in the console. 0 <= y < console height |
-> Int | w size of the rectangle in the console. x <= x+w < console width |
-> Int | h size of the rectangle in the console. y <= y+h < console height |
-> Bool | clear if true, all characters inside the rectangle are set to ASCII code 32 (space). If false, only the background color is modified |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> String | printf-like format string, eventually followed by parameters. You can use control codes to change the colors inside the 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. fmt is printed on the top of the rectangle, using inverted colors.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of rectangle upper-left corner in the console. 0 <= x < console width |
-> Int | y coordinates of rectangle upper-left corner in the console. 0 <= y < console height |
-> Int | w size of the rectangle in the console. x <= x+w < console width |
-> Int | h size of the rectangle in the console. y <= y+h < console height |
-> Bool | clear if true, all characters inside the rectangle are set to ASCII code 32 (space). If false, only the background color is modified |
-> TCODBackgroundFlag | flag this flag defines how the cell's background color is modified. See |
-> 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.
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> String | Formating string, see |
-> r | |
-> 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
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> TCODBackgroundFlag | this flag defines how the cell's background color is modified. See |
-> TCODAlignment | aligment defines how the strings are printed on screen. |
-> String | Formating string, see |
-> 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
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> String | Formating string, see |
-> r | |
-> IO Int |
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
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> TCODBackgroundFlag | this flag defines how the cell's background color is modified. See |
-> TCODAlignment | aligment defines how the strings are printed on screen. |
-> String | Formating string, see |
-> 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
:: PrintfArg r | |
=> TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinate of the character in the console, depending on the default alignment for this console |
-> Int | y coordinate of the character in the console, depending on the default alignment for this console |
-> Int | w size of the rectangle. x <= x+w < console width |
-> Int | y size of the rectangle. y <= y+h < console height |
-> String | Formating string, see |
-> 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
consoleGetDefaultBackground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO Color |
Reading the default background color
This function returns the default background color of a console.
consoleGetDefaultForeground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO Color |
Reading the default foreground color
This function returns the default foreground color of a console.
consoleGetCharBackground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y coordinates of the cell in the console. 0 <= y < console height |
-> IO Color |
Reading the background color of a cell
This function returns the background color of a cell.
consoleGetCharForeground Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y coordinates of the cell in the console. 0 <= y < console height |
-> IO Color |
Reading the foreground color of a cell
This function returns the foreground color of a cell.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Int | x coordinates of the cell in the console. 0 <= x < console width |
-> Int | y coordinates of the cell in the console. 0 <= y < console height |
-> IO Char |
Reading the ASCII code of a cell
consoleGetBackgroundColorImage Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO TCODImage |
Manipulating background colors as an image
This function obtains the image containing the console background colors.
consoleGetForegroundColorImage Source #
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO TCODImage |
Manipulating foreground colors as an image
This function obtains the image containing the console foreground colors.
:: Word8 | fade the fading amount. 0 => the screen is filled with the fading color. 255 => no fading effect |
-> Color | the color to use during the console flushing operation |
-> IO () |
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).
consoleGetFade :: IO Word8 Source #
Reading the fade amount
This function returns the current fade amount, previously defined by setFade
.
consoleGetFadingColor :: IO Color Source #
Reading the fading color
This function returns the current fading color, previously defined by setFade.
consoleFlush :: IO () Source #
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.
consoleSetColorControl Source #
:: TCODColorControl | |
-> Color | foreground |
-> Color | background |
-> 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.
consoleCheckForKeyPress Source #
:: TCODKeyStatus | flags |
-> IO TCODKey |
Deprecated: is deprecated as of 1.5.1
Deprecated as of 1.5.1
consoleWaitForKeyPress Source #
Deprecated: is deprecated as of 1.5.1
Deprecated as of 1.5.1
consoleIsKeyPressed :: TCODKeyCode -> IO Bool Source #
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
consoleFromFile :: FilePath -> IO TCODConsole Source #
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
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> FilePath | path to the .asc file created with Ascii Paint |
-> IO Bool |
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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> FilePath | path to the .apf file created with Ascii Paint |
-> 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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> FilePath | path to the .asc file created with Ascii Paint |
-> 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 !
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> FilePath | path to the .apf file created with Ascii Paint |
-> 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 !
:: Int | w the console size. 0 < w |
-> Int | h the console size. 0 < h |
-> IO TCODConsole |
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.
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO Int |
Get the console's width
This function returns the width of a console (either the root console or an offscreen console)
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> IO Int |
Get the console's height
This function returns the height of a console (either the root console or an offscreen console)
:: TCODConsole | the offscreen console handler or NULL for the root console |
-> Color | the transparent background color |
-> IO () |
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.
:: TCODConsole | The source console that must be blitted on another one. |
-> Int | x src. The rectangular area of the source console that will be blitted. If wSrc andor hSrc == 0, the source console widthheight are used |
-> Int | y src |
-> Int | w src |
-> Int | h src |
-> TCODConsole | dist console. The destination console. |
-> Int | x dst. Where to blit the upper-left corner of the source area in the destination console. |
-> Int | y dst |
-> Float | foreground alpha. foregroundAlpha,backgroundAlpha Alpha transparency of the blitted console. 0.0 => The source console is completely transparent. This function does nothing. 1.0 => The source console is opaque. Its cells replace the destination cells. 0 < 1.0 = The source console is partially blitted, simulating real transparency. |
-> Float | background alpha |
-> 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.
consoleDelete :: TCODConsole -> IO () Source #
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.
consoleCredits :: IO () Source #
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.
consoleCreditsReset :: IO () Source #
Restart the credits animation
When using rederCredits, you can restart the credits animation from the beginning before it's finished by calling this function.
:: Int | x Position of the credits text in your root console |
-> Int | y Position of the credits text in your root console |
-> Bool | alpha If true, credits are transparently added on top of the existing screen. For this to work, this function must be placed between your screen rendering code and the console flush. |
-> IO Bool |
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.
consoleFromXp :: FilePath -> IO TCODConsole Source #
REXPaint support
consoleLoadXp :: TCODConsole -> FilePath -> IO Bool Source #
REXPaint support
consoleListFromXp :: FilePath -> IO (TCODList TCODConsole) Source #
REXPaint support
REXPaint support