Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change SDL background

Is there any way to change the color of an empty SDL window to be white instead of black? I don't want to change any default settings. I'm just trying to change it for this particular program that I'm writing. I don't want to use an image file, but if I have to, I will.

I don't know if this matters, but I'm using SDL_SetVideoMode()

My code is very basic:

if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
    return 1;

SDL_Surface * screen = NULL;

screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE);

SDL_FillRect(screen, NULL, 0xFFFFFF);
SDL_Delay(3000);
like image 766
calccrypto Avatar asked Dec 06 '22 20:12

calccrypto


1 Answers

You need to call SDL_Flip for your changes to show up.

like image 176
Benjamin Lindley Avatar answered Dec 09 '22 10:12

Benjamin Lindley