hx3d  1
2D/3D Simple Game Framework
tween.hpp
1 /*
2  Regular tween.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_TWEENS_TWEEN
22 #define HX3D_TWEENS_TWEEN
23 
24 #include "hx3d/tweens/base_tween.hpp"
25 
26 namespace hx3d {
27 namespace tweens {
28 
32 template <class T>
33 class Tween: public BaseTween {
34 public:
44  Tween(T& mod, const T end, const float duration, const math::Interpolation interp, bool infinite = false);
45 
46  virtual void reset() override;
47  virtual void update(const float delta) override;
48 
49 private:
51  T* mod;
53  T base;
55  T end;
56 
58  float duration;
60  float currentTime;
62  math::Interpolation interp;
63 
65  bool _firstUpdate;
66 };
67 
68 } /* tween */
69 } /* hx3d */
70 
71 #include "hx3d/tweens/_inline/tween.inl.hpp"
72 
73 #endif
virtual void reset() override
Reset the tween.
Definition: tween.inl.hpp:32
virtual void update(const float delta) override
Update the tween.
Definition: tween.inl.hpp:38
hx3d framework namespace
Definition: audio.hpp:26
Templated tween definition.
Definition: tween.hpp:33
Interpolation
Interpolate using functions.
Tween(T &mod, const T end, const float duration, const math::Interpolation interp, bool infinite=false)
Create a tween.
Definition: tween.inl.hpp:25
Base abstract tween.
Definition: base_tween.hpp:34