Example #1
0
void Game::Go()
{
	UpdateModel();
	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}
Example #2
0
void Game::UpdateFrame()
{
	DirectX::TransformBuffer tb{};
	float dt = 1.0f / 60.0f;

	cam.Update( dt );
	for (int i = 0; i < 100; ++i)
	{
		model_test[i].Update(0.0f);
	}
	//ship.Update( dt );

	// View and projection stay the same for entire frame
	tb.view = DirectX::XMMatrixTranspose(cam.GetView( ));
	tb.projection = DirectX::XMMatrixTranspose( cam.GetProjection( win ));

	// World matrix and constant buffer needs to be updated for each model
	for (int i = 0; i < 100; ++i)
	{
		tb.world = DirectX::XMMatrixTranspose(model_test[i].GetWorld());
		sprite_shader.UpdateVertexConstBuffer(sizeof(tb), &tb, model_test[i].GetConstBuffer());
	}
	/*tb.world = DirectX::XMMatrixTranspose( ship.GetWorld());
	sprite_shader.UpdateVertexConstBuffer( sizeof( tb ), &tb, ship.GetConstBuffer( ) );*/


	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}
Example #3
0
void CGameRenderer::ProcessFrame(){ //process a frame of animation
	if(g_bImagesLoaded){ //wait for the image loading thread to finish
		//check for lost graphics device
		if(DeviceLost())RestoreDevice(); //if device lost, restore it
		//process a frame of animation
		ComposeFrame(); //compose a frame of animation
		PageFlip(); //flip to front
	}
} //ProcessFrame
Example #4
0
void Game::Go()
{
	frameCount++;

	if (kbd.SpaceIsPressed() && !keysPressedLastFrame) {
		if (paused) paused = false;
		else paused = true;
		keysPressedLastFrame = true;
	}	

	//wow to prove exactly when just simple computation (not rendering) can slow shit down.
	/*for (int i = 0; i < 5800000; i++)
	{
		;
	}*/
	/*for (int i = 0; i < 10000000; i++)
	{
		;
	}*/
	/*for (int i = 0; i < 100000000; i++)
	{
		;
	}*/


	if (!paused) {
		if (!gameOver) {
			secondsSinceStart = difftime(time(0), start);
			waveTimer = secondsSinceStart;
			nextSquadTimer = secondsSinceStart;

			setUpShips();
			playerShipLogic();
			bulletLogic();
			updateEnemy();	
		}
	}

	

	//why isnt this working?
	//ahh wasnt working because there was a separate make false for if enter wasnt pressed in bullet logic
	if (!(kbd.SpaceIsPressed()) && !(kbd.EnterIsPressed())) keysPressedLastFrame = false;	

	pDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
	//2 PROBLEMS:
	//1. Mixing of beginscene/endscene unlock/lock rect causes us unable to draw over texture
	//2. Logic Is updating faster than we draw
	//AHAAA might be able to fix problem 1 by begining and ending the sprite object in the right place. Textures only work when spriteobj has begun
	if (pDevice->BeginScene()) {
		gfx.BeginFrame();
		ComposeFrame();
		gfx.EndFrame();
	}
}
Example #5
0
void Game::Go()
{
    controller.Poll(); // input
    p.GetState().OnUpdate(); // state update

    t.DoCollision(p); // collision
    t.DoSupport(p); // floor support
    p.MoveCameraTo(cam);

	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}
Example #6
0
void GameOver::Do()
{	
	BeginFrame();
	if (mQuit.ButtonClicked(ic, gfx))
	{

		core.cScore.SaveList();
		PostQuitMessage(0);
	}
	else if (mTryAgain.ButtonClicked(ic, gfx))
	{
		sc.Transition(new Loading(sc, core));
	}
	ComposeFrame();

}
Example #7
0
void Game::Go()
{
	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}
Example #8
0
void display()
{
   ComposeFrame();
   background.drawGLbackground();
   if (!InMenu)
   {
	   if(text1)
	   {
		   Textbox.draw(0);
		   textPrintf(110/512.0, 420/512.0, font2, "Please save the princess.", color);
	   }
	   else if(text2)
	   {
		   Textbox.draw(0);
		   textPrintf(90/512.0, 420/512.0, font2, "I always knew that old wizard was no good.", color);
	   }
	   drawPeople();
       if(Gerad.GetWalk())
       {
           if(Gerad.GetRight())
           {
               DisplayDirection(0, 1, 2);
           }
           else if(Gerad.GetLeft())
           {
    	       DisplayDirection(3, 4, 5);
           }
           else if(Gerad.GetBack())
           {
	           DisplayDirection(9, 10, 11);
           }
           else if(Gerad.GetFront())
           {
	           DisplayDirection(6, 7, 8);
           }
       }
       else
       {
	       if(Gerad.GetRight())
           {
               DisplayDirection(0, 0, 0);
           }
           else if(Gerad.GetLeft())
           {
	           DisplayDirection(3, 3, 3);
           }
           else if(Gerad.GetBack())
           {
	           DisplayDirection(9, 9, 9);
           }
           else if(Gerad.GetFront())
           {
	           DisplayDirection(6, 6, 6);
           }
	   }
   }
   else
   {
	   inventory.draw();
   }

   glutSwapBuffers();
}