diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-03-07 16:05:57 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:12:40 +0300 |
commit | 69f6e406743e9bfa4813989cec71d9465b1524e2 (patch) | |
tree | 98ec8f1e4163bcfced4abafcd37499c51401ccd9 /map/alfa_animation_task.cpp | |
parent | aa9010fa705edb99280619e9e74e04fbff2b0430 (diff) |
new ruler with chess and poetesses
Diffstat (limited to 'map/alfa_animation_task.cpp')
-rw-r--r-- | map/alfa_animation_task.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/map/alfa_animation_task.cpp b/map/alfa_animation_task.cpp new file mode 100644 index 0000000000..0370758b0c --- /dev/null +++ b/map/alfa_animation_task.cpp @@ -0,0 +1,49 @@ +#include "alfa_animation_task.hpp" + +#include "framework.hpp" + +AlfaCompassAnim::AlfaCompassAnim(double start, double end, double timeInterval, double timeOffset, Framework * f) + : m_start(start) + , m_end(end) + , m_current(start) + , m_timeInterval(timeInterval) + , m_timeOffset(timeOffset) + , m_f(f) +{ +} + +bool AlfaCompassAnim::IsHiding() const +{ + return m_start > m_end; +} + +float AlfaCompassAnim::GetCurrentAlfa() const +{ + return m_current; +} + +void AlfaCompassAnim::OnStart(double ts) +{ + m_timeStart = ts; + base_t::OnStart(ts); + m_f->Invalidate(); +} + +void AlfaCompassAnim::OnStep(double ts) +{ + base_t::OnStep(ts); + double elapsed = ts - (m_timeStart + m_timeOffset); + if (elapsed >= 0.0) + { + double t = elapsed / m_timeInterval; + if (t > 1.0) + { + m_current = m_end; + End(); + } + else + m_current = m_start + t * (m_end - m_start); + } + + m_f->Invalidate(); +} |