In my code I want to connect (or combine) multiple SDL_Texture
or array into one SDL_Texture
which will contain images each put down under another.
It may look just like this
SDL_Texture* t1 = SDL_CreateTextureFromSurface(my_renderer, someSurface);
SDL_Texture* t2 = SDL_CreateTextureFromSurface(my_renderer, someOtherSurface);
//Some SDL code manipulations to make one SDL_Texture which contains t1 and t2
Any suggestions?
You need to create your target_texture or something like this:
SDL_Texture* target_tex =SDL_CreateTexture(.....); //Add arg according to you
SDL_SetRenderTarget(my_renderer, target_tex);
SDL_Texture* t1 = SDL_CreateTextureFromSurface(my_renderer, someSurface);
SDL_Texture* t2 = SDL_CreateTextureFromSurface(my_renderer, someOtherSurface);
.
.
.
.
SDL_RenderCopy(my_renderer, t1, NULL, NULL);
SDL_RenderCopy(my_renderer, t2, NULL, NULL);
SDL_RenderCopy(my_renderer, t3, NULL, NULL);
.
.
.
SDL_SetRenderTarget(my_renderer, NULL);
SDL_RendererPresent(my_renderer);
SDL_RenderClear(my_renderer);
SDL_RenderCopy(my_renderer, target_tex, NULL, NULL);
SDL_RendererPresent(my_renderer);