libtcod
Loading...
Searching...
No Matches
console.hpp
Go to the documentation of this file.
1/* BSD 3-Clause License
2 *
3 * Copyright © 2008-2025, Jice and the libtcod contributors.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
34#pragma once
35#ifndef TCOD_CONSOLE_HPP_
36#define TCOD_CONSOLE_HPP_
37
38#include <stdexcept>
39#include <string>
40#include <utility>
41
42#include "color.hpp"
43#include "console.h"
44#include "console_drawing.h"
45#include "console_etc.h"
46#include "console_init.h"
47#include "console_printing.h"
48#include "console_rexpaint.h"
49#include "console_types.h"
50#include "image.hpp"
51namespace tcod {
54
65inline void blit(
66 TCOD_Console& dest,
67 const TCOD_Console& source,
68 const std::array<int, 2>& dest_xy = {0, 0},
69 std::array<int, 4> source_rect = {0, 0, 0, 0},
70 float foreground_alpha = 1.0f,
71 float background_alpha = 1.0f) {
73 &source,
74 source_rect.at(0),
75 source_rect.at(1),
76 source_rect.at(2),
77 source_rect.at(3),
78 &dest,
79 dest_xy.at(0),
80 dest_xy.at(1),
81 foreground_alpha,
82 background_alpha);
83}
84
85} // namespace tcod
86
89// clang-format off
90
91class TCODImage;
135
136// clang-format on
137class TCODLIB_API TCODConsole {
138 public:
139
146 TCODConsole() = default;
147 // clang-format off
153
154 static TCODConsole *root;
155
193 [[deprecated("This way of initializing libtcod is deprecated. See the documentation for how to use tcod::new_context.")]]
194 static void initRoot(int w, int h, const char * title, bool fullscreen = false, TCOD_renderer_t renderer=TCOD_RENDERER_SDL);
195
270 // clang-format on
271 [[deprecated(
272 "This function is not compatible with contexts."
273 " Consider using tcod::load_tilesheet or TCOD_tileset_load instead."
274 " https://libtcod.readthedocs.io/en/latest/upgrading.html")]] static void
276 const char* fontFile, int flags = TCOD_FONT_LAYOUT_ASCII_INCOL, int nbCharHoriz = 0, int nbCharVertic = 0);
277 // clang-format off
294 [[deprecated("This function is not compatible with contexts.")]]
295 static void mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY);
296
309 [[deprecated("This function is not compatible with contexts.")]]
310 static void mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY);
311
323 [[deprecated("This function is not compatible with contexts.")]]
324 static void mapStringToFont(const char *s, int fontCharX, int fontCharY);
325
338 [[deprecated("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")]]
339 static bool isFullscreen();
373 [[deprecated("This function is not compatible with contexts. Use SDL_SetWindowFullscreen to set this state.")]]
374 static void setFullscreen(bool fullscreen);
375
390 [[deprecated("This function is not compatible with contexts. Use SDL_SetWindowTitle to change the window title.")]]
391 static void setWindowTitle(const char *title);
392
403 [[deprecated("This function is not compatible with contexts. Use SDL for events and check for SDL_QUIT.")]]
404 static bool isWindowClosed();
405
414 [[deprecated("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")]]
415 static bool hasMouseFocus();
416
425 [[deprecated("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")]]
426 static bool isActive();
427
442 [[deprecated("This function is not compatible with contexts. Consider using `TCOD_console_credits_render_ex`.")]]
443 static void credits();
444
494 [[deprecated("This function is not compatible with contexts. Consider using `TCOD_console_credits_render_ex`.")]]
495 static bool renderCredits(int x, int y, bool alpha);
496
507 [[deprecated]]
508 static void resetCredits();
509
515
534 [[deprecated("Default console parameters are deprecated.")]]
536
553 [[deprecated("Default console parameters are deprecated.")]]
555
570 void clear();
571
592 [[deprecated]]
593 void setCharBackground(int x, int y, const TCODColor &col, TCOD_bkgnd_flag_t flag = TCOD_BKGND_SET);
609 [[deprecated]]
610 void setCharForeground(int x, int y, const TCODColor &col);
611
628 [[deprecated]]
629 void setChar(int x, int y, int c);
630
654 [[deprecated]]
655 void putChar(int x, int y, int c, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT);
656
676 [[deprecated]]
677 void putCharEx(int x, int y, int c, const TCODColor &fore, const TCODColor &back);
678
703
719 [[deprecated("Default console parameters are deprecated.")]]
721
734 [[deprecated("Default console parameters are deprecated.")]]
736
752 [[deprecated("Default console parameters are deprecated.")]]
754
769 [[deprecated("Default console parameters are deprecated.")]]
779 [[deprecated("Use TCODConsole::printf or the std::string overload for this function."
780 "\nNote that you'll need to use UTF-8 encoded strings for those functions.")]]
781 void print(int x, int y, const char *fmt, ...);
782#ifndef TCOD_NO_UNICODE
792 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print.")]]
793 void print(int x, int y, const std::string &str);
801 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print.")]]
802 void print(int x, int y, const std::string &str,
803 TCOD_alignment_t alignment, TCOD_bkgnd_flag_t flag);
813 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print and tcod::stringf.")]]
814 TCODLIB_FORMAT(4, 5)
815 void printf(int x, int y, const char *fmt, ...);
823 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print and tcod::stringf.")]]
824 TCODLIB_FORMAT(6, 7)
825 void printf(int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment,
826 const char *fmt, ...);
827#endif // TCOD_NO_UNICODE
836 [[deprecated(
837 "Use TCODConsole::print (std::string overload) or TCODConsole::printf"
838 "instead of this function."
839 "\nNote that you'll need to use UTF-8 encoded strings for those functions.")]]
840 void printEx(int x, int y, TCOD_bkgnd_flag_t flag,
841 TCOD_alignment_t alignment, const char *fmt, ...);
864 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print_rect and tcod::stringf.")]]
865 TCODLIB_FORMAT(6, 7)
866 int printRect(int x, int y, int w, int h, const char *fmt, ...);
867
892 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print_rect and tcod::stringf.")]]
893 TCODLIB_FORMAT(8, 9)
894 int printRectEx(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag,
895 TCOD_alignment_t alignment, const char *fmt, ...);
896
914 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::get_height_rect.")]]
915 TCODLIB_FORMAT(6, 7)
916 int getHeightRect(int x, int y, int w, int h, const char *fmt, ...);
917
983 static void setColorControl(TCOD_colctrl_t con, const TCODColor &fore, const TCODColor &back);
984
985#ifndef NO_UNICODE
994 static void mapStringToFont(const wchar_t *s, int fontCharX, int fontCharY);
1000 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print and tcod::stringf.")]]
1001 void print(int x, int y, const wchar_t *fmt, ...);
1007 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print and tcod::stringf.")]]
1008 void printEx(int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt, ...);
1014 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print_rect and tcod::stringf.")]]
1015 int printRect(int x, int y, int w, int h, const wchar_t *fmt, ...);
1016
1022 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::print_rect and tcod::stringf.")]]
1023 int printRectEx(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt, ...);
1024
1030 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::get_height_rect.")]]
1031 int getHeightRect(int x, int y, int w, int h, const wchar_t *fmt, ...);
1032#endif
1033
1062 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::draw_rect.")]]
1063 void rect(int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT);
1064
1085 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::draw_rect.")]]
1086 void hline(int x,int y, int l, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT);
1087
1108 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::draw_rect.")]]
1109 void vline(int x,int y, int l, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT);
1110
1141 [[deprecated("TCODConsole methods are deprecated, this call should be replaced with tcod::draw_frame.")]]
1142 TCODLIB_FORMAT(8, 9)
1143 void printFrame(int x,int y,int w,int h, bool clear=true, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT, const char *fmt=NULL, ...);
1144
1158 int getWidth() const;
1159
1171 int getHeight() const;
1172
1184 [[deprecated("Default console parameters are deprecated.")]]
1186
1198 [[deprecated("Default console parameters are deprecated.")]]
1200
1215 [[deprecated]]
1216 TCODColor getCharBackground(int x, int y) const;
1217
1232 [[deprecated]]
1233 TCODColor getCharForeground(int x, int y) const;
1234
1249 [[deprecated]]
1250 int getChar(int x, int y) const;
1251
1287 [[deprecated("This function does not support contexts.")]]
1288 static void setFade(uint8_t fade, const TCODColor &fadingColor);
1289
1300 static uint8_t getFade();
1301
1313
1326 [[deprecated("This function does not support contexts.")]]
1327 static void flush();
1328
1437
1445
1446 /* deprecated as of 1.5.1 */
1447 [[deprecated("This API is deprecated, use SDL_WaitEvent instead.")]]
1449 /* deprecated as of 1.5.1 */
1450 [[deprecated("This API is deprecated, use SDL_PollEvent instead.")]]
1451 static TCOD_key_t checkForKeypress(int flags=TCOD_KEY_RELEASED);
1452
1460
1474
1513 TCODConsole(int w, int h);
1514
1528 TCODConsole(const char *filename);
1529
1547 bool loadAsc(const char *filename);
1567 bool loadApf(const char *filename);
1568
1582 bool saveAsc(const char *filename) const;
1583
1597 bool saveApf(const char *filename) const;
1598
1599#ifndef TCOD_NO_ZLIB
1600 bool loadXp(const char *filename) {
1601 return TCOD_console_load_xp(data.get(), filename) != 0;
1602 }
1603 bool saveXp(const char *filename, int compress_level) {
1604 return TCOD_console_save_xp(data.get(), filename, compress_level) != 0;
1605 }
1606#endif // TCOD_NO_ZLIB
1607
1699 [[deprecated("This function has been replaced by tcod::blit.")]]
1700 static void blit(const TCODConsole *src,int xSrc, int ySrc, int wSrc, int hSrc, TCODConsole *dst, int xDst, int yDst, float foreground_alpha=1.0f, float background_alpha=1.0f);
1713 void setKeyColor(const TCODColor &col);
1741 [[deprecated("This function is a stub and will do nothing.")]]
1742 static void setKeyboardRepeat(int initialDelay,int interval);
1743 [[deprecated("This function is a stub and will do nothing.")]]
1744 static void disableKeyboardRepeat();
1745 // clang-format on
1746
1747 [[deprecated("This function does nothing.")]] void setDirty(int x, int y, int w, int h);
1748
1749 // This conversion may be unsafe.
1750 TCODConsole(TCOD_Console* console) : data{console} {}
1751
1757 explicit TCODConsole(tcod::ConsolePtr console) : data{std::move(console)} {}
1758
1759 // ctrl = TCOD_COLCTRL_1...TCOD_COLCTRL_5 or TCOD_COLCTRL_STOP
1760 static const char* getColorControlString(TCOD_colctrl_t ctrl);
1761 // ctrl = TCOD_COLCTRL_FORE_RGB or TCOD_COLCTRL_BACK_RGB
1762 static const char* getRGBColorControlString(TCOD_colctrl_t ctrl, const TCODColor& col);
1763
1772 [[nodiscard]] auto get_data() noexcept -> TCOD_Console* { return get(); }
1773 [[nodiscard]] auto get_data() const noexcept -> const TCOD_Console* { return get(); }
1774
1782 [[nodiscard]] auto get() noexcept -> TCOD_Console* {
1783 if (!data) return TCOD_sys_get_internal_console();
1784 return data.get();
1785 }
1786 [[nodiscard]] auto get() const noexcept -> const TCOD_Console* {
1787 if (!data) return TCOD_sys_get_internal_console();
1788 return data.get();
1789 }
1790
1797 [[nodiscard]] operator TCOD_Console&() {
1798 TCOD_Console* out = data.get();
1799 if (!out) out = TCOD_sys_get_internal_console();
1800 if (!out) throw std::logic_error("Tried to get a reference to nullptr.");
1801 return *out;
1802 };
1803
1810 [[nodiscard]] operator const TCOD_Console&() const {
1811 const TCOD_Console* out = data.get();
1812 if (!out) out = TCOD_sys_get_internal_console();
1813 if (!out) throw std::logic_error("Tried to get a reference to nullptr.");
1814 return *out;
1815 };
1816
1823 [[nodiscard]] explicit operator TCOD_Console*() noexcept { return get_data(); };
1824
1831 [[nodiscard]] explicit operator const TCOD_Console*() const noexcept { return get_data(); };
1832
1833 private:
1834 tcod::ConsolePtr data{};
1835};
1836
1837#endif // TCOD_CONSOLE_HPP_
Definition color.hpp:221
TCOD_alignment_t getAlignment() const
This function returns the default alignment (see TCOD_alignment_t) for the console.
int getHeightRect(int x, int y, int w, int h, const char *fmt,...)
This function returns the expected height of an auto-wrapped string without actually printing the str...
static TCODColor getFadingColor()
This function returns the current fading color, previously defined by setFade.
void printf(int x, int y, const char *fmt,...)
Format and print a UTF-8 string to the console.
TCODConsole(tcod::ConsolePtr console)
Construct a new TCODConsole object from a tcod::ConsolePtr.
Definition console.hpp:1757
void setDefaultBackground(TCODColor back)
This function changes the default background color for a console.
void setAlignment(TCOD_alignment_t alignment)
This function defines the default alignment (see TCOD_alignment_t) for the console.
void putCharEx(int x, int y, int c, const TCODColor &fore, const TCODColor &back)
This function modifies every property of a cell : set the cell's background color to back.
static void mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY)
void putChar(int x, int y, int c, TCOD_bkgnd_flag_t flag=TCOD_BKGND_DEFAULT)
This function modifies every property of a cell : update the cell's background color according to the...
static bool isWindowClosed()
When you start the program, this returns false.
void rect(int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag=TCOD_BKGND_DEFAULT)
Fill a rectangle inside a console.
void printFrame(int x, int y, int w, int h, bool clear=true, TCOD_bkgnd_flag_t flag=TCOD_BKGND_DEFAULT, const char *fmt=NULL,...)
This function calls the rect function using the supplied background mode flag, then draws a rectangle...
void print(int x, int y, const std::string &str, TCOD_alignment_t alignment, TCOD_bkgnd_flag_t flag)
Print a UTF-8 string to the console with specific alignment and blend mode.
int getHeight() const
This function returns the height of a console (either the root console or an offscreen console).
static void mapStringToFont(const wchar_t *s, int fontCharX, int fontCharY)
those functions are similar to their ASCII equivalent, but work with unicode strings (wchar_t in C/C+...
TCODConsole()=default
Default constructor.
int printRect(int x, int y, int w, int h, const char *fmt,...)
This function draws a string in a rectangle inside the console, using default colors,...
static void setKeyboardRepeat(int initialDelay, int interval)
Use this function to destroy an offscreen console and release any resources allocated.
int getWidth() const
This function returns the width of a console (either the root console or an offscreen console).
static bool isActive()
Returns false if the game window is not the active window or is iconified.
TCODColor getDefaultBackground() const
This function returns the default background color of a console.
void print(int x, int y, const std::string &str)
Print an EASCII encoded string to the console.
static bool isKeyPressed(TCOD_keycode_t key)
The preferred way to check for user input is to use checkForEvent below, but you can also get the sta...
static void initRoot(int w, int h, const char *title, bool fullscreen=false, TCOD_renderer_t renderer=TCOD_RENDERER_SDL)
static void TCODConsole::initRoot(int w, int h, string title) static void TCODConsole::initRoot(int w...
void vline(int x, int y, int l, TCOD_bkgnd_flag_t flag=TCOD_BKGND_DEFAULT)
Draws an vertical line in the console, using ASCII code TCOD_CHAR_VLINE (179), and the console's defa...
static uint8_t getFade()
This function returns the current fade amount, previously defined by setFade.
static void setWindowTitle(const char *title)
This function dynamically changes the title of the game window.
static bool isFullscreen()
This function returns true if the current mode is fullscreen.
static void setColorControl(TCOD_colctrl_t con, const TCODColor &fore, const TCODColor &back)
If you want to draw a string using different colors for each word, the basic solution is to call a st...
void setChar(int x, int y, int c)
This function modifies the ASCII code of a cell, leaving other properties (background and foreground ...
void print(int x, int y, const char *fmt,...)
Print an EASCII formatted string to the console.
static TCOD_key_t waitForKeypress(bool flush)
Some useful graphic characters in the terminal.bmp font.
auto get_data() noexcept -> TCOD_Console *
Return a pointer to the underlying TCOD_Console struct.
Definition console.hpp:1772
void setCharForeground(int x, int y, const TCODColor &col)
This function modifies the foreground color of a cell, leaving other properties (background color and...
static void mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)
bool loadApf(const char *filename)
You can load data from a file created with Ascii Paint with this function.
static bool renderCredits(int x, int y, bool alpha)
You can also print the credits on one of your game screens (your main menu for example) by calling th...
static void setCustomFont(const char *fontFile, int flags=TCOD_FONT_LAYOUT_ASCII_INCOL, int nbCharHoriz=0, int nbCharVertic=0)
This function allows you to use a bitmap font (png or bmp) with custom character size or layout.
bool saveApf(const char *filename) const
You can save data from a console to Ascii Paint format with this function.
int getChar(int x, int y) const
This function returns the ASCII code of a cell.
auto get() noexcept -> TCOD_Console *
Return a pointer to the underlying TCOD_Console struct.
Definition console.hpp:1782
bool loadAsc(const char *filename)
You can load data from a file created with Ascii Paint with this function.
static bool hasMouseFocus()
Returns true if the mouse cursor is inside the game window area and the game window is the active app...
TCOD_bkgnd_flag_t getBackgroundFlag() const
This function returns the background mode (see TCOD_bkgnd_flag_t) for the console.
static void setFade(uint8_t fade, const TCODColor &fadingColor)
This function defines the fading parameters, allowing to easily fade the game screen to/from a color....
void printEx(int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
Print an EASCII formatted string to the console.
static void resetCredits()
When using renderCredits, you can restart the credits animation from the beginning before it's finish...
TCODColor getCharForeground(int x, int y) const
This function returns the foreground color of a cell.
static void setFullscreen(bool fullscreen)
This function switches the root console to fullscreen or windowed mode.
static void mapStringToFont(const char *s, int fontCharX, int fontCharY)
TCODColor getDefaultForeground() const
This function returns the default foreground color of a console.
void setBackgroundFlag(TCOD_bkgnd_flag_t flag)
This function defines the background mode (see TCOD_bkgnd_flag_t) for the console.
static void flush()
Once the root console is initialized, you can use one of the printing functions to change the backgro...
void setDefaultForeground(TCODColor fore)
This function changes the default foreground color for a console.
TCODColor getCharBackground(int x, int y) const
This function returns the background color of a cell.
static void blit(const TCODConsole *src, int xSrc, int ySrc, int wSrc, int hSrc, TCODConsole *dst, int xDst, int yDst, float foreground_alpha=1.0f, float background_alpha=1.0f)
This function allows you to blit a rectangular area of the source console at a specific position on a...
void setCharBackground(int x, int y, const TCODColor &col, TCOD_bkgnd_flag_t flag=TCOD_BKGND_SET)
This function modifies the background color of a cell, leaving other properties (foreground color and...
void setKeyColor(const TCODColor &col)
This function defines a transparent background color for an offscreen console.
static void credits()
You can print a "Powered by libtcod x.y.z" screen during your game startup simply by calling this fun...
void clear()
This function modifies all cells of a console : set the cell's background color to the console defaul...
bool saveAsc(const char *filename) const
You can save data from a console to Ascii Paint format with this function.
void hline(int x, int y, int l, TCOD_bkgnd_flag_t flag=TCOD_BKGND_DEFAULT)
Draws an horizontal line in the console, using ASCII code TCOD_CHAR_HLINE (196), and the console's de...
int printRectEx(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
This function draws a string in a rectangle inside the console, using default colors,...
Definition image.hpp:60
Color handling module.
Various console functions.
Console simple drawing module.
Miscellaneous deprecated functions.
Deprecated root console initialization.
TCOD_Console * TCOD_sys_get_internal_console(void)
Return a pointer to the "root console" used internally by the old API.
Console string printing module.
REXPaint support.
C types for console functions.
TCOD_keycode_t
Libtcod specific codes representing keys on the keyboard.
Definition console_types.h:126
@ TCOD_FONT_LAYOUT_ASCII_INCOL
Tiles are arranged in column-major order.
Definition console_types.h:467
TCOD_renderer_t
Libtcod rendering modes.
Definition console_types.h:491
@ TCOD_RENDERER_SDL
A software based renderer.
Definition console_types.h:517
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.
Definition console.hpp:65
void TCOD_console_blit(const TCOD_Console *src, int xSrc, int ySrc, int wSrc, int hSrc, TCOD_Console *dst, int xDst, int yDst, float foreground_alpha, float background_alpha)
Blit from one console to another.
TCOD_alignment_t
Print justification options.
Definition console.h:81
TCOD_bkgnd_flag_t
Background color blend modes.
Definition console.h:60
bool TCOD_console_load_xp(TCOD_Console *con, const char *filename)
Update a console from a REXPaint .xp file.
bool TCOD_console_save_xp(const TCOD_Console *con, const char *filename, int compress_level)
Save a console as a REXPaint .xp file.
Image handling module.
The libtcod namespace.
Definition bresenham.hpp:157
std::unique_ptr< struct TCOD_Console, ConsoleDeleter > ConsolePtr
A unique pointer to a TCOD_Console.
Definition console_types.hpp:56
A libtcod console containing a grid of tiles with {ch, fg, bg} information.
Definition console.h:125
Libtcod key event data, as a keycode or text character.
Definition console_types.h:207