Code: Select all
device->getCursorControl()->setVisible(false);
DISCL_EXCLUSIVE
to set the mouse invisble but in OIS the mouse than is also invisible when the mouse is outside the window or even not leaving it.
how is this solved in IRRLICHT?
Code: Select all
device->getCursorControl()->setVisible(false);
Code: Select all
std::ostringstream windowHndStr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
//!---------- CUSTOM CODE FOR DISPLAY CURSOR -------- START --------!//
/**********************************************************************
This Code uses the System own Mouse-Cursor, so it will be able to move
outside the Render-Window but can not display a Custom Image source from:
http://www.ogre3d.org/tikiwiki/How+to+show+the+mouse+cursor+without+CEGUI&structure=Cookbook#Second_way:_System_cursor_OIS_cursor_
**********************************************************************/
#if defined OIS_WIN32_PLATFORM
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
#elif defined OIS_LINUX_PLATFORM
pl.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
#endif
//!---------- CUSTOM CODE FOR DISPLAY CURSOR -------- END --------!//
mInputManager = OIS::InputManager::createInputSystem( pl );
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
Code: Select all
DISCL_EXCLUSIVE
Code: Select all
device->getCursorControl()->setVisible(false);
Code: Select all
//! Changes the visible state of the mouse cursor.
virtual void setVisible(bool visible)
{
CURSORINFO info;
info.cbSize = sizeof(CURSORINFO);
BOOL gotCursorInfo = GetCursorInfo(&info);
while ( gotCursorInfo )
{
if ( (visible && info.flags == CURSOR_SHOWING) // visible
|| (!visible && info.flags == 0 ) ) // hidden
{
break;
}
int showResult = ShowCursor(visible); // this only increases an internal display counter in windows, so it might have to be called some more
if ( showResult < 0 )
{
break;
}
info.cbSize = sizeof(CURSORINFO); // yes, it really must be set each time
gotCursorInfo = GetCursorInfo(&info);
}
IsVisible = visible;
}
Code: Select all
//! Changes the visible state of the mouse cursor.
virtual void setVisible(bool visible)
{
if (visible==IsVisible)
return;
IsVisible = visible;
#ifdef _IRR_COMPILE_WITH_X11_
if (!Null)
{
if ( !IsVisible )
XDefineCursor( Device->display, Device->window, invisCursor );
else
XUndefineCursor( Device->display, Device->window );
}
#endif
}