Example #1
0
void LScreenSaver::LockScreenNow(){
  ShowScreenSaver();
  LockScreen();
}
Example #2
0
float RenderFrame (SystemState *RFState)
{
	static unsigned short FrameCounter=0;

//********************************Start of frame Render*****************************************************
	SetBlinkState(BlinkPhase);
	irq_fs(0);				//FS low to High transition start of display Boink needs this

	for (RFState->LineCounter=0;RFState->LineCounter<13;RFState->LineCounter++)		//Vertical Blanking 13 H lines 
		CPUCycle();

	for (RFState->LineCounter=0;RFState->LineCounter<4;RFState->LineCounter++)		//4 non-Rendered top Boarder lines
		CPUCycle();

	if (!(FrameCounter % RFState->FrameSkip))
		if (LockScreen(RFState))
			return(0);

	for (RFState->LineCounter=0;RFState->LineCounter<(TopBoarder-4);RFState->LineCounter++) 		
	{
		if (!(FrameCounter % RFState->FrameSkip))
			DrawTopBoarder[RFState->BitDepth](RFState);
		CPUCycle();
	}

	for (RFState->LineCounter=0;RFState->LineCounter<LinesperScreen;RFState->LineCounter++)		//Active Display area		
	{
		CPUCycle();
		if (!(FrameCounter % RFState->FrameSkip))
			UpdateScreen[RFState->BitDepth] (RFState);
	} 
	irq_fs(1);  //End of active display FS goes High to Low
	if (VertInteruptEnabled)
		GimeAssertVertInterupt();	
	for (RFState->LineCounter=0;RFState->LineCounter < (BottomBoarder) ;RFState->LineCounter++)	// Bottom boarder 
	{
//		if ( (RFState->LineCounter==1) & (VertInteruptEnabled) )	//Vert Interupt occurs 1 line into 
//			GimeAssertVertInterupt();								// Bottom Boarder MPATDEMO
		CPUCycle();
		if (!(FrameCounter % RFState->FrameSkip))
			DrawBottomBoarder[RFState->BitDepth](RFState);
	}

	if (!(FrameCounter % RFState->FrameSkip))
	{
		UnlockScreen(RFState);
		SetBoarderChange(0);
	}

	for (RFState->LineCounter=0;RFState->LineCounter<6;RFState->LineCounter++)		//Vertical Retrace 6 H lines
		CPUCycle();

	switch (SoundOutputMode)
	{
	case 0:
		FlushAudioBuffer(AudioBuffer,AudioIndex<<2);
		break;
	case 1:
		FlushCassetteBuffer(CassBuffer,AudioIndex);
		break;
	case 2:
		LoadCassetteBuffer(CassBuffer);

		break;
	}
	AudioIndex=0;


/*
	//Debug Code
	Frames++;
	if (Frames==60)
	{
		Frames=0;
		sprintf(Msga,"Total Cycles = %i Scan lines = %i LPS= %i\n",TotalCycles,Scans,LinesperScreen+TopBoarder+BottomBoarder+19);
		WriteLog(Msga,0);
		TotalCycles=0;
		Scans=0;
	}
*/
	return(CalculateFPS());
}
Example #3
0
int main(int argc, char **argv)
{
//Initialise SDL
	SDL_Init(SDL_INIT_EVERYTHING);
	
//Setup screen
	SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
	
//Load Terrain
	OpenTerrain_Heightmap MyHeightmap;
	MyHeightmap.LoadFromImage("heightmap.png");
	OpenTerrain_DataSource_Heightmap DataSource(&MyHeightmap);
	OpenTerrain_Terrain MyTerrain;
	
	MyTerrain.SetupValues.ChunkSize = 32;
	MyTerrain.SetupValues.ChunksX = 8;
	MyTerrain.SetupValues.ChunksY = 8;
	MyTerrain.SetupValues.LODLevelCount = 1;
	MyTerrain.Setup(&DataSource, 0);
	
//Lock Screen
	LockScreen(screen);
	
//Draw terrain
	unsigned int ChunkVerticesAccross = MyTerrain.ChunkSize + 1;
	for(unsigned int Chunk = 0; Chunk < MyTerrain.LODLevels[0].ChunkCount; Chunk++) {
	//Get chunk
		OpenTerrain_Chunk* ChunkPtr = &MyTerrain.LODLevels[0].Chunks[Chunk];
		
	//Calculate chunk position on screen
		unsigned int ChunkX = ChunkPtr->PosX * ChunkVerticesAccross;
		unsigned int ChunkY = ChunkPtr->PosY * ChunkVerticesAccross;
		
	//Loop through vertices
		for(unsigned int Y = 0; Y < ChunkVerticesAccross; Y++) {
			for(unsigned int X = 0; X < ChunkVerticesAccross; X++) {
			//Get luminance and draw pixel
				unsigned char Luminance = ChunkPtr->Vertices[Y * ChunkVerticesAccross + X] * 255;
				DrawPixel(screen, ChunkX + X, ChunkY + Y, Luminance, Luminance, Luminance);
			}
		}
	}
	
//Unlock screen and update
	UnlockScreen(screen);
	SDL_UpdateRect(screen, 0, 0, 256, 256);
	
//Event loop
    SDL_Event event;
	while(true) {
		while ( SDL_PollEvent(&event) ) {
			switch (event.type) {
				case SDL_QUIT:
					exit(0);
				break;
			}
		}
	}
	
//Return 0
	return 0;
}