summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorXienDev <XienDev@gmail.com>2013-04-25 22:05:27 +0300
committerXienDev <XienDev@gmail.com>2013-04-25 22:05:27 +0300
commitb8d2ce2e4ef355fa82a3dded6d4b7dd9732f4358 (patch)
treec5d9fdc0eda7509de00e39b8e9c371fe58d08150 /src/ui
parent6a1dba0f153adbe99333f8205ba06404351b7aa7 (diff)
downloadcolobot-b8d2ce2e4ef355fa82a3dded6d4b7dd9732f4358.tar.gz
colobot-b8d2ce2e4ef355fa82a3dded6d4b7dd9732f4358.tar.bz2
colobot-b8d2ce2e4ef355fa82a3dded6d4b7dd9732f4358.zip
Welcome screen blinking fix
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/maindialog.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index b75fab6..092903d 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -63,7 +63,7 @@ const int KEY_VISIBLE = 6; // number of visible keys redefinable
const int KEY_TOTAL = 21; // total number of keys redefinable
-const float WELCOME_LENGTH = 2.0f;
+const float WELCOME_LENGTH = 3.0f;
const int MAX_FNAME = 255; // TODO: remove after rewrite to std::string
@@ -1769,7 +1769,7 @@ pos.y -= 0.048f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
- m_engine->SetOverColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
+ m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("colobot.png",
@@ -2006,28 +2006,35 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_WELCOME3 )
{
float intensity;
- int mode = Gfx::ENG_RSTATE_TCOLOR_BLACK;
+ int mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
- if ( m_phaseTime < 1.5f )
+ // 1/4 of display time is animating
+ float animatingTime = welcomeLength / 4.0f;
+
+ if ( m_phaseTime < animatingTime )
{
- intensity = 1.0f-(m_phaseTime-0.5f);
+ //appearing
+ intensity = m_phaseTime / animatingTime;
}
- else if ( m_phaseTime < welcomeLength-1.0f )
+ else if ( m_phaseTime < welcomeLength - animatingTime )
{
- intensity = 0.0f;
+ //showing
+ intensity = 1.0f;
}
else
{
- intensity = m_phaseTime-(welcomeLength-1.0f);
+ //hiding
+ intensity = (welcomeLength - m_phaseTime) / animatingTime;
}
+
if ( intensity < 0.0f ) intensity = 0.0f;
if ( intensity > 1.0f ) intensity = 1.0f;
- if ( (m_phase == PHASE_WELCOME2 && m_phaseTime > welcomeLength/2.0f) ||
- m_phase == PHASE_WELCOME3 )
+ //white first, others -> black fadding
+ if ( (m_phase == PHASE_WELCOME1) && ( m_phaseTime < welcomeLength/2.0f))
{
- intensity = 1.0f-intensity;
- mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
+ intensity = 1.0f - intensity;
+ mode = Gfx::ENG_RSTATE_TCOLOR_BLACK;
}
m_engine->SetOverColor(Gfx::Color(intensity, intensity, intensity, intensity), mode); // TODO: color ok?