Make sure setVisible for Windows cursor also works while mousebutton is pressed.

As reported in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=25880&highlight=


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2400 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2009-05-24 20:09:02 +00:00
parent cc4ff80fa3
commit c4f0e9b558
2 changed files with 26 additions and 15 deletions

View File

@ -177,16 +177,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_ERASEBKGND:
return 0;
case WM_SETCURSOR:
{
SEnvMapper* envm = getEnvMapperFromHWnd(hWnd);
if (envm && !envm->irrDev->getWin32CursorControl()->isVisible())
{
SetCursor(NULL);
return 0;
}
} break;
case WM_KEYDOWN:
case WM_KEYUP:
{

View File

@ -106,13 +106,34 @@ namespace irr
//! Changes the visible state of the mouse cursor.
virtual void setVisible(bool visible)
{
if(visible != IsVisible)
CURSORINFO info;
info.cbSize = sizeof(CURSORINFO);
if ( visible )
{
IsVisible = visible;
updateInternalCursorPosition();
setPosition(CursorPos.X, CursorPos.Y);
while ( GetCursorInfo(&info) )
{
if ( info.flags == CURSOR_SHOWING )
{
IsVisible = visible;
break;
}
ShowCursor(true); // this only increases an internal display counter in windows, so it might have to be called some more
}
}
}
else
{
while ( GetCursorInfo(&info) )
{
if ( info.flags == 0 ) // cursor hidden
{
IsVisible = visible;
break;
}
ShowCursor(false); // this only decreases an internal display counter in windows, so it might have to be called some more
}
}
}
//! Returns if the cursor is currently visible.
virtual bool isVisible() const