Exemplo n.º 1
0
Score::Score()
{
	m_One = m_Two = 0;

	// Sets up 10 blank Rects in the vector which are filled in via LoadNumbers
	SDL::Rect empty;
	for(int x = 0; x < 10; x++)
		m_Images.push_back(empty);

	m_ScoreOneLoc.y = 10;
	m_ScoreOneLoc.x = 250;

	m_ScoreTwoLoc.y = 10;
	m_ScoreTwoLoc.x = 350;

	LoadNumbers();
}
Exemplo n.º 2
0
void PassiveLagTest()
{
	int 		frames = 0, seconds = 0, minutes = 0, hours = 0, framecnt = 1, done =  0;
	u16		    pressed, lsd, msd, pause = 0;		
	ImagePtr	back, circle;	
	
	back = LoadImage(WHITEIMG, 0);
	if(!back)
		return;
	back->w = 320;
	back->h = 240;

	circle= LoadImage(CIRCLEIMG, 0);
	if(!circle)
		return;
	circle->r = 0x00;
	circle->g = 0x00;
	circle->b = 0xff;
	
	LoadNumbers();

	while(!done && !EndProgram) 
	{		
		if(!pause)
		{
			frames ++;
			framecnt ++;
			if(framecnt > 8)
				framecnt = 1;
		}

		if(IsPAL)
		{
			if(frames > 49)
			{
				frames = 0;
				seconds ++;
			}

		}
		else
		{
			if(frames > 59)
			{
				frames = 0;
				seconds ++;
			}
		}

		if(seconds > 59)
		{
			seconds = 0;
			minutes ++;
		}

		if(minutes > 59)
		{
			minutes = 0;
			hours ++;
		}

		if(hours > 99)
			hours = 0;

		StartScene();

		DrawImage(back);
		DrawString(32, 8, 0, 0,	0, "hours");
		DrawString(104, 8, 0, 0, 0, "minutes");
		DrawString(176, 8, 0, 0, 0, "seconds");
		DrawString(248, 8, 0, 0, 0, "frames");

		// Counter Separators
		DrawDigit(80, 16, 0, 0, 0, 10);
		DrawDigit(152, 16, 0, 0, 0, 10);
		DrawDigit(224, 16, 0, 0, 0, 10);

		// Circles 1st row
		circle->x = 16;
		circle->y = 56;
		if(framecnt == 1)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(36, 68, 0xff, 0xff, 0xff, 1);

		circle->x = 96;
		circle->y = 56;
		if(framecnt == 2)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(116, 68, 0xff, 0xff, 0xff, 2);

		circle->x = 176;
		circle->y = 56;
		if(framecnt == 3)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(196, 68, 0xff, 0xff, 0xff, 3);

		circle->x = 256;
		circle->y = 56;
		if(framecnt == 4)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(276, 68, 0xff, 0xff, 0xff, 4);

		// Circles 2nd row
		circle->x = 16;
		circle->y = 136;
		if(framecnt == 5)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(36, 148, 0xff, 0xff, 0xff, 5);

		circle->x = 96;
		circle->y = 136;
		if(framecnt == 6)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(116, 148, 0xff, 0xff, 0xff, 6);

		circle->x = 176;
		circle->y = 136;
		if(framecnt == 7)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(196, 148, 0xff, 0xff, 0xff, 7);

		circle->x = 256;
		circle->y = 136;
		if(framecnt == 8)
		{
			circle->b = 0;
			circle->r = 0xff;
		}
		else
		{
			circle->b = 0xff;
			circle->r = 0;
		}
		DrawImage(circle);
		DrawDigit(276, 148, 0xff, 0xff, 0xff, 8);

		// Draw Hours
		lsd = hours % 10;
		msd = hours / 10;
		DrawDigit(32, 16, 0, 0, 0, msd);
		DrawDigit(56, 16, 0, 0, 0, lsd);

		// Draw Minutes
		lsd = minutes % 10;
		msd = minutes / 10;
		DrawDigit(104, 16, 0, 0, 0, msd);
		DrawDigit(128, 16, 0, 0, 0, lsd);

		// Draw Seconds
		lsd = seconds % 10;
		msd = seconds / 10;
		DrawDigit(176, 16, 0, 0, 0, msd);
		DrawDigit(200, 16, 0, 0, 0, lsd);

		// Draw Frames
		lsd = frames % 10;
		msd = frames / 10;
		DrawDigit(248, 16, 0, 0, 0, msd);
		DrawDigit(272, 16, 0, 0, 0, lsd);

		EndScene();

		ControllerScan();
        pressed = Controller_ButtonsDown(0);
					
		if (pressed & PAD_BUTTON_B)
			done =	1;				
					
		if (pressed & PAD_BUTTON_X && pause)
		{
			frames = hours = minutes = seconds = 0;
			framecnt = 1;
		}

		if (pressed & PAD_BUTTON_A)
			pause = !pause;
		
		if ( pressed & PAD_BUTTON_START ) 		
		{
			DrawMenu = 1;					
			HelpData = PASSIVELAG;
		}										
	}
	FreeImage(&back);
	FreeImage(&circle);
	ReleaseNumbers();
}