Changes

Jump to: navigation, search

SMIDP2lib for SDCC

70 bytes added, 15:41, 20 December 2011
Currently, there are the following issues to work out a solution for:
=== Double-buffering makes it problematic to "un-draw" ===
While double-buffering can potentially make things more smooth,it also causes some problems when it updates only parts of the screen.
Consider a sprite moving from left to right, an unknown number of pixels each frame, on top of a background. You would then use sMIDP2lib_bufferscreen.getRGB() to store the piece of background you're about to draw on, in order to be able to redraw the background in next frame. Let's say the sprite is about to be drawn at (10,0) and it's a 16x16 pixels bit sprite. Then before drawing the sprite, you would call sMIDP2lib_bufferscreen.getRGB() to save the 16x16 pixels piece of background, and then draw the sprite and then call flushGraphics().
Next frame, you will then want to draw that piece of the background again to cover our sprite before drawing the sprite in the next location. But since we switched buffer-screen with the flushGraphics(), we are now drawing on another screen where our sprite is actually placed on another location. Therefor we will most likely not be deleting it properly.