A rendering context for libtcod.
More...
#include <context.h>
|
|
auto | get_renderer_type () noexcept -> int |
| | Return the TCOD_renderer_t value of this context which may be different than the one requested.
|
| void | present (const TCOD_Console &console, const TCOD_ViewportOptions &viewport) |
| | Present a console to the display with the provided viewport options.
|
| void | present (const TCOD_Console &console) |
| | Present a console to the display.
|
| auto | get_sdl_window () noexcept -> struct SDL_Window * |
| | Return a non-owning pointer to the SDL_Window used by this context.
|
| auto | get_sdl_renderer () noexcept -> struct SDL_Renderer * |
| | Return a non-owning pointer to the SDL_Renderer used by this context.
|
| auto | pixel_to_tile_coordinates (const std::array< int, 2 > &xy) -> std::array< int, 2 > |
| | Convert pixel coordinates to this contexts integer tile coordinates.
|
| auto | pixel_to_tile_coordinates (const std::array< double, 2 > &xy) -> std::array< double, 2 > |
| | Convert pixel coordinates to this contexts sub-tile coordinates.
|
| void | convert_event_coordinates (SDL_Event &event) |
| | Convert the pixel coordinates of SDL mouse events to the tile coordinates of the current context.
|
| void | save_screenshot (const char *filepath) |
| | Save a screenshot to filepath.
|
| void | save_screenshot (const std::string &filepath) |
| | Save a screenshot to filepath.
|
| auto | new_console (int min_columns=1, int min_rows=1, float magnification=1.0f) -> tcod::Console |
| | Return a new console with a size automatically determined by the context.
|
A rendering context for libtcod.
embed:rst:leading-asterisk
.. versionadded:: 1.16
◆ convert_event_coordinates()
| void TCOD_Context::convert_event_coordinates |
( |
SDL_Event & | event | ) |
|
|
inline |
Convert the pixel coordinates of SDL mouse events to the tile coordinates of the current context.
- Parameters
-
| event | Any SDL_Event event. If the event type is compatible then its coordinates will be converted into tile coordinates. |
embed:rst:leading-asterisk
.. versionadded:: 1.19
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ get_sdl_renderer()
| auto TCOD_Context::get_sdl_renderer |
( |
| ) |
->structSDL_Renderer * |
|
inlinenoexcept |
Return a non-owning pointer to the SDL_Renderer used by this context.
- Returns
- A struct SDL_Renderer* pointer. This will be nullptr if this context does not use SDL's renderer.
embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ get_sdl_window()
| auto TCOD_Context::get_sdl_window |
( |
| ) |
->structSDL_Window * |
|
inlinenoexcept |
Return a non-owning pointer to the SDL_Window used by this context.
- Returns
- A struct SDL_Window* pointer. This will be nullptr if this context does not use an SDL window.
embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ new_console()
| auto TCOD_Context::new_console |
( |
int | min_columns = 1, |
|
|
int | min_rows = 1, |
|
|
float | magnification = 1.0f )->tcod::Console |
|
inline |
Return a new console with a size automatically determined by the context.
- Parameters
-
| min_columns | The minimum width to use for the new console, in tiles. |
| min_rows | The minimum height to use for the new console, in tiles. |
| magnification | Determines the apparent size of the tiles that will be rendered by a console created with the output values. A magnification larger then 1.0f will output smaller console parameters, which will show as larger tiles when presented. Only values larger than zero are allowed. |
- Returns
- Returns a tcod::Console of a dynamic size.
embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ pixel_to_tile_coordinates() [1/2]
| auto TCOD_Context::pixel_to_tile_coordinates |
( |
const std::array< double, 2 > & | xy | ) |
->std::array< double, 2 > |
|
inline |
Convert pixel coordinates to this contexts sub-tile coordinates.
embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ pixel_to_tile_coordinates() [2/2]
| auto TCOD_Context::pixel_to_tile_coordinates |
( |
const std::array< int, 2 > & | xy | ) |
->std::array< int, 2 > |
|
inline |
Convert pixel coordinates to this contexts integer tile coordinates.
embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
◆ present() [1/2]
Present a console to the display.
- Parameters
-
| console | The TCOD_Console to render. This console can be any size and will be stretched to fit the window. embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
|
◆ present() [2/2]
Present a console to the display with the provided viewport options.
- Parameters
-
| console | The TCOD_Console to render. This console can be any size. |
| viewport | The viewport options, which can change the way the console is scaled. embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
|
◆ save_screenshot() [1/2]
| void TCOD_Context::save_screenshot |
( |
const char * | filepath | ) |
|
|
inline |
Save a screenshot to filepath.
- Parameters
-
| filepath | The file path to save the screenshot at. If nullptr then a unique file name will be generated. embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
|
◆ save_screenshot() [2/2]
| void TCOD_Context::save_screenshot |
( |
const std::string & | filepath | ) |
|
|
inline |
Save a screenshot to filepath.
- Parameters
-
| filepath | The file path to save the screenshot at. embed:rst:leading-asterisk
.. deprecated:: 1.21
Replace ``tcod::new_console(params)`` with ``tcod::Context(params)`` to get a C++ context.
|
The documentation for this struct was generated from the following file:
- C:/Users/4b796/Projects/libtcod/src/libtcod/context.h