[SDL] Trying to display a colored surface

Sam Lantinga slouken at devolution.com
Mon Jul 15 10:42:00 PDT 2002

> I will explain better my problem...
> I have no error but I still get a black screen

I see two problems:

> ***
> SDL_Rect r;
> r.x = 150; r.y=150; //this mean that I want to place "test" at position 150,150 in the screen, right ?
> ***

You need to fill in the width and height members of the rect so the blit
will work.

> ***
> SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is a 1024x768x16 window
> SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white
> ***

These values may work, but the third parameter is a _pixel_, the format
of which may vary depending on the format of the destination surface.

See ya,
	-Sam Lantinga, Software Engineer, Blizzard Entertainment

More information about the SDL mailing list