Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Animated.hpp
1#pragma once
2
3#include "system/Codable.hpp"
4#include "Common.hpp"
5
10template <typename T>
11class Animated {
12public:
13
17 explicit Animated(const T & value){
18 _initial = value;
19 _current = value;
20 }
21
25 const T & initial() const {
26 return _initial;
27 }
28
32 void reset(const T & value){
33 _initial = value;
34 _current = value;
35 }
36
42 T & operator=(const T & value){
43 _current = value;
44 return *this;
45 }
46
50 const T & get() const {
51 return _current;
52 }
53
58 operator T & () {
59 return _current;
60 }
61
65 operator const T & () const {
66 return _current;
67 }
68
69private:
70
71 T _initial = T();
72 T _current = T();
73};
Wraps an animated property so that the initial value is preserved.
Definition: Animated.hpp:11
const T & get() const
Definition: Animated.hpp:50
const T & initial() const
Definition: Animated.hpp:25
T _current
Current value.
Definition: Animated.hpp:72
Animated(const T &value)
Definition: Animated.hpp:17
void reset(const T &value)
Definition: Animated.hpp:32
T & operator=(const T &value)
Definition: Animated.hpp:42
T _initial
Initial value.
Definition: Animated.hpp:71