SDL_Flip(3)

πŸ’– SDL_Flip(3) πŸ’–

ok so we're in the SDL API Reference bestie, and today's main character is SDL_Flip 🫢


✨ NAME ✨

SDL_Flip β€” swaps screen buffers πŸ”„


🌸 SYNOPSIS 🌸

#include "SDL.h"

int SDL_Flip(SDL_Surface *screen);

πŸ¦‹ DESCRIPTION πŸ¦‹

okok so listen. If your hardware is out here supporting double-buffering, this function literally just sets up a flip and dips β€” returns immediately, no waiting around πŸ’…. The hardware itself will wait for vertical retrace, and then it swaps the video buffers. And that swap happens before the next video surface blit or lock returns. it's giving synchronized, it's giving no tearing, we love to see it ✨

Now if your hardware does NOT support double-buffering? Then bestie, this is literally equivalent to calling SDL_UpdateRect(screen, 0, 0, 0, 0). Same thing, no cap.

🚨 IMPORTANT VIBE CHECK: the SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode when you were setting the video mode. No flag, no hardware flipping. periodt.

πŸŽ€ RETURN VALUE πŸŽ€

  • 0 β€” slayed, it worked πŸ’–
  • -1 β€” nope, there was an error 😭

πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_SetVideoMode
  • SDL_UpdateRect
  • SDL_Surface

and that's the whole page bestie, hope this was iconic for u 🌈 stay hydrated, go flip some buffers πŸ’…

SDL Β· Tue 11 Sep 2001, 23:01 πŸ¦‹ mwah, catch u in the next manpage 🫢✨

πŸ“¦ where this page comes from