MyGUI 3.4.2
MyGUI_ActionController.cpp
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#include "MyGUI_Precompiled.h"
9#include "MyGUI_Widget.h"
10#include "MyGUI_WidgetManager.h"
11
12namespace MyGUI
13{
14
15 namespace action
16 {
17
19 {
20 _widget->setVisible(false);
21 }
22
24 {
25 _widget->setVisible(true);
26 }
27
29 {
30 WidgetManager::getInstance().destroyWidget(_widget);
31 }
32
34 {
35 _result.set(
36 _startRect.left - int( float(_startRect.left - _destRect.left) * _k ),
37 _startRect.top - int( float(_startRect.top - _destRect.top) * _k ),
38 _startRect.width - int( float(_startRect.width - _destRect.width) * _k ),
39 _startRect.height - int( float(_startRect.height - _destRect.height) * _k ));
40 }
41
43 {
44#ifdef M_PI
45#undef M_PI
46#endif
47 const float M_PI = 3.141593f;
48 float k = std::sin(M_PI * _current_time - M_PI / 2.0f);
49 if (k < 0) k = (-std::pow(-k, 0.7f) + 1) / 2;
50 else k = (std::pow(k, 0.7f) + 1) / 2;
52 }
53
54 } // namespace action
55
56} // namespace MyGUI
widget description should be here.
static WidgetManager & getInstance()
void actionWidgetDestroy(Widget *_widget, ControllerItem *_controller)
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)