| 289 | } |
| 290 | |
| 291 | void Input::SetGrabMouse(bool grab) { |
| 292 | if (grab_mouse_ == grab) return; |
| 293 | if (grab && in_focus_) { |
| 294 | grab_mouse_ = true; |
| 295 | Graphics::Instance()->SetWindowGrab(true); |
| 296 | cursor->SetVisible(false); |
| 297 | if (use_raw_input) { |
| 298 | // If we further wish to do this "correctly" we can use this hint: https://wiki.libsdl.org/SDL_HINT_MOUSE_RELATIVE_MODE_WARP |
| 299 | SDL_SetRelativeMouseMode(SDL_TRUE); |
| 300 | } else { |
| 301 | SDL_SetRelativeMouseMode(SDL_FALSE); |
| 302 | } |
| 303 | } else { |
| 304 | grab_mouse_ = false; |
| 305 | Graphics::Instance()->SetWindowGrab(false); |
| 306 | cursor->SetVisible(true); |
| 307 | SDL_SetRelativeMouseMode(SDL_FALSE); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | void Input::HandleEvent(const SDL_Event& event) { |
| 312 | PROFILER_ZONE(g_profiler_ctx, "Input::HandleEvent"); |
no test coverage detected