- I’m going to start work on a tile-based game, and I’m just figuring out
the techniques I’m going to use now. One of the things I need to do is load
an image that contains all the tiles, then do some automated manipulation
of the RGB values. After that I need to convert it to the screen format
(I presume). What would be the best way of achieving this?
You’ve already gotten fine answers to screen format conversion, but you
may also want to know how to grab sections of the image for tiles (other
than simply just blitting from the main image as source with an indexed
array of rect’s corresponding to each tile).
There’s a fine example of this at
http://www.libsdl.org/projects/scrap/index.html
- Also, having done that, would I be better off splitting each tile into a
separate surface, or would it be better to do rectangle blits when the tile
is required?
I’m sure this would depend on a great many factors, and you’d have to come
up with the solution best fitting your needs. (I.e., will /all/ the tiles
be used making keeping the one big tile around a better option, or can we
have a smaller memory footprint with only a few tiles and surfaces).
Plus, you’ll also want to look at picture size, color depth (if that’s an
issue) and other junk.
Also, pertaining to the first question (SDL_image into SDL), I think it is
the thin-layer idea put forth previously that is the reason it’s not in
SDL. Truthfully, SDL_image in SDL would cause more bloat… say
you’re only using JPEG images files, then you wouldn’t need the other
image filetype loaders.
You could always elliminate the need for SDL_image altogther by
cut/pasting those specific functions you need into an included file of
your own, thus making installing of your software easier for the end-user
as they don’t need SDL_image on their system. (Which is what I intend to
do in the future 
I’m sure the same thing goes for SDL_mixer, SDL_net, and the rest of the
example libs.On Tue, 27 Jun 2000, Dave Swegen wrote:
–
Sam Hart http://www.physics.arizona.edu/~hart/
Web Page Highlights: Video Game History, Black Hole Simulation, & more.
OTHER WEB SITES MAINTAINED BY SAM HART
http://www.geekcomix.com/ - Geekcomix, the Daily Geek Comic Strip Site
http://www.physics.arizona.edu/~hart/gw/ - Ghostworks (Alt./Linux Computing)