2017-01-10 12:43:06 +00:00
|
|
|
#include "creditscode.h"
|
|
|
|
#include "include/Engine.h"
|
|
|
|
|
|
|
|
#include "main_code.h"
|
|
|
|
|
|
|
|
const int TGameCredits::CONST_STATE_APPEARING = 0;
|
|
|
|
const int TGameCredits::CONST_STATE_APPEARED = 1;
|
|
|
|
const int TGameCredits::CONST_STATE_DISAPPEARING = 2;
|
|
|
|
const int TGameCredits::CONST_STATE_DISAPPEARED = 3;
|
|
|
|
|
|
|
|
const float TGameCredits::CONST_APPEAR_TIME = 150.f;
|
|
|
|
|
|
|
|
TGameCredits::TGameCredits()
|
|
|
|
: TGameAreaAncestor()
|
|
|
|
, StateTimer(0)
|
|
|
|
, State(CONST_STATE_DISAPPEARED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGameCredits::Draw()
|
|
|
|
{
|
2017-11-14 17:04:04 +00:00
|
|
|
//*SE::Console << "TGameCredits::Draw";
|
2017-01-10 12:43:06 +00:00
|
|
|
float transparency = StateTimer/CONST_APPEAR_TIME;
|
|
|
|
|
|
|
|
|
|
|
|
RenderUniform1f("Transparency", transparency);
|
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList["main_menu_bkg_left"]);
|
2018-03-20 10:54:53 +00:00
|
|
|
Renderer->DrawRect(Vector2f(0, 0.f), Vector2f(Renderer->GetScreenWidth(), Renderer->GetScreenHeight()));
|
2017-01-10 12:43:06 +00:00
|
|
|
|
2017-11-14 17:04:04 +00:00
|
|
|
const Vector2f creditsPos(140.f, 130.f);
|
2017-01-10 12:43:06 +00:00
|
|
|
|
2017-11-14 17:04:04 +00:00
|
|
|
const Vector2f creditsHalfSize(128.f, 128.f);
|
2017-01-10 12:43:06 +00:00
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_CREDITS_TEXTURE]);
|
|
|
|
Renderer->DrawRect(creditsPos-creditsHalfSize, creditsPos+creditsHalfSize);
|
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_LOGO_SMALL_TEXTURE]);
|
2017-11-14 17:04:04 +00:00
|
|
|
Renderer->DrawRect(Vector2f(240.f-128.f+15.f, 320.f-64.f), Vector2f(240.f+128.f+15.f, 320.f));
|
2017-01-10 12:43:06 +00:00
|
|
|
|
|
|
|
CheckGlError("Draw TGameCredits");
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:04:04 +00:00
|
|
|
void TGameCredits::Update(size_t dt)
|
2017-01-10 12:43:06 +00:00
|
|
|
{
|
|
|
|
if (State == CONST_STATE_APPEARING)
|
2017-11-14 17:04:04 +00:00
|
|
|
{
|
|
|
|
*SE::Console << "TGameCredits::Update - CONST_STATE_APPEARING";
|
2017-01-10 12:43:06 +00:00
|
|
|
StateTimer += dt;
|
|
|
|
if (StateTimer >= CONST_APPEAR_TIME)
|
|
|
|
{
|
|
|
|
StateTimer = CONST_APPEAR_TIME;
|
|
|
|
State = CONST_STATE_APPEARED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (State == CONST_STATE_DISAPPEARING)
|
2017-11-14 17:04:04 +00:00
|
|
|
{
|
2017-01-10 12:43:06 +00:00
|
|
|
StateTimer -= dt;
|
|
|
|
if (StateTimer <= 0.f)
|
|
|
|
{
|
|
|
|
StateTimer = 0.f;
|
|
|
|
State = CONST_STATE_DISAPPEARED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:04:04 +00:00
|
|
|
void TGameCredits::OnTapDown(Vector2f p)
|
2017-01-10 12:43:06 +00:00
|
|
|
{
|
2017-11-14 17:04:04 +00:00
|
|
|
*SE::Console << "TGameCredits::OnTapDown";
|
2017-01-10 12:43:06 +00:00
|
|
|
Application->GoFromCreditsToMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGameCredits::StartAppear()
|
|
|
|
{
|
2017-11-14 17:04:04 +00:00
|
|
|
*SE::Console << "TGameCredits::StartAppear";
|
2017-01-10 12:43:06 +00:00
|
|
|
State = CONST_STATE_APPEARING;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGameCredits::StartDisappear()
|
|
|
|
{
|
2017-11-14 17:04:04 +00:00
|
|
|
*SE::Console << "TGameCredits::StartDisappear";
|
2017-01-10 12:43:06 +00:00
|
|
|
State = CONST_STATE_DISAPPEARING;
|
|
|
|
}
|