tweener.hpp
Go to the documentation of this file.
/*
CLAW - a C++ Library Absolutely Wonderful
CLAW is a free library without any particular aim but being useful to
anyone.
Copyright (C) 2005-2011 Julien Jorge
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
contact: julien.jorge@gamned.org
*/
#ifndef __CLAW_TWEEN_TWEENER_HPP__
#define __CLAW_TWEEN_TWEENER_HPP__
#include <algorithm>
#include <boost/function.hpp>
namespace claw
{
namespace tween
{
class base_tweener;
class tweener
{
public:
typedef boost::function<void ()> finish_callback;
public:
tweener();
tweener( const tweener& that );
tweener( const base_tweener& that );
~tweener();
tweener& operator=( const tweener& that );
void swap( tweener& that ) throw();
bool is_finished() const;
double update( double dt );
void on_finished( finish_callback f );
private:
base_tweener* m_impl;
}; // class tweener
} // namespace tween
} // namespace claw
namespace std
{
template<>
void swap( claw::tween::tweener& a, claw::tween::tweener& b );
} // namespace std
#endif // __CLAW_TWEEN_TWEENER_HPP__
claw::tween::tweener::update
double update(double dt)
Update the tweener of a given amount of time.
Definition: tweener.cpp:113
claw::tween::tweener::swap
void swap(tweener &that)
Swap this instance with a given instance.
Definition: tweener.cpp:91
claw::tween::base_tweener
Common interface for all tweeners.
Definition: base_tweener.hpp:44
std
Definition: gif.hpp:461
claw::tween::tweener::~tweener
~tweener()
Destructor.
Definition: tweener.cpp:69
claw::tween::tweener
A tweener makes a value to evolve through time from a initial value to an end value according to a gi...
Definition: tweener.hpp:48
claw::tween::tweener::finish_callback
boost::function< void()> finish_callback
The type of the function called to notify the end of the tweener.
Definition: tweener.hpp:55
claw::tween::tweener::operator=
tweener & operator=(const tweener &that)
Assignment operator.
Definition: tweener.cpp:79
claw::tween::tweener::tweener
tweener()
Default constructor.
Definition: tweener.cpp:37
claw::tween::tweener::is_finished
bool is_finished() const
Tell if the tweener has reached his total duration.
Definition: tweener.cpp:100
claw::tween::tweener::on_finished
void on_finished(finish_callback f)
Execute the callbacks notifying about the finish of the tweener.
Definition: tweener.cpp:125
claw
This is the main namespace.
Definition: algorithm.hpp:33