MyGUI 3.4.3
MyGUI_ActionController.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_ACTION_CONTROLLER_H_
8#define MYGUI_ACTION_CONTROLLER_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Types.h"
12#include <cmath>
13
14namespace MyGUI
15{
16 class ControllerItem;
17
18 namespace action
19 {
20
22 void MYGUI_EXPORT actionWidgetHide(Widget* _widget, ControllerItem* _controller);
23
25 void MYGUI_EXPORT actionWidgetShow(Widget* _widget, ControllerItem* _controller);
26
28 void MYGUI_EXPORT actionWidgetDestroy(Widget* _widget, ControllerItem* _controller);
29
31 void MYGUI_EXPORT
32 linearMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _k);
33
39 template<int N>
41 const IntCoord& _startRect,
42 const IntCoord& _destRect,
43 IntCoord& _result,
44 float _current_time)
45 {
46 float k = std::pow(_current_time, N / 10.f /*3 by default as Accelerated and 0.4 by default as Slowed*/);
47 linearMoveFunction(_startRect, _destRect, _result, k);
48 }
49
51 template<int N>
52 inline void jumpMoveFunction(
53 const IntCoord& _startRect,
54 const IntCoord& _destRect,
55 IntCoord& _result,
56 float _current_time)
57 {
58 float k = std::pow(_current_time, 2.0f) * (-2 - N / 10.f) + _current_time * (3 + N / 10.f);
59 linearMoveFunction(_startRect, _destRect, _result, k);
60 }
61
64 const IntCoord& _startRect,
65 const IntCoord& _destRect,
66 IntCoord& _result,
67 float _current_time);
68
69 } // namespace action
70
71} // namespace MyGUI
72
73#endif // MYGUI_ACTION_CONTROLLER_H_
#define MYGUI_EXPORT
widget description should be here.
void acceleratedMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
void actionWidgetDestroy(Widget *_widget, ControllerItem *_controller)
void jumpMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
void linearMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _k)
void inertionalMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
void actionWidgetHide(Widget *_widget, ControllerItem *_controller)
void actionWidgetShow(Widget *_widget, ControllerItem *_controller)
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36