[SDL] Creating tiles

Ochal Christophe ochal at kefren.be
Tue Dec 12 12:59:01 PST 2006


On Tue, 2006-12-12 at 20:53 +0000, Peter Mulholland wrote:
> Hello Ochal,
> 
> Tuesday, December 12, 2006, 8:41:00 PM, you wrote:
> 
> > Hi all,
> 
> > I'm currently trying to write a routine to load tiles into an array of
> > *surfaces from a png file, but BlitSurface fails to copy the parts of
> > the image into the proper cells of the array.
> 
> > I'm hoping someone can tell me what i did wrong.
> 
> > Oh, the tiles are actually used to hold a fixed width font sized 10*10.
> <snip>
> 
> 1) Don't do this - you will be wasting RAM. Keep your font as one big
> surface, and use appropriate rects to cut out the letters when you
> render the text

Hmm.... that's true, didn't think about it, thx

> 2) Your tiles array will be full of NULL pointers, so
> SDL_BlitSurface() fails as it doesn't create surfaces.

Well, that explains alot ;)

Thx!





More information about the SDL mailing list