/************************************/ /* */ /* Template for using escotia libs */ /* */ /* Author: ScoTT Campbell */ /* Date: 22/1/98 */ /* */ /************************************/ #include "../escpslib/escpslib.h" /******************* Globals ********************/ int initialVideoMode; // Video mode before this program int quit; // Used to flag user quit /**************** End of Globals ****************/ /************** Function Protoypes **************/ void InitialiseGame(); /* Controls initialisation of game structures */ void UpdateGame(); /* Controls updating of game structures */ void UpdateScreen(); /* Controls screen generation */ void CleanUp(); /* Controls destruction of heap members */ /********** End of Function Prototypes **********/ /******************** Main **********************/ int main() { /* Initialise game structures */ InitialiseGame(); while( !quit ) { /* Update game structures */ UpdateGame(); /* Draw the screen */ UpdateScreen(); }/*while*/ CleanUp(); return 0; }/* main*/ /***************** End of Main ******************/ /************* Function definitions *************/ void InitialiseGame() { // Set up debug font FntLoad(960, 256); FntOpen(-150, -120, 256, 200, 0, 512); printf("Debug font Initialised\n"); // Set up the graphics system initialVideoMode = GetVideoMode(); InitGraphics(); printf("Graphics Initialised\n"); // Set up the controllers InitControllers(); printf("Controllers Initialised\n"); // Set up screen clearing to black SetClearScreen(0, 0, 0); printf("Screen clearing Initialised\n"); // Set up the ordering tables InitWorldOTs(); printf("OTs Initialised\n"); /* */ /* TO DO: Add initialisation code */ /* */ }/* InitialiseGame */ void UpdateGame() { unsigned long int padValue = ReadControllers(); if((padValue & PAD1_SELECT) && (padValue & PAD1_START)) quit = 1; /* */ /* TO DO: Add structure update code */ /* */ }/* UpdateGame */ void UpdateScreen() { unsigned char vTime; // Find out which buffer we want to draw in int activeBuffer = GsGetActiveBuff(); // Set drawing command storage address GsSetWorkBase((PACKET*)packetArray[activeBuffer]); // Clear the current ordering table GsClearOt(0,0,&worldOT[activeBuffer]); /* */ /* TO DO: Add drawing commands */ /* */ // Check if we are in interlace mode #ifndef INTERLACED // Wait for current drawing to finish DrawSync(0); #endif // Wait for screen to finish drawing vTime = VSync(0); FntPrint("VSYNC = %d\n", vTime); FntFlush(-1); // Swap drawing buffer with display buffer GsSwapDispBuff(); // Draw the OT we just processed GsDrawOt(&worldOT[activeBuffer]); }/* UpdateScreen */ void CleanUp() { /* */ /* TO DO: Add destructors here */ /* */ ResetGraph(1); SetVideoMode(initialVideoMode); }/* CleanUp */ /********** End of function definitions *********/