MyGUI  3.2.1
MyGUI_ActionController.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_ACTION_CONTROLLER_H__
00008 #define __MYGUI_ACTION_CONTROLLER_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_Types.h"
00012 #include <math.h>
00013 
00014 namespace MyGUI
00015 {
00016     class ControllerItem;
00017 
00018     namespace action
00019     {
00020 
00022         void MYGUI_EXPORT actionWidgetHide(Widget* _widget, ControllerItem* _controller);
00023 
00025         void MYGUI_EXPORT actionWidgetShow(Widget* _widget, ControllerItem* _controller);
00026 
00028         void MYGUI_EXPORT actionWidgetDestroy(Widget* _widget, ControllerItem* _controller);
00029 
00031         void MYGUI_EXPORT linearMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _k);
00032 
00038         template <int N>
00039         inline void acceleratedMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time)
00040         {
00041             float k = (float)pow (_current_time, N / 10.f /*3 by default as Accelerated and 0.4 by default as Slowed*/);
00042             linearMoveFunction(_startRect, _destRect, _result, k);
00043         }
00044 
00046         template <int N>
00047         inline void jumpMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time)
00048         {
00049             float k = pow (_current_time, 2) * (-2 - N / 10.f) + _current_time * (3 + N / 10.f);
00050             linearMoveFunction(_startRect, _destRect, _result, k);
00051         }
00052 
00054         void MYGUI_EXPORT inertionalMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time);
00055 
00056     } // namespace action
00057 
00058 } // namespace MyGUI
00059 
00060 #endif // __MYGUI_ACTION_CONTROLLER_H__