uli / dragonbasic

Dragon BASIC compiler for Game Boy Advance
Other
42 stars 7 forks source link

Add support for double buffering in Mode 4 instead of page flipping. #19

Open supercom32 opened 6 years ago

supercom32 commented 6 years ago

Enhancement requested under Dragon Basic for Linux (Commit ID: d2ce042366068083a5fe3089873a22221fffbc26)

It would be nice if we could have proper double buffering support added for Mode 4 graphics instead of page flipping. With page flipping, the user must draw on the back buffer, flip the screen, then re-draw the whole screen again with the addition of new elements. Instead of asking the user to do fancy coding to handle the redrawing of elements over again (especially for complicated scenes), it would be nice if double buffering was done instead.

That is, you draw your graphics to the back buffer. Then once your done all your rendering, just call "Flip" during a vBlank to copy the back buffer data to the foreground buffer. That way, if the user wants to make additional changes to the screen, they just need to continue writing to the back buffer. No mirrored drawing or having two buffers to keep in sync. The user just updates one buffer, and when they are ready to show the results they just call "Flip".

supercom32 commented 6 years ago

Actually, I suppose this could probably be done by the user manually by using DMACOPY to copy the contents of &6000000 or &600A0000 over to each other (Depending on which one is visible or not)?