コード例 #1
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 ) );
	

}
コード例 #2
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 });
	*/
}
コード例 #3
0
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 ) );

	}
}
コード例 #4
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);

}
コード例 #5
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;
	}

}