World Producer
World Producer

Reputation: 39

SDL function to clear only part of the screen?

I am using C++ and SDL 2. Is there any function in SDL or any available algorithm to clear only a part of the screen?

I tried using SDL_RenderSetViewPort() in the following way but it didn't work:

SDL_RenderSetViewPort(renderer,&rect); 
SDL_RenderClear(renderer);

I thought that the specific texture present in the given rectangle part would be cleared but it didn't.

Upvotes: 0

Views: 443

Answers (1)

genpfault
genpfault

Reputation: 52082

SDL_SetRenderDrawColor() with the clear color then SDL_RenderFillRect() with the desired region to 'clear'.

Upvotes: 3

Related Questions