Ejemplo n.º 1
0
void gameFrame(void)
{
	int lala;
	switch(currentBuffer)
	{
		case false:
			#ifdef DEBUG_GAME
				iprintf("\x1b[0;0H");
				iprintf("%d FPS   \n", FPS);
				iprintf("%d (debug)   \n", debugVal);
				iprintf("%d (free ram)   \n", getMemFree()/1024);
				iprintf("%p (portal)   \n", portal1.displayList);
				iprintf("%p (portal)   \n", portal2.displayList);
			#endif
			cpuEndSlice();
			postProcess1();
			// iprintf("postproc : %d  \n",cpuEndSlice());
			render1();

			// if(keysDown()&KEY_SELECT)testStepByStep^=1; //TEMP
			#ifdef DEBUG_GAME
				iprintf("full : %d (%d)  \n",cpuEndTiming(),testStepByStep);
			#endif
			swiWaitForVBlank();
			cpuStartTiming(0);
			prevTiming=0;
			if(previousPortal)dmaCopy(VRAM_C, previousPortal->viewPoint, 256*192*2);			
			setRegCapture(true, 0, 15, 2, 0, 3, 1, 0);
			frmCNT++;
			break;
		case true:
			// cpuStartTiming(0);
			postProcess2();
			// iprintf("frm 2 : %d  \n",cpuGetTiming());
			render2();
			listenPI9();
			updateOBBs();
			// iprintf("frm 2 : %d  \n",cpuEndTiming());
			#ifdef DEBUG_GAME
				iprintf("fake frame : %d   \n",cpuEndTiming());
			#endif
			swiWaitForVBlank();
			cpuStartTiming(0);
			prevTiming=0;
			dmaCopy(VRAM_C, mainScreen, 256*192*2);			
			setRegCapture(true, 0, 15, 2, 0, 3, 1, 0);
			break;
	}
	
	// if(testStepByStep){int i=0;while(!(keysUp()&KEY_TOUCH)){scanKeys();listenPI9();swiWaitForVBlank();}NOGBA("WAITED");scanKeys();scanKeys();if(keysHeld()&KEY_SELECT)testStepByStep=false;}
	// else if(keysDown()&KEY_SELECT)testStepByStep=true;
	
	currentBuffer^=1;
}
Ejemplo n.º 2
0
	void Update()
	{
		gLastFrameElapsedTicks = cpuEndTiming();
		cpuStartTiming(gTimerChannel); // Restart timer for this frame
	}