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.
atlasis an SDL2 atlas created withTCOD_sdl2_atlas_new. The renderer used to make thisatlasmust supportSDL_RENDERER_TARGETTEXTURE.consoleis a non-NULL pointer to the libtcod console you want to render.cachecan be NULL, or be pointer to a console pointer. If*cacheis NULL then a console will be created. If*cacheisn’t NULL then the console pointed to might be deleted or recreated if it does not match the size ofconsole.targetmust be a pointer to where you want the output texture to be placed. The texture at*targetmay be deleted or recreated. When this function is successful then the texture at*targetwill be non-NULL and will be exactly fitted to the size ofconsoleand the tile size ofatlas.If SDL2 ever provides a
SDL_RENDER_TARGETS_RESETevent then the console at*cachemust 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.Added in version 1.16.