Function TCOD_sdl2_render_texture_setup¶
Defined in File renderer_sdl2.h
Function Documentation¶
-
TCOD_Error TCOD_sdl2_render_texture_setup(const struct TCOD_TilesetAtlasSDL2 *atlas, const struct TCOD_Console *console, struct TCOD_Console **cache, struct SDL_Texture **target)¶
Setup a cache and target texture for rendering.
atlas
is an SDL2 atlas created withTCOD_sdl2_atlas_new
. The renderer used to make thisatlas
must supportSDL_RENDERER_TARGETTEXTURE
.console
is a non-NULL pointer to the libtcod console you want to render.cache
can be NULL, or be pointer to a console pointer. If*cache
is NULL then a console will be created. If*cache
isn’t NULL then the console pointed to might be deleted or recreated if it does not match the size ofconsole
.target
must be a pointer to where you want the output texture to be placed. The texture at*target
may be deleted or recreated. When this function is successful then the texture at*target
will be non-NULL and will be exactly fitted to the size ofconsole
and the tile size ofatlas
.If SDL2 ever provides a
SDL_RENDER_TARGETS_RESET
event then the console at*cache
must be deleted and set to NULL, or else the next render will only partially update the texture at*target
.Returns a negative value on an error, check
TCOD_get_error
.New in version 1.16.