MyGUI_ActionController.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_ACTION_CONTROLLER_H_
#define MYGUI_ACTION_CONTROLLER_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Types.h"
#include <cmath>
namespace MyGUI
{
class ControllerItem;
namespace action
{
void MYGUI_EXPORT actionWidgetHide(Widget* _widget, ControllerItem* _controller);
void MYGUI_EXPORT actionWidgetShow(Widget* _widget, ControllerItem* _controller);
void MYGUI_EXPORT actionWidgetDestroy(Widget* _widget, ControllerItem* _controller);
void MYGUI_EXPORT
linearMoveFunction(const IntCoord& _startRect, const IntCoord& _destRect, IntCoord& _result, float _k);
template<int N>
inline void acceleratedMoveFunction(
const IntCoord& _startRect,
const IntCoord& _destRect,
IntCoord& _result,
float _current_time)
{
float k = std::pow(_current_time, N / 10.f /*3 by default as Accelerated and 0.4 by default as Slowed*/);
linearMoveFunction(_startRect, _destRect, _result, k);
}
template<int N>
inline void jumpMoveFunction(
const IntCoord& _startRect,
const IntCoord& _destRect,
IntCoord& _result,
float _current_time)
{
float k = std::pow(_current_time, 2.0f) * (-2 - N / 10.f) + _current_time * (3 + N / 10.f);
linearMoveFunction(_startRect, _destRect, _result, k);
}
void MYGUI_EXPORT inertionalMoveFunction(
const IntCoord& _startRect,
const IntCoord& _destRect,
IntCoord& _result,
float _current_time);
} // namespace action
} // namespace MyGUI
#endif // MYGUI_ACTION_CONTROLLER_H_
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_Types.h
MyGUI::ControllerItem
Definition MyGUI_ControllerItem.h:26
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::action
Definition MyGUI_ActionController.h:19
MyGUI::action::acceleratedMoveFunction
void acceleratedMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
Definition MyGUI_ActionController.h:40
MyGUI::action::actionWidgetDestroy
void actionWidgetDestroy(Widget *_widget, ControllerItem *_controller)
Definition MyGUI_ActionController.cpp:25
MyGUI::action::jumpMoveFunction
void jumpMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
Definition MyGUI_ActionController.h:52
MyGUI::action::linearMoveFunction
void linearMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _k)
Definition MyGUI_ActionController.cpp:30
MyGUI::action::inertionalMoveFunction
void inertionalMoveFunction(const IntCoord &_startRect, const IntCoord &_destRect, IntCoord &_result, float _current_time)
Definition MyGUI_ActionController.cpp:39
MyGUI::action::actionWidgetHide
void actionWidgetHide(Widget *_widget, ControllerItem *_controller)
Definition MyGUI_ActionController.cpp:15
MyGUI::action::actionWidgetShow
void actionWidgetShow(Widget *_widget, ControllerItem *_controller)
Definition MyGUI_ActionController.cpp:20
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36