[SDL] ANNOUNCE: PrBoom 2.2.3 released

Florian Schulze florian.proff.schulze at gmx.net
Sat Jul 27 15:50:01 PDT 2002

On Tue, 2002-07-16 at 13:11, Carlos wrote:
> 	#if SDL_BYTEORDER == SDL_BIG_ENDIAN //setup mask colors
> 	  rmask = 0xff000000;
> 	  gmask = 0x00ff0000;
> 	  bmask = 0x0000ff00;
> 	  amask = 0x000000ff;
> 	#else
> 	  rmask = 0x000000ff;
> 	  gmask = 0x0000ff00;
> 	  bmask = 0x00ff0000;
> 	  amask = 0xff000000;
> 	#endif

These are bitmasks for 32bit bitmaps...

> 	test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);

And you are passing the to a 16bit bitmap.

Use this:

        test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,

You should also remeber some other details (maybe they are only missing
because it's a test program):

The most important thing is that almost any target supports HWSURFACEs
or DBUFFERing on a windowed context, so you will not get what you want
from your SDL_SetVideoMode call. Also, on windowed apps, if you can,
stick to the desktop display pixelformat, otherwise you can have big
performance losses. You only have to specify depth = 0 to obtain this.

Remember to use:

#include "SDL.h"

instead of

#include <SDL/SDL.h>

Check the SDL_Init() returncode, if it's <0 it's quite sure you cannot
obtain what you ask from SDL so you have to abort...

If you use exit() to quit the program add:


just after a successfull SDL_Init();


More information about the SDL mailing list