Il y a aussi un support de double-buffering intégré dans TIGCCLIB.
Voici une version animée et utilisant le double-buffering de l'exemple "
Gray Test Project" de TIGCC:
#define USE_TI89
#define USE_TI92P
#define USE_V200
#define MIN_AMS 100
#define SAVE_SCREEN
#define NO_EXIT_SUPPORT
#define NO_CALC_DETECT /* all calcs are allowed, and we are not using CALCULATOR
anywhere here, so we save some bytes */
#include <tigcclib.h>
void _main(void)
{
if (!GrayOn()) return; // enable gray mode
void *dbuffer=malloc(GRAYDBUFFER_SIZE); // allocate space for double-buffering
if (!dbuffer) {GrayOff();return;} // make sure it worked
GrayDBufInit(dbuffer); // enable double-buffering
int i;
for (i=0;i<80;i++) { /* animation loop (without animation, double-buffering
does not make much sense) */
// draw something in the currently hidden planes
GrayDBufSetHiddenAMSPlane(LIGHT_PLANE);
ClrScr();
ScrRectFill(&(SCR_RECT){{20,i,40,i+20}}, ScrRect, A_NORMAL);
ScrRectFill(&(SCR_RECT){{80,i,100,i+20}}, ScrRect, A_NORMAL);
GrayDBufSetHiddenAMSPlane(DARK_PLANE);
ClrScr();
ScrRectFill(&(SCR_RECT){{50,i,70,i+20}}, ScrRect, A_NORMAL);
ScrRectFill(&(SCR_RECT){{80,i,100,i+20}}, ScrRect, A_NORMAL);
// now flip the planes
GrayDBufToggleSync();
/* On HW1, the flip will be effective only after 1 or 2 plane switches
depending on the phase. We must not draw to the "hidden" planes before
they are really hidden! */
if (!_GrayIsRealHW2()) GrayWaitNSwitches(2);
}
// Cleanup. We need not call GrayDBufCleanup because GrayOff does it for us.
GrayOff();
free(dbuffer); // don't forget to free the buffer
}