MyGUI  3.2.0
MyGUI_ActionController.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI 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
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_ACTION_CONTROLLER_H__
23 #define __MYGUI_ACTION_CONTROLLER_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Types.h"
27 #include <math.h>
28 
29 namespace MyGUI
30 {
31 
32  namespace action
33  {
34 
36  void MYGUI_EXPORT actionWidgetHide(Widget* _widget);
37 
39  void MYGUI_EXPORT actionWidgetShow(Widget* _widget);
40 
43 
45  void MYGUI_EXPORT linearMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _k);
46 
52  template <int N>
53  inline void acceleratedMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time)
54  {
55  float k = (float)pow (_current_time, N / 10.f /*3 by default as Accelerated and 0.4 by default as Slowed*/);
56  linearMoveFunction(_startRect, _destRect, _result, k);
57  }
58 
60  template <int N>
61  inline void jumpMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time)
62  {
63  float k = pow (_current_time, 2) * (-2 - N / 10.f) + _current_time * (3 + N / 10.f);
64  linearMoveFunction(_startRect, _destRect, _result, k);
65  }
66 
68  void MYGUI_EXPORT inertionalMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _current_time);
69 
70  } // namespace action
71 
72 } // namespace MyGUI
73 
74 #endif // __MYGUI_ACTION_CONTROLLER_H__
void inertionalMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
void linearMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _k)
void acceleratedMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
#define MYGUI_EXPORT
void actionWidgetDestroy(Widget *_widget)
void jumpMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
void actionWidgetHide(Widget *_widget)
void actionWidgetShow(Widget *_widget)