Exemplo n.º 1
0
// Render
/*virtual*/ void IntroState::Render(void)
{
	SGD::GraphicsManager*	pGraphics = SGD::GraphicsManager::GetInstance();

	// Use the game's font
	const BitmapFont* pFont = Game::GetInstance()->GetFont();

	SGD::Color backColor(transBack, 255, 255, 255);
	// Draw the background image
	pGraphics->DrawTexture(m_hBackgroundImage, { 0, 0 }, 0.0f, {}, backColor);

	if (IntroTimer.GetTime() < 20.0f)
	{
		SGD::Color colorTextOne(transTextFirst, 100, 0, 0);

		pFont->Draw("2 Weeks Later", { Game::GetInstance()->GetScreenWidth() / 2 - 150, Game::GetInstance()->GetScreenHeight() / 2 - 25 }, 1.0f, colorTextOne);

		SGD::Color colorText(transText, 100, 0, 0);

		pFont->Draw("Trying to survive", { Game::GetInstance()->GetScreenWidth() / 2 - 200, Game::GetInstance()->GetScreenHeight() / 2 - 25}, 1.0f, colorText);
	}

	if (SGD::InputManager::GetInstance()->IsControllerConnected(0) == false)
		pFont->Draw("Press 'ESC' to continue", { Game::GetInstance()->GetScreenWidth() / 2 - 175, Game::GetInstance()->GetScreenHeight() - 25 }, .5f, { 100, 0, 0 });
	else
		pFont->Draw("Press 'Start' to continue", { Game::GetInstance()->GetScreenWidth() / 2 - 175, Game::GetInstance()->GetScreenHeight() - 25 }, .5f, { 100, 0, 0 });


	// Align text based on window width
	float width = Game::GetInstance()->GetScreenWidth();

	// Display the mode title & its animation
	pFont->Draw("Story Mode", { (width - (10 * 25 * 3.0f)) / 2, 10 }, 3.0f, { 255, 255, 255 });

	// Display skip input
	std::string output0 = SGD::InputManager::GetInstance()->IsControllerConnected(0) == false
		? "Press 'Esc' to skip"
		: "Press 'Start' to skip";
	pFont->Draw(output0.c_str(), { (width - (output0.length() * 25 * 1.0f)) / 2, 100 }, 1.0f, { 0, 0, 0 });

	/*
	AnimationManager::GetInstance()->Render(animation, { width - 160.0f, 50 });



	// Setup text render data
	float left_start	= 10.0F;
	float y_offset		= 210.0f;
	float scale			= 1.0f;


	// story mode text
	std::string output1 = "HELLO WORLD!";
	std::string output2 = "GOODBYE WORLD!";


	pFont->Draw(output1.c_str(), { left_start, starting_y + (y_offset * 0) }, scale, { 0, 255, 0 });
	pFont->Draw(output2.c_str(), { left_start, starting_y + (y_offset * 1) }, scale, { 255, 0, 0 });
	*/
}
Exemplo n.º 2
0
void AnimationManager::Render(AnimationTimestamp& ants, float x, float y, float rotation, SGD::Vector center, SGD::Color col)
{
	SGD::GraphicsManager* g = SGD::GraphicsManager::GetInstance();
	//g->DrawLine({ (float)x, (float)y }, { (float)x + 2, (float)y + 2 });

	x -= m_mSprites[ants.m_nCurrAnimation]->GetFrame(ants.m_nCurrFrame).GetAnchorPoint().x;
	y -= m_mSprites[ants.m_nCurrAnimation]->GetFrame(ants.m_nCurrFrame).GetAnchorPoint().y;

	SGD::Rectangle r = m_mSprites[ants.m_nCurrAnimation]->GetFrame(ants.m_nCurrFrame).GetFrameRect();

	// Getting the specific frame
	//r.right += r.left;
	//r.bottom += r.top;


	g->DrawTextureSection(m_mSprites[ants.m_nCurrAnimation]->GetImage(),
	{ (float)x, (float)y },
	r, rotation, center, col);

	SGD::Rectangle dr = r;
	dr.top += y;
	dr.bottom += y;
	dr.left += x;
	dr.right += x;

	//g->DrawRectangle(dr, { 128, 255, 255, 0 });

}
Exemplo n.º 3
0
// Enter
/*virtual*/ void IntroState::Enter(void)
{
	// Set background color
	SGD::GraphicsManager::GetInstance()->SetClearColor({ 0, 0, 0 });	// black


	//starting_y = Game::GetInstance()->GetScreenHeight() + 20.0F;// * 15.0F;// + 170.0F;



	// Load assets
	SGD::GraphicsManager*	pGraphics			= SGD::GraphicsManager::GetInstance();
	SGD::AudioManager*		pAudio				= SGD::AudioManager::GetInstance();
	AnimationManager*		pAnimationManager	= AnimationManager::GetInstance();

	//pAnimationManager->Load("resource/config/animations/Zombie_Animation_New.xml", "zombie");
	//animation.m_strCurrAnimation = "zombie";

	m_hBackgroundImage = pGraphics->LoadTexture("resource/graphics/MenuImages/emergencybroadcast.png");

	m_hEmergency = pAudio->LoadAudio("resource/audio/zombieemergency.wav");

	IntroTimer.AddTime(60);
	ScreenTimer.AddTime(.1f);

	pAudio->PlayAudio(m_hEmergency, false);

	//m_hBackgroundImage	= pGraphics->LoadTexture("resource/graphics/youLose.png");

	//m_hBackgroundMusic = pAudio->LoadAudio("resource/audio/JNB_Credits_PinballGroove.xwm");
	//pAudio->PlayAudio(m_hBackgroundMusic);

}
Exemplo n.º 4
0
// Enter
/*virtual*/ void IntroState::Enter(void)
{
	// Set background color
	SGD::GraphicsManager::GetInstance()->SetClearColor({ 0, 0, 0 });	// black


	//starting_y = Game::GetInstance()->GetScreenHeight() + 20.0F;// * 15.0F;// + 170.0F;



	// Load assets
	SGD::GraphicsManager*	pGraphics			= SGD::GraphicsManager::GetInstance();
	SGD::AudioManager*		pAudio				= SGD::AudioManager::GetInstance();
	AnimationManager*		pAnimationManager	= AnimationManager::GetInstance();

	//pAnimationManager->Load("resource/config/animations/Zombie_Animation_New.xml", "zombie");
	//animation.m_strCurrAnimation = "zombie";

	pAudio->SetVoiceVolume(Game::GetInstance()->m_hMainVoice, 35);

	m_hBackgroundImage = pGraphics->LoadTexture("resource/graphics/MenuImages/emergencybroadcast.png");
	m_hinstruct = SGD::GraphicsManager::GetInstance()->LoadTexture("resource/graphics/MenuImages/ArcadeControlsIcons.png");

	m_hEmergency = pAudio->LoadAudio("resource/audio/zombieemergency.wav");

	if (IntroTimer.GetTime() < 45.0f)
	{
		float newTime = 45.0f - IntroTimer.GetTime();

		IntroTimer.AddTime(newTime);
	}

	else if (IntroTimer.GetTime() <= 0.0f)
		IntroTimer.AddTime(45.0f);

	if (ScreenTimer.GetTime() < .1f)
	{
		float newTime = .1f - ScreenTimer.GetTime();

		ScreenTimer.AddTime(newTime);
	}

	else if (ScreenTimer.GetTime() <= 0.0f)
		ScreenTimer.AddTime(.1f);

	transBack = 255;
	transTextFirst = 0;
	transText = 0;

	//IntroTimer.AddTime(45.0f - IntroTimer.GetTime());
	//ScreenTimer.AddTime(.1f - ScreenTimer.GetTime());

	pAudio->PlayAudio(m_hEmergency, false);

	//m_hBackgroundImage	= pGraphics->LoadTexture("resource/graphics/youLose.png");

	//m_hBackgroundMusic = pAudio->LoadAudio("resource/audio/JNB_Credits_PinballGroove.xwm");
	//pAudio->PlayAudio(m_hBackgroundMusic);

}
Exemplo n.º 5
0
void FireTrap::Render(void)
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();

	SGD::Point point = { m_ptPosition.x - GameplayState::GetInstance()->GetWorldCam().x, m_ptPosition.y - GameplayState::GetInstance()->GetWorldCam().y };

	if (GameplayState::GetInstance()->GetDebugState())
	{
		SGD::Rectangle rec = GetRect();
		rec.Offset(-GameplayState::GetInstance()->GetWorldCam().x, -GameplayState::GetInstance()->GetWorldCam().y);
		pGraphics->DrawRectangle(rec, SGD::Color(0, 0, 255));
	}

	// - Temp Code till we have sprites.
	//SGD::Rectangle rec = GetRect();
	//	rec.Offset( -GameplayState::GetInstance()->GetWorldCam().x, -GameplayState::GetInstance()->GetWorldCam().y );
	// - Collision Rectangle

	pGraphics->DrawTexture(m_hImage, point);

	if (m_bStartTimer)
		m_pParticle.RenderPoint(point);
	//pGraphics->DrawRectangle( rec, SGD::Color( 255, 0, 0 ) );
	

}
Exemplo n.º 6
0
void LoadState::Exit()
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	SGD::AudioManager* pAudio = SGD::AudioManager::GetInstance();

	pGraphics->UnloadTexture(m_hButton);
	pGraphics->UnloadTexture(m_hButtonHighlighted);
	pGraphics->UnloadTexture(m_hBackground);
	pGraphics->UnloadTexture(m_hNameFrame);
	SlotName();
}
Exemplo n.º 7
0
void LoadState::Enter()
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	m_hBackground = pGraphics->LoadTexture(L"resource/graphics/MenuBackgrounds/Options.png");
	m_hButton = pGraphics->LoadTexture("resource/graphics/optionsButton.png");
	m_hButtonHighlighted = pGraphics->LoadTexture("resource/graphics/optionHighlighted.png");
	m_hNameFrame = pGraphics->LoadTexture("resource/graphics/MenuBackgrounds/saveScroll.png");

	//SlotName();
	LoadNames();
}
Exemplo n.º 8
0
// Exit
/*virtual*/ void IntroState::Exit(void)
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	SGD::AudioManager * pAudio = SGD::AudioManager::GetInstance();

	// Unload assets
	pGraphics->UnloadTexture(m_hBackgroundImage);
	//pAudio->UnloadAudio(m_hBackgroundMusic);

	pAudio->UnloadAudio(m_hEmergency);
}
void QuickTimeState::HandleTutorial()
{
	if( GameplayState::GetInstance()->GetCurrentLevel() == 0 )
	{
		SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
		BitmapFontManager *pFont = BitmapFontManager::GetInstance();

		SGD::Point ptWorldCam = GameplayState::GetInstance()->GetWorldCam();

		SGD::Point heroPosition;
		SGD::Point portraitPosition;
		// - Location of the Dialog Box at the bottom of the screen.

		SGD::Rectangle DialogBoxOne;
		DialogBoxOne.left = 25;
		DialogBoxOne.top = Game::GetInstance()->GetScreenHeight() - 105;
		DialogBoxOne.right = Game::GetInstance()->GetScreenWidth() - 25;
		DialogBoxOne.bottom = Game::GetInstance()->GetScreenHeight() - 5;

		// - Location to print the strings within the dialog Box
		SGD::Point TextPositionOne;
		SGD::Point TextPositionTwo;

		TextPositionOne.x = DialogBoxOne.left + 40;
		TextPositionOne.y = DialogBoxOne.top + 20;
		TextPositionTwo.x = DialogBoxOne.left + 20;
		TextPositionTwo.y = DialogBoxOne.top + 50;

		portraitPosition.x = DialogBoxOne.left - 10;
		portraitPosition.y = DialogBoxOne.top - 30;

		if( Game::GetInstance()->GetIcelandic() )
		{
			TextPositionOne.x = DialogBoxOne.left + 50;
			TextPositionTwo.x = DialogBoxOne.left + 50;
		}
		else
		{
			TextPositionOne.x = DialogBoxOne.left + 100;
			TextPositionTwo.x = DialogBoxOne.left + 100;
		}

		heroPosition = { (float)( ( 3 * 32 ) - ptWorldCam.x ), (float)( ( 8 * 32 ) - ptWorldCam.y ) };

		pGraphics->DrawRectangle( DialogBoxOne, SGD::Color( 220, 215, 143 ), SGD::Color( 0, 0, 0 ) );
		pGraphics->DrawTexture( GameplayState::GetInstance()->GetPortrait(), portraitPosition );
		pFont->Render( "Dialog", Game::GetInstance()->GetString( 9, 7 ).c_str(), TextPositionOne, .7f, SGD::Color( 0, 0, 0 ) );
		pFont->Render( "Dialog", Game::GetInstance()->GetString( 9, 8 ).c_str(), TextPositionTwo, .7f, SGD::Color( 0, 0, 0 ) );

	}
}
Exemplo n.º 10
0
void RatTrap::Render()
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	SGD::Point pos = position;
	//pos.x -= 16;
	float x = GameData::GetInstance( )->GetCamera( ).x;
	float y = GameData::GetInstance( )->GetCamera( ).y;
	pos.x -= x;
	pos.y -= y;
	//pos.y -= 32;
	if (image != SGD::INVALID_HANDLE)
		pGraphics->DrawTexture(image, pos);

}
Exemplo n.º 11
0
// Exit
/*virtual*/ void IntroState::Exit(void)
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	SGD::AudioManager * pAudio = SGD::AudioManager::GetInstance();

	// Unload assets
	pGraphics->UnloadTexture(m_hBackgroundImage);
	pGraphics->UnloadTexture(m_hinstruct);

	//pAudio->UnloadAudio(m_hBackgroundMusic);

	pAudio->UnloadAudio(m_hEmergency);

	pAudio->SetVoiceVolume(Game::GetInstance()->m_hMainVoice, 100);
}
Exemplo n.º 12
0
void Tower::Render()
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();

	SGD::Rectangle rect = GetRect();
	rect.left -= Camera::x;
	rect.right -= Camera::x;
	rect.top -= Camera::y;
	rect.bottom -= Camera::y;

	Game* pGame = Game::GetInstance();

	// -- Debugging --
	if (pGame->IsShowingRects())
		pGraphics->DrawRectangle(rect, SGD::Color(128, 0, 0, 255));

	if (m_bSelected)
		pGraphics->DrawRectangle(rect, SGD::Color(0, 0, 0, 0), SGD::Color(255, 255, 0), 2);
}
Exemplo n.º 13
0
void HUD::Render(void)
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	const BitmapFont* pFont = Game::GetInstance()->GetFont();


	// Draw the HUD image
	float	screenheight	= Game::GetInstance()->GetScreenHeight();

	//pGraphics->DrawTextureSection(m_hBackgroundImage, { 1.5f, screenheight - 112.0f }, SGD::Rectangle(4.0f, 694.0f, 708.0f, 806.0f));
	//pGraphics->DrawTexture(m_hBackgroundImage, { 1.5f, screenheight - 112.0f });


	// draw health bars
	SGD::Rectangle currhealth	= { 0, 0, m_pPlayer->GetCurrHealth() / m_pPlayer->GetMaxHealth() * 200, 35 };
	SGD::Rectangle maxhealth	= { 0, 0, 200, 35 };

	pGraphics->DrawRectangle(maxhealth, { 0, 0, 255 });

	SGD::Color healthcolor;
	if (m_pPlayer->GetCurrHealth() == m_pPlayer->GetMaxHealth())				// 100 -> Green
		healthcolor = { 0, 255, 0 };

	else if (m_pPlayer->GetCurrHealth() <= m_pPlayer->GetMaxHealth() * 0.5F)	// 0 - 25 -> Red
		healthcolor = { 255, 0, 0 };

	else																		// 25 - 99 -> yellow
		healthcolor = { 255, 255, 0 };

	pGraphics->DrawRectangle(currhealth, healthcolor);


	// draw health as a string
	int hp = static_cast<int>(m_pPlayer->GetCurrHealth());

	stringstream health;
	health << "HP: " << hp;
	pFont->Draw(health.str().c_str(), { 0, 0 }, 1.0f, { 255, 0, 255 });


}
Exemplo n.º 14
0
void const OptionsState::Render()
{
	
	SGD::GraphicsManager * graphics = SGD::GraphicsManager::GetInstance();
	graphics->DrawTextureSection(background, { 0.0, 0.0 }, { 0.0f, 0.0f, 800.0f, 600.0f });
	GameData::GetInstance()->GetFont()->DrawString("Options Menu", 60.0f, 40.0f, { 0, 0, 0 }, 2.0f);
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(button, { 45.0f, 95.0f }, { 15.0f, 5.0f, 240.0f, 70.0f });
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(button, { 45.0f, 175.0f }, { 15.0f, 5.0f, 240.0f, 70.0f });
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(button, { 45.0f, 255.0f }, { 15.0f, 5.0f, 240.0f, 70.0f });
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(button, { 45.0f, 335.0f }, { 15.0f, 5.0f, 240.0f, 70.0f });
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(button, { 45.0f, 415.0f }, { 15.0f, 5.0f, 240.0f, 70.0f });

	graphics->DrawTextureSection(cursor, { 10.0f, 95.0f + (menuindex * 80) }, { 0, 0, 238, 73 });

	GameData::GetInstance()->GetFont()->DrawString("Language:", 70.0f, 120.0f, { 155, 155, 155 }, 1.5f);
	if (GameData::GetInstance()->GetFont()->IsSpanish())
		GameData::GetInstance()->GetFont()->DrawString("Spanish",150.0f, 125.0f, { 0,0,0 });
	else
		GameData::GetInstance()->GetFont()->DrawString("English", 175.0f, 125.0f, { 0,0,0 });

	GameData::GetInstance()->GetFont()->DrawString("Music Volume:", 70.0f, 200.0f, { 155, 155, 155 }, 1.5f);
	std::ostringstream mout;
	mout << GameData::GetInstance()->GetMusicVolume();
	GameData::GetInstance()->GetFont()->DrawString(mout.str(), 220.0f, 205.0f, { 0,0,0 });
	GameData::GetInstance()->GetFont()->DrawString("Effect Volume:", 70.0f, 280.0f, { 155, 155, 155 }, 1.5f);
	std::ostringstream eout;
	eout << GameData::GetInstance()->GetEffectVolume();
	GameData::GetInstance()->GetFont()->DrawString(eout.str(), 220.0f, 285.0f, { 0,0,0 });

	GameData::GetInstance()->GetFont()->DrawString("FullScreen:", 70.0f, 360.0f, { 155, 155, 155 }, 1.5f);
	if (GameData::GetInstance()->GetWindowed())
		GameData::GetInstance()->GetFont()->DrawString("Off", 200.0f, 360.0f, { 0,0,0 });
	else
		GameData::GetInstance()->GetFont()->DrawString("On", 200.0f, 360.0f, { 0,0,0 });

	GameData::GetInstance()->GetFont()->DrawString("Exit", 70.0f, 440.0f, { 155, 155, 155 }, 1.5f);


	//graphics->DrawRectangle({ 35.0f, 100.0f + (menuindex * 50), 45.0f, 110.0f + (menuindex * 50) }, { 155, 0, 155 }, { 155, 155, 155 });
}
Exemplo n.º 15
0
// Render
/*virtual*/ void PauseState::Render(void)
{
	float width = Game::GetInstance()->GetScreenWidth();
	float height = Game::GetInstance()->GetScreenHeight();

	SGD::GraphicsManager * pGraphics = SGD::GraphicsManager::GetInstance();

	if (HTPGameState::GetInstance()->GetChoiceScreen() == false)
		HTPGameState::GetInstance()->Render();
	else
		GameplayState::GetInstance()->Render();

		pGraphics->DrawRectangle({ 0, 0, Game::GetInstance()->GetScreenWidth(), Game::GetInstance()->GetScreenHeight() }, { 210, 0, 0, 0 });

	// Use the game's font
	const BitmapFont* pFont = Game::GetInstance()->GetFont();

	// Align text based on window width
	
	float scale = 1.25f;
												


	// Display the game title centered at 4x scale
	pFont->Draw("PAUSED", { (width - (9 * 32 * 3.0f)) / 2, (26.0F * 3.0F) }, 3.0f, { 255, 255, 255 });


	
	if (m_nCursor == 0)
	{
		pFont->Draw("Resume", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 100.0f }, scale, { 255,255,255 });
		pFont->Draw("Controls", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 200.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Options", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 300.0f }, scale, { 255, 0, 0 });
		if (HTPGameState::GetInstance()->GetChoiceScreen() == false)
			pFont->Draw("Start Game", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });

		else
			pFont->Draw("Quit to Menu", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });
	}
	else if (m_nCursor == 1)
	{
		pFont->Draw("Resume", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 100.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Controls", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 200.0f }, scale, { 255, 255, 255 });
		pFont->Draw("Options", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 300.0f }, scale, { 255, 0, 0 });
		if (HTPGameState::GetInstance()->GetChoiceScreen() == false)
			pFont->Draw("Start Game", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });
		
		else
			pFont->Draw("Quit to Menu", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });
	}
	else if (m_nCursor == 2)
	{
		pFont->Draw("Resume", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 100.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Controls", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 200.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Options", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 300.0f }, scale, { 255, 255, 255 });
		if (HTPGameState::GetInstance()->GetChoiceScreen() == false)
			pFont->Draw("Start Game", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });

		else
			pFont->Draw("Quit to Menu", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 0, 0 });
	}

	else if (m_nCursor == 3)
	{
		pFont->Draw("Resume", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 100.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Controls", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 200.0f }, scale, { 255, 0, 0 });
		pFont->Draw("Options", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 300.0f }, scale, { 255, 0, 0 });
		if (HTPGameState::GetInstance()->GetChoiceScreen() == false)
			pFont->Draw("Start Game", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 255, 255 });

		else
			pFont->Draw("Quit to Menu", { (width*0.25f - (2 * 32 * scale)) / 2, (height * 0.25F) + 400.0f }, scale, { 255, 255, 255 });
	}





}
Exemplo n.º 16
0
void LoadState::Render()
{
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	BitmapFontManager* pFont = pFont->GetInstance();
	SGD::Color textColor = { 239, 208, 162 };

	pGraphics->DrawTexture(Game::GetInstance()->GetLoadingScreenBkGround(), { 0, 0 }, 0, {}, {}, { .78f, 1.2f });
	pGraphics->DrawTexture(Game::GetInstance()->GetGameIcon(), { 100, 0 }, 0, {}, {}, { 0.3f, 0.3f });
	pFont->Render("Other", "Select a Slot to Load", SGD::Point(250, 50), 1.5f, SGD::Color(0, 0, 0));


	pGraphics->DrawTexture(m_hButton, SGD::Point(280, 130));
	pFont->Render("Other", "New Game", SGD::Point(310, 145), 1, textColor);
	pGraphics->DrawTexture(m_hButton, SGD::Point(20, 300));
	pFont->Render("Other", m_sSlot1Name.c_str(), SGD::Point(50, 315), 1, textColor);
	pGraphics->DrawTexture(m_hButton, SGD::Point(525, 300));
	pFont->Render("Other", m_sSlot2Name.c_str(), SGD::Point(555, 315), 1, textColor);
	pGraphics->DrawTexture(m_hButton, SGD::Point(285, 470));
	pFont->Render("Other", m_sSlot3Name.c_str(), SGD::Point(315, 485), 1, textColor);
	pGraphics->DrawTexture(m_hButton, SGD::Point(630, 530), {}, {}, {}, { .5f, 1 });
	pFont->Render("Other", "Exit", SGD::Point(655, 545), 1, textColor);

	switch (m_nCursor)
	{
	case 0:
		pGraphics->DrawTexture(m_hButtonHighlighted, SGD::Point(280, 130));
		pFont->Render("Other", "New Game", SGD::Point(310, 145), 1, textColor);
		break;
	case 1:
		pGraphics->DrawTexture(m_hButtonHighlighted, SGD::Point(20, 300));
		pFont->Render("Other", m_sSlot1Name.c_str(), SGD::Point(50, 315), 1, textColor);
		break;
	case 2:
		pGraphics->DrawTexture(m_hButtonHighlighted, SGD::Point(525, 300));
		pFont->Render("Other", m_sSlot2Name.c_str(), SGD::Point(555, 315), 1, textColor);
		break;
	case 3:
		pGraphics->DrawTexture(m_hButtonHighlighted, SGD::Point(285, 470));
		pFont->Render("Other", m_sSlot3Name.c_str(), SGD::Point(315, 485), 1, textColor);
		break;
	case 4:
		pGraphics->DrawTexture(m_hButtonHighlighted, SGD::Point(630, 530), {}, {}, {}, { .5f, 1 });
		pFont->Render("Other", "Exit", SGD::Point(655, 545), 1, textColor);
		break;
	}

}
Exemplo n.º 17
0
void WeaponManager::Render()
{
	SGD::GraphicsManager * pGraphics = SGD::GraphicsManager::GetInstance();

	const BitmapFont * bFont = Game::GetInstance()->GetFont();

	SGD::Rectangle equipRect = { Game::GetInstance()->GetScreenWidth() - 343.0f, Game::GetInstance()->GetScreenHeight() - 135.0f, Game::GetInstance()->GetScreenWidth() - 60, Game::GetInstance()->GetScreenHeight() - 10 };

	int widthOffset = -10;
	int heightOffset = -15;
	float sWidth = Game::GetInstance()->GetScreenWidth() - 303;
	float sHeight = Game::GetInstance()->GetScreenHeight() - 195;

	SGD::Rectangle unEquip;

	//for (unsigned int j = 0; j < 5; j++)
	//{
	//	//unEquip = { sWidth - size, sHeight - 75, sWidth + size*j + size, sHeight };
	//	//pGraphics->DrawRectangle(unEquip, { 255, 255, 255 }, { 0, 0, 255 });

	//	//if (m_vWeapons[equipIndex]->GetObtained() == false)
	//	//{
	//	//	pGraphics->DrawRectangle({ sWidth + size*j, sHeight - size, sWidth + size*j + size, sHeight }, { 175, 0, 0, 0 });
	//	//}
	//}

	int index = 0;

	for (unsigned int j = 0; j < 5; j++)
	{
		index = j;
		
		for (int i = equipIndex; i > -1; i--)
		{
			//unEquip = { sWidth + widthOffset * j, sHeight - heightOffset * j, Game::GetInstance()->GetScreenWidth() - 10 - widthOffset * j, Game::GetInstance()->GetScreenHeight() - 10 + widthOffset*j};
			//pGraphics->DrawRectangle(unEquip, { 255, 255, 255 }, { 0, 0, 255 });

			if (m_vWeapons[i]->GetObtained() == true && m_vWeapons[i]->GetEquipped() == true)
			{
				SGD::Rectangle imageRect = m_vWeapons[i]->GetRenderRect();				

				if (m_vWeapons[i]->GetGunType() == m_vWeapons[curIndex]->GetGunType())
				{
					//pGraphics->DrawTextureSection(m_hHudWpn, { sWidth + widthOffset*j, sHeight - heightOffset * j },
					//	imageRect, {}, {}, {}, { 1.0f, 1.0f });
			
					//index--;
					//j--;

					if (index < 0)
					{
						index = 0;
					}

					equipRect = { sWidth + widthOffset*index, sHeight - heightOffset * index, sWidth + 282 + (widthOffset * index), sHeight + 125 - (heightOffset * index)  };
				}

				else
				{
					pGraphics->DrawRectangle({ sWidth + widthOffset*index, sHeight - heightOffset * index, sWidth + 282 + (widthOffset * index), sHeight + 125 - (heightOffset * index) }, { 255, 255, 255 }, { 0, 0, 255 },2);
					pGraphics->DrawTextureSection(m_hHudWpn, { sWidth + widthOffset*index, sHeight - heightOffset * index },
						imageRect, {}, {}, {}, { 1.0f, 1.0f });
					pGraphics->DrawRectangle({ (sWidth + widthOffset*index) - 2, (sHeight - heightOffset * index) - 2, (sWidth + 282 + (widthOffset * index)) + 2, (sHeight + 125 - (heightOffset * index)) + 2 }, { 175, 0, 0, 0 });
				}

				equipIndex--;
				break;
			}


			equipIndex--;
		}

	}

	pGraphics->DrawRectangle(equipRect, { 255, 255, 255 }, { 0, 0, 255 });

	pGraphics->DrawTextureSection(m_hHudWpn, { equipRect.left, equipRect.top },
		m_vWeapons[curIndex]->GetRenderRect(), {}, {}, {}, { 1.0, 1.0f });

	for (unsigned int i = 0; i < m_vWeapons.size(); i++)
	{
		if (m_vWeapons[curIndex]->GetGunType() == m_vWeapons[i]->GetGunType() && m_vWeapons[curIndex]->GetEquipped() == true)
		{


			stringstream magSize;
			magSize << m_vWeapons[curIndex]->GetCurrAmmo() << "|";

			SGD::Point magPos = { equipRect.left + 10, equipRect.bottom - 30 };
			SGD::Point ammoPos = { equipRect.left + 71, equipRect.bottom - 30 };

			if (m_vWeapons[curIndex]->GetCurrAmmo() < 10)
			{
				magPos.x = equipRect.left + 28;
			}

			bFont->Draw(magSize.str().c_str(), magPos, 1.0f, { 0, 0, 0 });

			stringstream ammoCap;
			ammoCap << m_vWeapons[curIndex]->GetTotalAmmo();

			if (m_vWeapons[curIndex]->GetTotalAmmo() < 10)
			{
				ammoPos.x = equipRect.left + 58;
			}

			else if (m_vWeapons[curIndex]->GetTotalAmmo() < 100)
			{
				ammoPos.x = equipRect.left + 68;
			}

			else
			{
				ammoPos.x = equipRect.left + 71;
			}

			if (m_vWeapons[curIndex]->GetType() == PISTOL)
			{
				bFont->Draw("INF", ammoPos, 1.0f, { 0, 0, 0 });
			}

			else
				bFont->Draw(ammoCap.str().c_str(), ammoPos, 1.0f, { 0, 0, 0 });

			//if (m_vWeapons[curIndex]->GetCurrAmmo() == 0 && m_vWeapons[curIndex]->GetTotalAmmo() > 0)
			//{
			//	//bFont->Draw("RELOADING", { Game::GetInstance()->GetScreenWidth() - 328, Game::GetInstance()->GetScreenHeight() - 130 }, 1.5f, { 200, 0, 0 });
			//}
			if (m_vWeapons[curIndex]->GetReloadTimer().GetTime() > 0 && m_vWeapons[curIndex]->GetTotalAmmo() > 0)
			{
				bFont->Draw("RELOADING", { equipRect.left + 5, equipRect.top + 5 }, 1.5f, { 200, 0, 0 });
				//bFont->Draw("RELOADING", { (Game::GetInstance()->GetScreenWidth() * 0.5f) - 100.0f, (Game::GetInstance()->GetScreenHeight() * 0.5f) - 70.0f }, 1.5f, { 200, 0, 0 });
				//bFont->Draw("RELOADING", { (Game::GetInstance()->GetScreenWidth() * 0.5f) - 100.0f, (Game::GetInstance()->GetScreenHeight() * 0.5f) + 30.0f }, 1.5f, { 200, 0, 0 });
			}
			else if (m_vWeapons[curIndex]->GetTotalAmmo() == 0 && m_vWeapons[curIndex]->GetCurrAmmo() <= 0)
			{
				bFont->Draw("OUT OF AMMO", { equipRect.left + 5, equipRect.top + 5 }, .75f, { 200, 0, 0 });
			//bFont->Draw("OUT OF AMMO", { (Game::GetInstance()->GetScreenWidth() * 0.5f) - 100.0f, (Game::GetInstance()->GetScreenHeight() * 0.5f) + 30.0f }, 1.5f, { 200, 0, 0 });
			}


		}
	}

	equipIndex = m_vWeapons.size() - 1;

	//for (unsigned int i = 0; i < 5; i++)
	//{
	//	for (unsigned int j = 0; j < m_vWeapons.size(); j++)
	//	{
	//		SGD::Rectangle unEquip = { sWidth + size*i, sHeight - 75, sWidth + size*i + size, sHeight };

	//		stringstream drawIndex;
	//		drawIndex << i + 1;

	//		bFont->Draw(drawIndex.str().c_str(), { unEquip.left + 1, unEquip.top - 5 }, .5f, { 150, 155, 155 });
	//	}
	//}


}