Hmm,
I’m rather new to graphics in general, though I think I’m learning
SDL quite quickly (It really is pretty Simple. Good work on keeping it
that way Sam and co. ;-). Anyhow, I’ve been considering something, that
is fairly common, so I’m wondering what the fastest way to implement it
is; I have a couple of ideas;
The task I’m looking at is having a map image (that is larger than the
screen), and moving sprites around that map (to keep it simple, these
will be non-animated sprites for now).
The most obvious way I can think of doing this (though maybe not the
quickest), is to setup the screen with DoubleBuffer (although I suspect
that almost all games use DoubleBuffer, no?), load my map into one
surface, load all my sprites into another surface (keeping a seperate
list or array of SDL_Rect’s that contain the location of each sprite as
a separate rect),
blitting the visible rectangle of the map to the main screen surface
(that is hidden by doublebuff), blitting each of my sprites to the
appropriate location, and calling SDL_Flip(). And repeating this
process each time I want to render a screen.
So, I guess my question would be, what is the performace of
SDL_BlitSurface; and is there any (faster) way to deal with this than
re-blitting the map each time (e.g. if the map hasn’t moved; – if it
needs to pan, I suppose, it would need to be re-blitted, no?)
Thanks, Jeff Schmidt.
PS. Question arising from something I read recently on this list: Under
X11, can SDL give me fullscreen, double-buffering, and
hardware-accel/surfaces all at the same time?–
“Message sent by @Jeff_Schmidt”