present method

bool present()

Update the screen with any rendering performed since the previous call.

SDL's rendering functions operate on a backbuffer; that is, calling a rendering function such as SDL_RenderLine() does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.

Therefore, when using SDL's rendering API, one does all drawing intended for the frame, and then calls this function once per frame to present the final drawing to the user.

The backbuffer should be considered invalidated after each present; do not assume that previous contents will exist between frames. You are strongly encouraged to call SDL_RenderClear() to initialize the backbuffer before starting each new frame's drawing, even if you plan to overwrite every pixel.

Please note, that in case of rendering to a texture - there is no need to call SDL_RenderPresent after drawing needed objects to a texture, and should not be done; you are only required to change back the rendering target to default via SDL_SetRenderTarget(renderer, NULL) afterwards, as textures by themselves do not have a concept of backbuffers. Calling SDL_RenderPresent while rendering to a texture will still update the screen with any current drawing that has been done to the window itself.

\param renderer the rendering context. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_CreateRenderer \sa SDL_RenderClear \sa SDL_RenderFillRect \sa SDL_RenderFillRects \sa SDL_RenderLine \sa SDL_RenderLines \sa SDL_RenderPoint \sa SDL_RenderPoints \sa SDL_RenderRect \sa SDL_RenderRects \sa SDL_SetRenderDrawBlendMode \sa SDL_SetRenderDrawColor

extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer)

Implementation

bool present() {
  return sdlRenderPresent(this);
}