PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

reverse direction blitting

just curious if there is a way to tell the blitting code to run right to left, and bottom to top instead of the normal way that it runs?

there is a genuinely good reason - tile based map scrolling

to explain...

I have a dummy surface for a tile based game that holds the current area tiles + 1 tile surrounding them all the way around

as I scroll the map, it takes screen size blits from this surface, moving by small offsets across it

when the scroll is sufficient to 'push the screen' I blit copy the lump of the tiles that is unchanged, and add the new row in the push direction

this is a classic scroll method and runs fine when moving down and/or right because of the direction the blit code runs in

BUT if I want to move left and/or up I have to do 2 blits, moving the main tile area to another surface and back again as otherwise the pixels overwrite

not only is the double blitting slow (relative terms here), it also means another surface in the memory

all in all just the wrong thing to do

at the moment I'm actually redrawing the whole screen so that there is no imbalance in the scroll direction

so I just thought I'd ask if there was a way of flagging the blitcode to "reverse it's loops" (not seen it in the docs, but hey, dont ask, dont get :))

TIA

muff
Not to say your request isn't a valid one, but you may simply want to blt your tiles directly to the backbuffer and do partial tile blts (ie clipped rects) as needed for scrolling.
muff: It won't be implemented. Reasons are too many to mention, the primary being performance optimizations. I would recommend doing as ppcStudios suggests and use partial tile blits with clipped rectangles.
thanks for the replies guys, I realised that it was unlikely - just wanted to double check it wasn't there and I'd missed it

keep up the great work sbl :)