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) 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 - Change debug data to draw using lines instead of arrows, which is much faster. Patch by pc0de
- Fix a bug with FPS camera animator causing stutters. Patch by FuzzYspo0N - Fix a bug with FPS camera animator causing stutters. Patch by FuzzYspo0N
......
...@@ -582,6 +582,7 @@ void CIrrDeviceWin32::resizeIfNecessary() ...@@ -582,6 +582,7 @@ void CIrrDeviceWin32::resizeIfNecessary()
os::Printer::log(tmp); os::Printer::log(tmp);
getVideoDriver()->OnResize(irr::core::dimension2du((u32)r.right, (u32)r.bottom)); getVideoDriver()->OnResize(irr::core::dimension2du((u32)r.right, (u32)r.bottom));
getWin32CursorControl()->OnResize(getVideoDriver()->getScreenSize());
} }
Resized = false; Resized = false;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#if !defined(_IRR_XBOX_PLATFORM_) #if !defined(_IRR_XBOX_PLATFORM_)
#include <windows.h> #include <windows.h>
#include <mmsystem.h> // For JOYCAPS #include <mmsystem.h> // For JOYCAPS
#include <Windowsx.h>
#endif #endif
...@@ -244,13 +245,32 @@ namespace irr ...@@ -244,13 +245,32 @@ namespace irr
UseReferenceRect = false; 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: private:
//! Updates the internal cursor position //! Updates the internal cursor position
void updateInternalCursorPosition() void updateInternalCursorPosition()
{ {
POINT p; POINT p;
GetCursorPos(&p); if (!GetCursorPos(&p))
{
DWORD xy = GetMessagePos();
p.x = GET_X_LPARAM(xy);
p.y = GET_Y_LPARAM(xy);
}
if (UseReferenceRect) if (UseReferenceRect)
{ {
......
...@@ -617,6 +617,7 @@ void CIrrDeviceWinCE::resizeIfNecessary() ...@@ -617,6 +617,7 @@ void CIrrDeviceWinCE::resizeIfNecessary()
os::Printer::log(tmp); os::Printer::log(tmp);
getVideoDriver()->OnResize(irr::core::dimension2d<irr::u32>(r.right, r.bottom)); getVideoDriver()->OnResize(irr::core::dimension2d<irr::u32>(r.right, r.bottom));
getWin32CursorControl()->OnResize(getVideoDriver()->getScreenSize());
} }
Resized = false; Resized = false;
......
...@@ -202,13 +202,33 @@ namespace irr ...@@ -202,13 +202,33 @@ namespace irr
UseReferenceRect = false; 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: private:
//! Updates the internal cursor position //! Updates the internal cursor position
void updateInternalCursorPosition() void updateInternalCursorPosition()
{ {
POINT p; POINT p;
GetCursorPos(&p); if (!GetCursorPos(&p))
{
DWORD xy = GetMessagePos();
p.x = GET_X_LPARAM(xy);
p.y = GET_Y_LPARAM(xy);
}
RECT rect; RECT rect;
if (UseReferenceRect) 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