1
0

Add ICursorControl::getReferenceRect

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6455 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2023-03-14 22:05:45 +00:00
parent f989112dcb
commit a23af985e4
7 changed files with 76 additions and 0 deletions

View File

@@ -275,6 +275,30 @@ namespace irr
UseReferenceRect = false;
}
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
{
if ( UseReferenceRect )
{
rect = ReferenceRect;
}
else
{
RECT wndRect;
if (GetWindowRect(HWnd, &wndRect))
{
rect.UpperLeftCorner.X = wndRect.left+BorderX;
rect.UpperLeftCorner.Y = wndRect.top+BorderY;
}
else // error case - not sure if it matters what we set here as coordinates returned will be -1, -1
{
rect.UpperLeftCorner = core::vector2di(0,0);
}
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + (irr::s32)WindowSize.Width;
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + (irr::s32)WindowSize.Height;
}
return UseReferenceRect;
}
/** Used to notify the cursor that the window was resized. */
void OnResize(const core::dimension2d<u32>& size)
{