[SDL] correct way of map scrolling
Scott Harper
orcein at gmail.com
Thu Aug 9 17:43:35 PDT 2007
> If you're doing a true tiling system (say, 32x32 tiles or similar),
> then ya might consider just recreating the background every frame.
> You'll undoubtedly be animating EVERY tile, so you'll have to
> redraw it anyway...
For me, since I use SDL as a cheap way to set up and OpenGL context
on whatever platform, I'm pretty sure I have to redraw all the tiles
each frame anyway, as a result of using 3D acceleration for drawing.
It should be relatively easy, however, to figure out what is on-
screen or not (test bounds) so you don't have to draw EVERYTHING...
Though with OGL, I recall that if something's offscreen it'll PROCESS
the vertices you give it, but won't waste time drawing if nothing
shows on-screen... My general idea is to break larger maps down into
smaller map segments, and do hit-testing on them for if they're near
the screen edges, that way I may lose SOME cycles each redraw to
wasted tiles drawn, but probably not as many as would be wasted with
small hit-checks on each tile. Kind of like a hand-made quad-tree,
only without the even breaks.
Wow, that was scatterbrained! >.< Sorry for the unintelligible
response! =)
-- Scott
More information about the SDL
mailing list