|
libtcod
|
The libtcod namespace. More...
Classes | |
| class | BresenhamLine |
| Encapsulates a Bresenham line drawing algorithm. More... | |
| struct | ColorRGB |
| A C++ RGB color, used to handle conversions between color types. More... | |
| struct | ColorRGBA |
| A C++ RGBA color, used to handle conversions between color types. More... | |
| struct | ConsoleDeleter |
| class | Console |
| A managed libtcod console containing a grid of tiles with {ch, fg, bg} information. More... | |
| struct | ContextDeleter |
| struct | MapDeleter_ |
| struct | ImageDeleter |
| class | MatrixView |
| A view into a strided multi-dimensional array. More... | |
| class | Matrix |
| A template container for holding a multi-dimensional array of items. More... | |
| struct | TilesetDeleter |
| class | Tileset |
| A C++ Tileset container. More... | |
| class | Timer |
| A timing class based on SDL's high performance time counter. More... | |
Typedefs | |
| typedef std::unique_ptr< struct TCOD_Console, ConsoleDeleter > | ConsolePtr |
| A unique pointer to a TCOD_Console. | |
| typedef std::unique_ptr< TCOD_Context, ContextDeleter > | ContextPtr |
| typedef std::shared_ptr< TCOD_Context > | ContextSharedPtr |
| typedef std::unique_ptr< TCOD_Image, ImageDeleter > | ImagePtr |
| A unique pointer to a TCOD_Image. | |
| typedef std::unique_ptr< TCOD_Tileset, TilesetDeleter > | TilesetPtr |
| A unique pointer to a TCOD_Tileset. | |
Functions | |
| void | blit (TCOD_Console &dest, const TCOD_Console &source, const std::array< int, 2 > &dest_xy={0, 0}, std::array< int, 4 > source_rect={0, 0, 0, 0}, float foreground_alpha=1.0f, float background_alpha=1.0f) |
| Blit a region of tiles from one console to another. | |
| void | draw_rect (TCOD_Console &console, const std::array< int, 4 > &rect, int ch, std::optional< TCOD_ColorRGB > fg, std::optional< TCOD_ColorRGB > bg, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET) |
| Fill a region with the given graphic. | |
| void | draw_frame (TCOD_Console &console, const std::array< int, 4 > &rect, const std::array< int, 9 > &decoration, std::optional< TCOD_ColorRGB > fg, std::optional< TCOD_ColorRGB > bg, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET, bool clear=true) |
| Draw a decorative frame. | |
| void | print (TCOD_Console &console, const std::array< int, 2 > &xy, std::string_view str, std::optional< TCOD_ColorRGB > fg, std::optional< TCOD_ColorRGB > bg, TCOD_alignment_t alignment=TCOD_LEFT, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET) |
| Print a string to a console. | |
| int | print_rect (TCOD_Console &console, const std::array< int, 4 > &rect, std::string_view str, std::optional< TCOD_ColorRGB > fg, std::optional< TCOD_ColorRGB > bg, TCOD_alignment_t alignment=TCOD_LEFT, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET) |
| Print a string to a console constrained to a bounding box. | |
| int | get_height_rect (int width, std::string_view str) |
| Return the height of the word-wrapped text with the given width. | |
| TCODLIB_BEGIN_IGNORE_DEPRECATIONS void | print_frame (struct TCOD_Console &console, const std::array< int, 4 > &rect, std::string_view title, const TCOD_ColorRGB *fg, const TCOD_ColorRGB *bg, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET, bool clear=true) |
| template<typename... T> | |
| TCODLIB_END_IGNORE_DEPRECATIONS std::string | stringf (const char *format, T... args) |
| Return a formatted string as a std::string object. | |
| std::vector< tcod::ConsolePtr > | load_xp (const std::filesystem::path &path) |
| Load an array of consoles from a REXPaint file. | |
| void | save_xp (const std::vector< const TCOD_Console * > &consoles, const std::filesystem::path &path, int compress_level=9) |
| Save an array of consoles to a REXPaint file. | |
| auto | new_context (const TCOD_ContextParams ¶ms, TCOD_Error &out_code) -> ContextPtr |
| Initialize and return a new libtcod context. | |
| auto | new_context (const TCOD_ContextParams ¶ms) -> ContextPtr |
| Initialize and return a new libtcod context. | |
| TCOD_Error | set_error (const std::string &msg) |
| Set an error message and return a relevant error code, usually -1. | |
| TCOD_Error | set_error (const std::exception &e) |
| int | check_throw_error (int error) |
| Check and throw error messages. | |
| TCOD_Error | check_throw_error (TCOD_Error error) |
| void | check_path (const std::filesystem::path &path) |
| Throw an exception if the given path does not exist. | |
| void | draw_quartergraphics (TCOD_Console &dest, const TCOD_Image &source, const std::array< int, 2 > &dest_xy={0, 0}, const std::array< int, 4 > &src_rect={0, 0, -1, -1}) |
| Draw a double resolution image on a console using quadrant character glyphs. | |
| template<typename ArrayType> | |
| auto | load_tilesheet (const std::filesystem::path &path, const std::array< int, 2 > &columns_rows, const ArrayType &charmap) -> Tileset |
| Load a tilesheet from a PNG file. | |
| auto | load_bdf (const std::filesystem::path &path) -> TilesetPtr |
| Load a Tileset from a BDF font file. | |
The libtcod namespace.
| typedef std::unique_ptr<struct TCOD_Console, ConsoleDeleter> tcod::ConsolePtr |
A unique pointer to a TCOD_Console.
embed:rst:leading-asterisk .. versionadded:: 1.19
| typedef std::unique_ptr<TCOD_Image, ImageDeleter> tcod::ImagePtr |
A unique pointer to a TCOD_Image.
embed:rst:leading-asterisk .. versionadded:: 1.24
|
inline |
Throw an exception if the given path does not exist.
Used internally.
|
inline |
Check and throw error messages.
Used internally.
|
inline |
Draw a double resolution image on a console using quadrant character glyphs.
| dest | The console to draw to. |
| source | The source image which will be rendered. |
| dest_xy | The upper-left position to where the source will be drawn. |
| source_rect | The {left, top, width, height} region of the source image to draw. A width or height of -1 will use the full size of the image. |
embed:rst:leading-asterisk .. versionadded:: 1.19
|
inline |
Initialize and return a new libtcod context.
| params | Options to configure the new context with. |
embed:rst:leading-asterisk .. versionadded:: 1.19
|
inline |
Initialize and return a new libtcod context.
Also returns an error code for non-critical issues.
| params | Options to configure the new context with. |
| out_code | Will be set to an error code on non-critical issues. |
For critical issues an exception is thrown as usual. Non-critical issues are things such as being unable to create a desired renderer and using to a fallback instead.
embed:rst:leading-asterisk .. versionadded:: 1.19
|
inline |
Set an error message and return a relevant error code, usually -1.
Used internally.
|
inline |
Return a formatted string as a std::string object.
This is a convience function for code using printf-like formatted strings. Newer more modern code might want to use the fmt library instead.
| T | Parameter packed arguments. |
| format | A printf-like format string. |
| args | Any printf-like arguments. |
fmt::sprintf is a faster and safer alternative to this function.
embed:rst:leading-asterisk .. versionadded:: 1.19