summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2023-08-05 23:29:33 +0200
committervaxerski <vaxry@vaxry.net>2023-08-05 23:29:33 +0200
commita077b7a92e87a3edd1cebb9bdd4c4fa3ec3d7bb7 (patch)
tree50ad00b5bf146872926fa6e67f791096670fd0d9 /src/helpers
parentb925f1b49774b38ab670815e78726fe16295d0d9 (diff)
animationmgr: avoid redundant ticks
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/AnimatedVariable.cpp3
-rw-r--r--src/helpers/Timer.cpp4
-rw-r--r--src/helpers/Timer.hpp7
3 files changed, 11 insertions, 3 deletions
diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp
index 2961439d..450826f9 100644
--- a/src/helpers/AnimatedVariable.cpp
+++ b/src/helpers/AnimatedVariable.cpp
@@ -82,8 +82,11 @@ float CAnimatedVariable::getCurveValue() {
}
void CAnimatedVariable::connectToActive() {
+ g_pAnimationManager->scheduleTick(); // otherwise the animation manager will never pick this up
+
if (!m_bIsConnectedToActive)
g_pAnimationManager->m_vActiveAnimatedVariables.push_back(this);
+
m_bIsConnectedToActive = true;
}
diff --git a/src/helpers/Timer.cpp b/src/helpers/Timer.cpp
index 33162d30..6847567a 100644
--- a/src/helpers/Timer.cpp
+++ b/src/helpers/Timer.cpp
@@ -14,4 +14,8 @@ int CTimer::getMillis() {
float CTimer::getSeconds() {
return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count() / 1000.f;
+}
+
+const std::chrono::system_clock::time_point& CTimer::chrono() const {
+ return m_tpLastReset;
} \ No newline at end of file
diff --git a/src/helpers/Timer.hpp b/src/helpers/Timer.hpp
index 7b5bfc9d..4ab0d294 100644
--- a/src/helpers/Timer.hpp
+++ b/src/helpers/Timer.hpp
@@ -4,9 +4,10 @@
class CTimer {
public:
- void reset();
- float getSeconds();
- int getMillis();
+ void reset();
+ float getSeconds();
+ int getMillis();
+ const std::chrono::system_clock::time_point& chrono() const;
private:
std::chrono::system_clock::time_point m_tpLastReset;