Window Mode Mouse Boundaries
-
[ds] Swift
- Posts: 20
- Joined: Sun Nov 14, 2004 1:57 am
- Location: Rochester, New York, USA
Window Mode Mouse Boundaries
while not fullscreen is there a way that i can keep the mouse pointer from leaving the window? I want to be able to move my mouse all the way up to any edge of the window and the have it stop.
There's a crack in everything -- That's how the light gets in.
Code: Select all
int maxX = m_gameCore->GetVideoDriver ( )->getViewPort ( ).LowerRightCorner.X;
int maxY = m_gameCore->GetVideoDriver ( )->getViewPort ( ).LowerRightCorner.Y;
if ( m_mouseLocation.X < 0 || m_mouseLocation.Y < 0 || m_mouseLocation.X > maxX || m_mouseLocation.Y > maxY )
{
if ( m_mouseLocation.X < 0 )
m_mouseLocation.X = 0;
else if ( m_mouseLocation.X > maxX )
m_mouseLocation.X = maxX;
if ( m_mouseLocation.Y < 0 )
m_mouseLocation.Y = 0;
else if ( m_mouseLocation.Y > maxY )
m_mouseLocation.Y = maxY;
m_gameCore->GetDevice ( )->getCursorControl ( )->setPosition ( m_mouseLocation.X, m_mouseLocation.Y );
}
-
[ds] Swift
- Posts: 20
- Joined: Sun Nov 14, 2004 1:57 am
- Location: Rochester, New York, USA
Thanks
thanks spintz, that worked perfectly!!!
There's a crack in everything -- That's how the light gets in.