2 variables of CCursorControl are not updated on a window resize and thus are wrong :
Code: Select all
core::dimension2d<s32> WindowSize;
core::dimension2d<float> InvWindowSize;
Code: Select all
void CCursorControl::updateWindowProperties()
{
RECT rect;
if (GetWindowRect(HWnd, &rect))
{
WindowSize.Width = rect.right-rect.left;
WindowSize.Height = rect.bottom-rect.top;
if (WindowSize.Width!=0)
InvWindowSize.Width = 1.0f / WindowSize.Width;
else
InvWindowSize.Width = 0.0f;
if (WindowSize.Height!=0)
InvWindowSize.Height = 1.0f / WindowSize.Height;
else
InvWindowSize.Height = 0.0f;
}
}
Code: Select all
void CIrrDeviceWin32::resizeIfNecessary()
{
if (!Resized)
return;
RECT r;
GetClientRect(HWnd, &r);
char tmp[255];
if (r.right <= 1 || r.bottom <= 1)
{
sprintf(tmp, "Ignoring resize operation to (%d %d)", r.right, r.bottom);
os::Printer::log(tmp);
}
else
{
sprintf(tmp, "Resizing window (%d %d)", r.right, r.bottom);
os::Printer::log(tmp);
if ( r.right % 2 )
r.right += 1;
if ( r.bottom % 2 )
r.bottom += 1;
getVideoDriver()->OnResize(irr::core::dimension2d<irr::s32>(r.right, r.bottom));
// update cursor properties
Win32CursorControl->updateWindowProperties();
}
Resized = false;
}