#include "gpdef.h"
#include "gpstdlib.h"
#include "gpgraphic.h"
#include "gpmain.h"
GPDRAWSURFACE gpDraw[2];
int nflip = 0;
void GpMain(void *arg)
{
int i;
unsigned int n_tick;
for (i = 0 ; i < 2 ; i++)
{
GpLcdSurfaceGet(&gpDraw, i); //creates LCD surfaces (one for primary & the other for back)
}
GpSurfaceSet(&gpDraw[0]); //sets gpDraw[0] as primary surface
nflip = 1; //sets gpDraw[1] as back surface
while(1)
{
GpSurfaceFlip(&gpDraw[nflip]); //sets back surface as primary buffer
nflip = (nflip + 1) & 0x01; //sets previous primary buffer as back buffer
n_tick = GpTickCountGet(); //gets current time
//synchronizes frame rate with about 1000 msec
while ( ( GpTickCountGet() - n_tick ) < 1000)
;
}
}