1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-12 03:36:32 +00:00
OpenMW/apps/openmw/mwgui/controllers.cpp

70 lines
1.6 KiB
C++
Raw Normal View History

#include "controllers.hpp"
#include <MyGUI_InputManager.h>
2015-01-10 01:50:43 +00:00
#include <MyGUI_Widget.h>
namespace MWGui
{
namespace Controllers
{
2014-09-13 06:00:24 +00:00
ControllerRepeatEvent::ControllerRepeatEvent() :
mInit(0.5f),
mStep(0.1f),
mEnabled(true),
mTimeLeft(0)
{
}
2014-09-13 06:00:24 +00:00
ControllerRepeatEvent::~ControllerRepeatEvent()
{
}
2014-09-13 06:00:24 +00:00
bool ControllerRepeatEvent::addTime(MyGUI::Widget* _widget, float _time)
{
if(mTimeLeft == 0)
mTimeLeft = mInit;
mTimeLeft -= _time;
while (mTimeLeft <= 0)
{
mTimeLeft += mStep;
eventRepeatClick(_widget, this);
}
return true;
}
2014-09-13 06:00:24 +00:00
void ControllerRepeatEvent::setRepeat(float init, float step)
{
mInit = init;
mStep = step;
}
2014-09-13 06:00:24 +00:00
void ControllerRepeatEvent::setEnabled(bool enable)
{
mEnabled = enable;
}
2014-09-13 06:00:24 +00:00
void ControllerRepeatEvent::setProperty(const std::string& _key, const std::string& _value)
{
}
2014-09-13 06:00:24 +00:00
void ControllerRepeatEvent::prepareItem(MyGUI::Widget* _widget)
{
}
// -------------------------------------------------------------
void ControllerFollowMouse::prepareItem(MyGUI::Widget *_widget)
{
}
bool ControllerFollowMouse::addTime(MyGUI::Widget *_widget, float _time)
{
_widget->setPosition(MyGUI::InputManager::getInstance().getMousePosition());
return true;
}
}
}