MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / StartTrackingMouse

Method StartTrackingMouse

Source/Engine/Platform/SDL/SDLWindow.cpp:871–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869}
870
871void SDLWindow::StartTrackingMouse(bool useMouseScreenOffset)
872{
873 if (_isTrackingMouse)
874 return;
875
876 _isTrackingMouse = true;
877 _trackingMouseOffset = Float2::Zero;
878 _isUsingMouseOffset = useMouseScreenOffset;
879
880 if (_visible)
881 {
882 if (!SDL_CaptureMouse(true))
883 {
884 if (!SDLPlatform::UsesWayland()) // Suppress "That operation is not supported" errors
885 LOG(Warning, "SDL_CaptureMouse: {0}", String(SDL_GetError()));
886 }
887
888 // For viewport camera mouse tracking we want to use relative mode for best precision
889 if (_cursor == CursorType::Hidden)
890 Input::Mouse->SetRelativeMode(true, this);
891 }
892}
893
894void SDLWindow::EndTrackingMouse()
895{

Callers

nothing calls this directly

Calls 2

SetRelativeModeMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected