PocketMatrix forums

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

BackBuffer over 320x240?

How can I create a backbuffer more large of 320x240?
I want a Display object with a backbuffer of 480x360.

thanks
The BackBuffer is defined by the screen size. You need to make a new surface, and then blit to it. Then blit part of that surface to the real backbuffer.

Code:
Display *pDisplay=GetDisplay();
int x=80, y=60;
Surface *pTempBB = pDisplay->CreateSurface(480, 360);
pDisplay->SetRenderTarget(pTempBB);
...
drawing code here
...
pDisplay->SetRenderTarget(0);
pDisplay->Blit(0,0,pTempBB,&Rect;(x,y,x+320,y+240));
pDisplay->Update();
Your code should look something like this. Swap the 320/240 if you're using portrait mode. This also assumes you're using PF0.8.0. For 0.7.0 change Display to DisplayDevice. Use the x and y variables to set the upper left corner of the section of the temp backbuffer you want to blit. You'll also only want to break up the code a little, especially to create the tempBackBuffer just once. Doing it each frame would be terribly slow.

-John
Right now I use a scrolling bitmap; I copy a 240x320 area from a pixel buffer to the main display. Would it speed up my app if I use a PocketHAL surface instead of my own allocated buffer?