32 #include <boost/bind.hpp> 50 static void local_swap(
double& a,
double& b )
57 #ifndef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION 59 #ifndef WORKAROUND_BOOST_THROW_EXCEPTION 60 #define WORKAROUND_BOOST_THROW_EXCEPTION 62 #include "boost/throw_exception.hpp" 82 #endif // WORKAROUND_BOOST_THROW_EXCEPTION 83 #endif // ifdef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION 107 : m_init(init), m_end(end), m_date(0), m_duration(duration),
108 m_callback(callback), m_easing(e)
123 : m_init(val), m_end(end), m_date(0), m_duration(duration), m_easing(e)
125 m_callback = boost::bind( &local_swap, boost::ref(val), _1 );
211 const double coeff = m_easing( m_date / m_duration );
212 return m_init + coeff * (m_end - m_init);
228 bool claw::tween::single_tweener::do_is_finished()
const 230 return m_date >= m_duration;
238 double claw::tween::single_tweener::do_update(
double dt )
240 const double t( std::min(m_duration - m_date, dt) );
241 const double result = dt - t;
244 double val( get_value() );
void set_init(double v)
Sets the initial value.
Redefinition of some boost elements, required on some compilers.
boost::function< double(double)> easing_function
The type of the function used to compute the new value.
double get_end() const
Gets the final value.
A single_tweener makes a value to evolve through time from a initial value to an end value according ...
void set_duration(double v)
Sets the total duration.
double get_value() const
Gets the current value of the tweener.
void set_callback(update_function f)
The function called when the single_tweener is updated.
void set_end(double v)
Sets the final value.
double get_duration() const
Gets the total duration.
single_tweener()
Default constructor.
A single_tweener makes a value to evolve through time from a initial value to an end value according ...
double get_init() const
Gets the initial value.
Easing functions for the tweener. Those functions do nothing.
void set_easing(easing_function f)
The function used to compute the new value.
boost::function< void(double &)> update_function
The type of the function called when the single_tweener is updated.
void throw_exception(std::exception const &exc)
boost::throw_exception definition, Needed on XCode compiler. This implementation does nothing...