Function TCOD_sdl2_render_texture

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 and target are valid. You can use TCOD_sdl2_render_texture_setup to automatically prepare these objects for use with this function.

atlas is an SDL2 atlas created with TCOD_sdl2_atlas_new. The renderer used to make this atlas must support SDL_RENDERER_TARGETTEXTURE, unless target 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 as console.

target can be NULL, or be pointer an SDL2 texture used as the output. If target 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 at cache must be cleared, or else the next render will only partially update the texture of target.

Returns a negative value on an error, check TCOD_get_error.

New in version 1.16.