mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Merge pull request #798 from dottools/fix/mouseCoordSpace
Use screen space coordinates for mouse pointer position
This commit is contained in:
commit
5b9c080aef
2 changed files with 3 additions and 9 deletions
|
|
@ -549,8 +549,7 @@ void GuiCanvas::setCursorPos(const Point2I &pt)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Point2I screenPt( mPlatformWindow->clientToScreen( pt ) );
|
mPlatformWindow->setCursorPosition(pt.x, pt.y);
|
||||||
mPlatformWindow->setCursorPosition( screenPt.x, screenPt.y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,12 @@ S32 PlatformCursorControllerSDL::getDoubleClickHeight()
|
||||||
|
|
||||||
void PlatformCursorControllerSDL::setCursorPosition( S32 x, S32 y )
|
void PlatformCursorControllerSDL::setCursorPosition( S32 x, S32 y )
|
||||||
{
|
{
|
||||||
if( PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow() )
|
SDL_WarpMouseGlobal(x, y);
|
||||||
{
|
|
||||||
AssertFatal( dynamic_cast<PlatformWindowSDL*>( PlatformWindowManager::get()->getFirstWindow() ), "");
|
|
||||||
PlatformWindowSDL *window = static_cast<PlatformWindowSDL*>( PlatformWindowManager::get()->getFirstWindow() );
|
|
||||||
SDL_WarpMouseInWindow(window->getSDLWindow(), x, y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformCursorControllerSDL::getCursorPosition( Point2I &point )
|
void PlatformCursorControllerSDL::getCursorPosition( Point2I &point )
|
||||||
{
|
{
|
||||||
SDL_GetMouseState( &point.x, &point.y );
|
SDL_GetGlobalMouseState( &point.x, &point.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformCursorControllerSDL::setCursorVisible( bool visible )
|
void PlatformCursorControllerSDL::setCursorVisible( bool visible )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue