Claw
1.7.3
|
00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2011 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 contact: julien.jorge@gamned.org 00023 */ 00029 #include <claw/tween/tweener.hpp> 00030 00031 #include <claw/tween/base_tweener.hpp> 00032 00033 /*----------------------------------------------------------------------------*/ 00037 claw::tween::tweener::tweener() 00038 : m_impl(NULL) 00039 { 00040 00041 } // tweener::tweener() 00042 00043 /*----------------------------------------------------------------------------*/ 00048 claw::tween::tweener::tweener( const tweener& that ) 00049 : m_impl( that.m_impl == NULL ? NULL : that.m_impl->clone() ) 00050 { 00051 00052 } // tweener::tweener() 00053 00054 /*----------------------------------------------------------------------------*/ 00059 claw::tween::tweener::tweener( const base_tweener& that ) 00060 : m_impl( that.clone() ) 00061 { 00062 00063 } // tweener::tweener() 00064 00065 /*----------------------------------------------------------------------------*/ 00069 claw::tween::tweener::~tweener() 00070 { 00071 delete m_impl; 00072 } // tweener::~tweener() 00073 00074 /*----------------------------------------------------------------------------*/ 00079 claw::tween::tweener& claw::tween::tweener::operator=( const tweener& that ) 00080 { 00081 tweener tmp(that); 00082 swap(tmp); 00083 return *this; 00084 } // tweener::operator=() 00085 00086 /*----------------------------------------------------------------------------*/ 00091 void claw::tween::tweener::swap( tweener& that ) throw() 00092 { 00093 std::swap(m_impl, that.m_impl); 00094 } // tweener::swap() 00095 00096 /*----------------------------------------------------------------------------*/ 00100 bool claw::tween::tweener::is_finished() const 00101 { 00102 if ( m_impl == NULL ) 00103 return true; 00104 else 00105 return m_impl->is_finished(); 00106 } // tweener::is_finished() 00107 00108 /*----------------------------------------------------------------------------*/ 00113 double claw::tween::tweener::update( double dt ) 00114 { 00115 if ( m_impl == NULL ) 00116 return dt; 00117 else 00118 return m_impl->update(dt); 00119 } // tweener::update() 00120 00121 /*----------------------------------------------------------------------------*/ 00125 void claw::tween::tweener::on_finished( finish_callback f ) 00126 { 00127 if ( m_impl != NULL ) 00128 m_impl->on_finished(f); 00129 } // tweener::on_finished() 00130 00131 /*----------------------------------------------------------------------------*/ 00137 template<> 00138 void std::swap( claw::tween::tweener& a, claw::tween::tweener& b ) 00139 { 00140 a.swap(b); 00141 } // std::swap()