Commit 34d47c1c authored by cutealien's avatar cutealien

Fix cursor problems found by buffer and by rvl2 as described in...

Fix cursor problems found by buffer and by rvl2 as described in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=34823&highlight=


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2669 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5f1f6b1b
Changes in 1.6 (??.??.2009)
- Fix cursor problems found by buffer and by rvl2 as described in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=34823&highlight=
- Change debug data to draw using lines instead of arrows, which is much faster. Patch by pc0de
......
......@@ -582,6 +582,7 @@ void CIrrDeviceWin32::resizeIfNecessary()
os::Printer::log(tmp);
getVideoDriver()->OnResize(irr::core::dimension2du((u32)r.right, (u32)r.bottom));
getWin32CursorControl()->OnResize(getVideoDriver()->getScreenSize());
}
Resized = false;
......
......@@ -16,6 +16,7 @@
#if !defined(_IRR_XBOX_PLATFORM_)
#include <windows.h>
#include <mmsystem.h> // For JOYCAPS
#include <Windowsx.h>
#endif
......@@ -243,6 +244,20 @@ namespace irr
else
UseReferenceRect = false;
}
/** Used to notify the cursor that the window was resized. */
virtual void OnResize(const core::dimension2d<u32>& size)
{
if (size.Width!=0)
InvWindowSize.Width = 1.0f / size.Width;
else
InvWindowSize.Width = 0.f;
if (size.Height!=0)
InvWindowSize.Height = 1.0f / size.Height;
else
InvWindowSize.Height = 0.f;
}
private:
......@@ -250,7 +265,12 @@ namespace irr
void updateInternalCursorPosition()
{
POINT p;
GetCursorPos(&p);
if (!GetCursorPos(&p))
{
DWORD xy = GetMessagePos();
p.x = GET_X_LPARAM(xy);
p.y = GET_Y_LPARAM(xy);
}
if (UseReferenceRect)
{
......
......@@ -617,6 +617,7 @@ void CIrrDeviceWinCE::resizeIfNecessary()
os::Printer::log(tmp);
getVideoDriver()->OnResize(irr::core::dimension2d<irr::u32>(r.right, r.bottom));
getWin32CursorControl()->OnResize(getVideoDriver()->getScreenSize());
}
Resized = false;
......
......@@ -202,13 +202,33 @@ namespace irr
UseReferenceRect = false;
}
/** Used to notify the cursor that the window was resized. */
virtual void OnResize(const core::dimension2d<u32>& size)
{
if (size.Width!=0)
InvWindowSize.Width = 1.0f / size.Width;
else
InvWindowSize.Width = 0.f;
if (size.Height!=0)
InvWindowSize.Height = 1.0f / size.Height;
else
InvWindowSize.Height = 0.f;
}
private:
//! Updates the internal cursor position
void updateInternalCursorPosition()
{
POINT p;
GetCursorPos(&p);
if (!GetCursorPos(&p))
{
DWORD xy = GetMessagePos();
p.x = GET_X_LPARAM(xy);
p.y = GET_Y_LPARAM(xy);
}
RECT rect;
if (UseReferenceRect)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment