well i was playing arround with use in OGRE
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 ));
will make system mouse available inside the render window but overlays a custom image
would make system cursor invisible but prevent the mouse to leave the render window or even make system cursor also invisible outside.
when i use
Code: Select all
device->getCursorControl()->setVisible(false);
it makes the system cursor invisble while over the render window so that it would be possible to use a custom image but does not prevent that the system cursor leaves the render window or make it also invisible outside it.
but i guess i found the answhere here for win32:
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;
}
which implements
showCursor from Windows.h
and for linux and mac:
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
}
which uses
XDefineCursor
and
XUndefineCursor
from
X11/Xlib.h
thx for the OIS link to your implementation