Custom buffers (hi res mode) and lcd screen shifting


im still working on my platformer trying to get the best quality in high res mode

im using multiple pallets and drawing most of the screen directly
the problem im facing is small buffers (images in ram that are constantly modified)
im wondering how i can use the drawing to screen buffer calls to redirect to my custom smaller buffer

another question is how to call the lcd shifting to move the entire sceen a pixel in a direction since redrawing the entire screen seems to be very slow

(also if your reading this, happy new year everyone)


indeed best wishes to everyone !


Here are screen buffer data in Display.h:

static uint8_t width;
static uint8_t height;
static uint8_t screenbuffer[];

I have not tried this myself, but if you want to e.g. direct drawBitmpap() to your own buffer you can use setFrameBufferTo() set the m_scrbuf temporarily to point to your own buffer. Looks like you have directly to change the width and height above. Restore the original values after the operation.

And Happy New Year to all!


@Hanski ok i finaly got around to trying this. it seems like wen i call game.display.setFrameBufferTo(mybuffer); it draws the screen once and then stops updating the game, i have no clue why


So you did restore the original screen buffer afterwards?


yes i did but its not working fully also i need to prefix width and height to the buffer somehow to make it able to run as a direct bitmap


ok hang on so it works wen i dont call drawBitmap on my own buffer


oh wait i got it to work heres my code :slight_smile:

// outside loop
uint8_t buffer[((32*40)/2)+2];
buffer[0]= 32;
buffer[1]= 40;

//inside loop
game.display.width = 32;
game.display.height = 40;
 // drawing in buffer

//reset buffer
//draw buffer to specific screen location


has anyone looked into screen scrolling?
not sure but this is what i found in the lcd documentation
Partial Screen Driving Position (R34h,R35h)
Horizontal and Vertical RAM Address Position(R36h,R37h,R38h,R39h)

im not sure these are the right ones to look at


is there there any existing code for drawing 16pallet sprites to a 565 buffer?
iv been looking into it but i kinda get lost in code i think im looking for mode13 stuff


Sorry did not understand. 16-color bitmaps directly to 565 screen?


im abusing the setFrameBufferTo function to basicly draw a sprite to deal with ovelaping images in my hi res game wich is all drawing with directdraw to screen

i kinda want to use multiple pallets so the buffer has to be 565, but my sprites are all in the standard 4bpp
also want to draw that buffer with derectdraw as a 565 not sure if thats possible


I think you should look at @Hanski’s Sprite class and modify that.


already have this working, and sprite mode is stuck in 2bpp atm, all i realy need is an upgrade to the buffer mode or type


@jonne did you ever get screen scrolling to work?


No but I got DMA to work. We can scroll the buffer in memory with little/zero overhead.


:confused: ok im not using a full screen buffer, only sectors of the screen are refreshed (to conserve framerate)


When I get time I will try the hw scrolling


thank you for trying it would help out allot