Some fixes for mouse cursor.
This commit is contained in:
parent
ba39e88680
commit
da802d836d
@ -84,7 +84,8 @@ public:
|
||||
{
|
||||
CIrrDeviceWayland *device = static_cast<CIrrDeviceWayland *>(data);
|
||||
|
||||
device->getCursorControl()->setPosition(sx, sy);
|
||||
device->getCursorControl()->setPosition(wl_fixed_to_int(sx),
|
||||
wl_fixed_to_int(sy));
|
||||
|
||||
SEvent irrevent;
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
@ -908,49 +909,11 @@ CIrrDeviceWayland::CCursorControl::~CCursorControl()
|
||||
// TODO (cutealien): droping cursorcontrol earlier might work, not sure about reason why that's done in stub currently.
|
||||
}
|
||||
|
||||
//! Sets the new position of the cursor.
|
||||
void CIrrDeviceWayland::CCursorControl::setPosition(s32 x, s32 y)
|
||||
{
|
||||
CursorPos = core::position2di(x / 256, y / 256);
|
||||
}
|
||||
|
||||
//! Returns the current position of the mouse cursor.
|
||||
const core::position2d<s32>& CIrrDeviceWayland::CCursorControl::getPosition()
|
||||
{
|
||||
return CursorPos;
|
||||
}
|
||||
|
||||
core::position2d<f32> CIrrDeviceWayland::CCursorControl::getRelativePosition()
|
||||
{}
|
||||
|
||||
//! Sets the active cursor icon
|
||||
void CIrrDeviceWayland::CCursorControl::setActiveIcon(gui::ECURSOR_ICON iconId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CIrrDeviceWayland::signalEvent(const SEvent &event)
|
||||
{
|
||||
events.push_back(event);
|
||||
}
|
||||
|
||||
//! Add a custom sprite as cursor icon.
|
||||
gui::ECURSOR_ICON CIrrDeviceWayland::CCursorControl::addIcon(const gui::SCursorSprite& icon)
|
||||
{
|
||||
return gui::ECI_NORMAL;
|
||||
}
|
||||
|
||||
//! replace the given cursor icon.
|
||||
void CIrrDeviceWayland::CCursorControl::changeIcon(gui::ECURSOR_ICON iconId, const gui::SCursorSprite& icon)
|
||||
{
|
||||
}
|
||||
|
||||
irr::core::dimension2di CIrrDeviceWayland::CCursorControl::getSupportedIconSize() const
|
||||
{
|
||||
// this returns the closest match that is smaller or same size, so we just pass a value which should be large enough for cursors
|
||||
unsigned int width=0, height=0;
|
||||
return core::dimension2di(width, height);
|
||||
}
|
||||
|
||||
//! sets the caption of the window
|
||||
void CIrrDeviceWayland::setWindowCaption(const wchar_t* text)
|
||||
|
@ -169,11 +169,30 @@ namespace irr
|
||||
}
|
||||
|
||||
//! Sets the new position of the cursor.
|
||||
virtual void setPosition(s32 x, s32 y);
|
||||
virtual void setPosition(s32 x, s32 y)
|
||||
{
|
||||
//TODO
|
||||
CursorPos.X = x;
|
||||
CursorPos.Y = y;
|
||||
}
|
||||
|
||||
//! Returns the current position of the mouse cursor.
|
||||
virtual const core::position2d<s32>& getPosition();
|
||||
virtual core::position2d<f32> getRelativePosition();
|
||||
virtual const core::position2d<s32>& getPosition()
|
||||
{
|
||||
return CursorPos;
|
||||
}
|
||||
|
||||
virtual core::position2d<f32> getRelativePosition()
|
||||
{
|
||||
if (!UseReferenceRect)
|
||||
{
|
||||
return core::position2d<f32>(CursorPos.X / (f32)Device->Width,
|
||||
CursorPos.Y / (f32)Device->Height);
|
||||
}
|
||||
|
||||
return core::position2d<f32>(CursorPos.X / (f32)ReferenceRect.getWidth(),
|
||||
CursorPos.Y / (f32)ReferenceRect.getHeight());
|
||||
}
|
||||
|
||||
virtual void setReferenceRect(core::rect<s32>* rect=0)
|
||||
{
|
||||
@ -195,7 +214,7 @@ namespace irr
|
||||
}
|
||||
|
||||
//! Sets the active cursor icon
|
||||
virtual void setActiveIcon(gui::ECURSOR_ICON iconId);
|
||||
virtual void setActiveIcon(gui::ECURSOR_ICON iconId) {};
|
||||
|
||||
//! Gets the currently active icon
|
||||
virtual gui::ECURSOR_ICON getActiveIcon() const
|
||||
@ -204,13 +223,19 @@ namespace irr
|
||||
}
|
||||
|
||||
//! Add a custom sprite as cursor icon.
|
||||
virtual gui::ECURSOR_ICON addIcon(const gui::SCursorSprite& icon);
|
||||
virtual gui::ECURSOR_ICON addIcon(const gui::SCursorSprite& icon)
|
||||
{
|
||||
return gui::ECI_NORMAL;
|
||||
}
|
||||
|
||||
//! replace the given cursor icon.
|
||||
virtual void changeIcon(gui::ECURSOR_ICON iconId, const gui::SCursorSprite& icon);
|
||||
virtual void changeIcon(gui::ECURSOR_ICON iconId, const gui::SCursorSprite& icon) {}
|
||||
|
||||
//! Return a system-specific size which is supported for cursors. Larger icons will fail, smaller icons might work.
|
||||
virtual core::dimension2di getSupportedIconSize() const;
|
||||
virtual core::dimension2di getSupportedIconSize() const
|
||||
{
|
||||
return core::dimension2di(0, 0);
|
||||
}
|
||||
private:
|
||||
|
||||
CIrrDeviceWayland* Device;
|
||||
|
Loading…
x
Reference in New Issue
Block a user