Function TCOD_sdl2_render_texture¶
Defined in File renderer_sdl2.h
Function Documentation¶
-
TCOD_Error TCOD_sdl2_render_texture(const struct TCOD_TilesetAtlasSDL2 *atlas, const struct TCOD_Console *console, struct TCOD_Console *cache, struct SDL_Texture *target)¶
Render a console onto a managed target texture.
This function assumes that
cache
andtarget
are valid. You can useTCOD_sdl2_render_texture_setup
to automatically prepare these objects for use with this function.atlas
is an SDL2 atlas created withTCOD_sdl2_atlas_new
. The renderer used to make thisatlas
must supportSDL_RENDERER_TARGETTEXTURE
, unlesstarget
is NULL.console
is a non-NULL pointer to the libtcod console you want to render.cache
can be NULL, or point to a console the same size asconsole
.target
can be NULL, or be pointer an SDL2 texture used as the output. Iftarget
is not NULL then it should be the size of the console times the size of the individual tiles to fit the entire output.If
target
is NULL then the current render target is used instead, the drawn area will not be scaled to fit the render target.If SDL2 ever provides a
SDL_RENDER_TARGETS_RESET
event then the console atcache
must be cleared, or else the next render will only partially update the texture oftarget
.Returns a negative value on an error, check
TCOD_get_error
.New in version 1.16.