Bmp sprite maps

How can you use a single bmp image as a sprite map and seperate them out
into individual surfaces?

-Josh

It’s not that tough. You just need to set up a library that defines a record/object for the sprite sheet and keeps track of the sprite sizes, and use SDL_BlitSurface with the right rectangle coordinates from the source image.

I’m actually in the middle of writing a library like that. Won’t do too many of the people on this list any good, though, since it’s in Object Pascal. But if you need advice on general principles I can help you out.> ----- Original Message -----

From: jshriver@gmail.com (Joshua Shriver)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Saturday, April 26, 2008 10:38:39 AM
Subject: [SDL] bmp sprite maps

How can you use a single bmp image as a sprite map and seperate them out into individual surfaces?

-Josh

Thank you, I’m still at the beginner stage of learning and didn’t realise
you could give give x/y slices. Since the image I want to use is exact sizes
16x16 it should make it easy to determing the corners. I’ll tinker around
and see what I can do.

Thanks,
JoshOn Sat, Apr 26, 2008 at 1:42 PM, Mason Wheeler wrote:

It’s not that tough. You just need to set up a library that defines a
record/object for the sprite sheet and keeps track of the sprite sizes, and
use SDL_BlitSurface with the right rectangle coordinates from the source
image.

I’m actually in the middle of writing a library like that. Won’t do too
many of the people on this list any good, though, since it’s in Object
Pascal. But if you need advice on general principles I can help you out.

----- Original Message ----
From: Joshua Shriver <@Joshua_Shriver>
To: A list for developers using the SDL library. (includes SDL-announce) <
sdl at lists.libsdl.org>
Sent: Saturday, April 26, 2008 10:38:39 AM
Subject: [SDL] bmp sprite maps

How can you use a single bmp image as a sprite map and seperate them out
into individual surfaces?

-Josh


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah. Check the documentation on SDL_BlitSurface to see how to tell it to draw a certain portion of an image.> ----- Original Message -----

From: jshriver@gmail.com (Joshua Shriver)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Saturday, April 26, 2008 11:10:39 AM
Subject: Re: [SDL] bmp sprite maps

Thank you, I’m still at the beginner stage of learning and didn’t realise you could give give x/y slices. Since
the image I want to use is exact sizes 16x16 it should make it easy to determing the corners. I’ll tinker
around and see what I can do.

Besides blitting to the screen a portion of the image each time, is it
possible to copy the piece to a surface? Then use the surface whenever
needed to blit to the screen?

-JoshOn Sat, Apr 26, 2008 at 2:12 PM, Mason Wheeler wrote:

Yeah. Check the documentation on SDL_BlitSurface to see how to tell it to
draw a certain portion of an image.

Sure is. You can blit to any SDL surface, not just the screen.> ----- Original Message -----

From: jshriver@gmail.com (Joshua Shriver)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Saturday, April 26, 2008 11:15:31 AM
Subject: Re: [SDL] bmp sprite maps

Besides blitting to the screen a portion of the image each time, is it possible to copy the piece to a surface?
Then use the surface whenever needed to blit to the screen?

Wonderful thank you.
-JoshOn Sat, Apr 26, 2008 at 2:16 PM, Mason Wheeler wrote:

Sure is. You can blit to any SDL surface, not just the screen.

What Mason said. It’s pretty straightforward. When I was doing this,
I had a Sprite object defined that had a pointer to an SDL_Surface
that was it’s source sheet and also a Rect object defining the portion
of that Surface that actually comprised the Sprite.

Then I had animated Sprites that had a Surface and an array of Rects
defining various frames of animation, etc, etc.