示例#1
0
文件: main.cpp 项目: CyberMayck/CQML
void GUIMainLoop()
{
	int quit;

	t=clock();
	fps=0;
	quit=0;
	while(quit==0)
	{
		quit=InputHandling();
		//printf("quit %d\n",quit);
		Update();

		Redraw();

		timey=timey*0.95+0.05*(((float)(t-prevTime))/CLOCKS_PER_SEC);
		fps=1/timey;
		prevTime=t;
		t=clock();

	}
}
示例#2
0
void UpdateMainMenu(void)
{

	PlayAudio(&MenuBackSnd);

	//Handle input and run background animation
	if (DogScroll->CurrentFrame == 17)
	{
		DogScroll->AnimationActive = FALSE;
	}
	
	//If the position is greater than the final position
	if(DogScrollBottom->Position.y >= -345)
	{
		//Blaze the bottom down based on the total distance traveled divided by the number of frames and frames per change
		DogScrollBottom->Position.y -= (420) / 18 / DogScroll->AnimationSpeed;
	}
	
	if (DogScrollBottom->Position.y < OptionsButton->ButtonSprite->Position.y)
	{
		OptionsButton->ButtonSprite->Visible = TRUE;
	}

	if (DogScrollBottom->Position.y < QuitGameButton->ButtonSprite->Position.y)
	{
		QuitGameButton->ButtonSprite->Visible = TRUE;
	}

	if (FoxScroll->CurrentFrame == 17)
		FoxScroll->AnimationActive = FALSE;
	
	if(FoxScrollBottom->Position.y >= -345)
	{
		//Blaze the bottom down based on the total distance traveled divided by the number of frames and frames per change
		FoxScrollBottom->Position.y -= (420) / 18 / FoxScroll->AnimationSpeed;
	}

	if (FoxScrollBottom->Position.y < LoadGameButton->ButtonSprite->Position.y)
	{
		LoadGameButton->ButtonSprite->Visible = TRUE;
	}

	if (FoxScrollBottom->Position.y < CreditsButton->ButtonSprite->Position.y)
	{
		CreditsButton->ButtonSprite->Visible = TRUE;
	}

	//Menu navigation help
	if (TimerGoingUp)
		GettingImpatientTimer += GetDeltaTime();
	else
		GettingImpatientTimer -= GetDeltaTime();
	if (GettingImpatientTimer > 0)
	{
		ChangeTextAlpha(SillyGooseUseMouse, GettingImpatientTimer);

		if (GettingImpatientTimer > 1)
			TimerGoingUp = FALSE;
		else if (GettingImpatientTimer < 0.4)
			TimerGoingUp = TRUE;
	}

#if defined _DEBUG
	// REMOVE FOR RELEASE BUILD
	if(FoxInput_KeyTriggered(VK_HOME))
	{
		SetNextState(GS_EPMenu);
	}
#endif

	InputHandling();
	BackgroundAnimation();
}