MapSurface

Do I have to perform MapSurface for every bitmap (ie sprite) I intend to use in my game? I’m playing around with a Windows program, so I presume the SDL_PixelFormat will (or should?) conform to that of the desktop.

SDL_Surface *screen;
SDL_Surface *image;

image = SDL_LoadBMP(“c:\data\tile001.bmp”);
screen = SDL_SetVideoMode(800, 600, 16, SDL_HWSURFACE|SDL_HWPALETTE);
SDL_GetDisplayFormat(PixelFormat);
status = SDL_MapSurface(image, PixelFormat);

but the MapSurface fails. I think the tile001.bmp is a bit 24 bit bitmap. Can someone explain what I’m doing wrong?

thanks
Mike

Do I have to perform MapSurface for every bitmap (ie sprite) I intend to use in my game?

In SDL 0.8.x, yes. In SDL 0.9.x, it’s done automatically for you, and
you don’t need to think about it.

I’m playing around with a Windows program, so I presume the SDL_PixelFormat will (or should?) conform to that of the desktop.

Yep.

SDL_Surface *screen;
SDL_Surface *image;

image = SDL_LoadBMP(“c:\data\tile001.bmp”);
screen = SDL_SetVideoMode(800, 600, 16, SDL_HWSURFACE|SDL_HWPALETTE);
SDL_GetDisplayFormat(PixelFormat);
status = SDL_MapSurface(image, PixelFormat);

but the MapSurface fails. I think the tile001.bmp is a bit 24 bit bitmap. Can someone explain what I’m doing wrong?

What is PixelFormat? You should probably use screen->format

Like I said, SDL 0.9.x is nice in that it does the mapping for you. :slight_smile:

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Is there a version of 0.9.8 for VC++ 5.0? I notice on the site there is
only Win GCC and DLL only downloads. I presume I need the updated library
file? Or do I really only need the DLL to go from 0.8x to 0.9x?