claw
1.9.0
Toggle main menu visibility
Loading...
Searching...
No Matches
single_tweener.hpp
Go to the documentation of this file.
1
/*
2
CLAW - a C++ Library Absolutely Wonderful
3
4
CLAW is a free library without any particular aim but being useful to
5
anyone.
6
7
Copyright (C) 2005-2011 Julien Jorge
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
contact: julien.jorge@stuff-o-matic.com
23
*/
30
#ifndef __CLAW_TWEEN_SINGLE_TWEENER_HPP__
31
#define __CLAW_TWEEN_SINGLE_TWEENER_HPP__
32
33
#include <
claw/tween/base_tweener.hpp
>
34
#include <
claw/tween/easing/easing_none.hpp
>
35
36
#include <functional>
37
38
namespace
claw
39
{
40
namespace
tween
41
{
48
class
single_tweener
:
public
base_tweener
49
{
50
public
:
53
typedef
std::function<void(
double
)>
update_function
;
54
56
typedef
std::function<double(
double
)>
easing_function
;
57
58
public
:
59
single_tweener
();
60
single_tweener
(
double
init,
double
end,
double
duration,
61
update_function
callback,
easing_function
e);
62
single_tweener
(
double
& val,
double
end,
double
duration,
63
easing_function
e);
64
65
double
get_init
()
const
;
66
void
set_init
(
double
v);
67
68
double
get_end
()
const
;
69
void
set_end
(
double
v);
70
71
double
get_duration
()
const
;
72
void
set_duration
(
double
v);
73
74
void
set_callback
(
update_function
f);
75
void
set_easing
(
easing_function
f);
76
77
double
get_value
()
const
;
78
79
private
:
80
single_tweener
* do_clone()
const
;
81
bool
do_is_finished()
const
;
82
double
do_update(
double
dt);
83
84
private
:
86
double
m_init;
87
89
double
m_end;
90
92
double
m_date;
93
95
double
m_duration;
96
98
update_function
m_callback;
99
101
easing_function
m_easing;
102
103
};
// class single_tweener
104
105
}
106
}
107
108
#endif
// __CLAW_TWEEN_SINGLE_TWEENER_HPP__
base_tweener.hpp
Common interface for all tweeners.
claw::tween::base_tweener
Common interface for all tweeners.
Definition
base_tweener.hpp:45
claw::tween::single_tweener::set_duration
void set_duration(double v)
Sets the total duration.
Definition
single_tweener.cpp:128
claw::tween::single_tweener::get_end
double get_end() const
Gets the final value.
Definition
single_tweener.cpp:102
claw::tween::single_tweener::set_end
void set_end(double v)
Sets the final value.
Definition
single_tweener.cpp:111
claw::tween::single_tweener::single_tweener
single_tweener()
Default constructor.
Definition
single_tweener.cpp:36
claw::tween::single_tweener::set_easing
void set_easing(easing_function f)
The function used to compute the new value.
Definition
single_tweener.cpp:146
claw::tween::single_tweener::easing_function
std::function< double(double)> easing_function
The type of the function used to compute the new value.
Definition
single_tweener.hpp:56
claw::tween::single_tweener::get_init
double get_init() const
Gets the initial value.
Definition
single_tweener.cpp:85
claw::tween::single_tweener::set_init
void set_init(double v)
Sets the initial value.
Definition
single_tweener.cpp:94
claw::tween::single_tweener::get_duration
double get_duration() const
Gets the total duration.
Definition
single_tweener.cpp:119
claw::tween::single_tweener::set_callback
void set_callback(update_function f)
The function called when the single_tweener is updated.
Definition
single_tweener.cpp:137
claw::tween::single_tweener::get_value
double get_value() const
Gets the current value of the tweener.
Definition
single_tweener.cpp:154
claw::tween::single_tweener::update_function
std::function< void(double)> update_function
The type of the function called when the single_tweener is updated.
Definition
single_tweener.hpp:53
easing_none.hpp
Easing functions for the tweener. Those functions do nothing.
claw::tween
Tweeners interpolate the intermediate values between two given reference values using various equatio...
Definition
claw.hpp:96
claw
This is the main namespace.
Definition
application.hpp:50
lib
tween
include
claw
tween
single_tweener.hpp
Generated by
1.17.0