| 455 | } |
| 456 | |
| 457 | void UITouchHandler::handleEvent(const SDL_Event& event) { |
| 458 | switch (event.type) { |
| 459 | case SDL_MOUSEWHEEL: { |
| 460 | _mouseWheel = Vec2{s_cast<float>(event.wheel.x), s_cast<float>(event.wheel.y)}; |
| 461 | break; |
| 462 | } |
| 463 | case SDL_MOUSEBUTTONDOWN: { |
| 464 | if (event.button.button == SDL_BUTTON_LEFT) _leftButtonPressed = true; |
| 465 | if (event.button.button == SDL_BUTTON_RIGHT) _rightButtonPressed = true; |
| 466 | if (event.button.button == SDL_BUTTON_MIDDLE) _middleButtonPressed = true; |
| 467 | break; |
| 468 | } |
| 469 | case SDL_MOUSEBUTTONUP: { |
| 470 | if (event.button.button == SDL_BUTTON_LEFT) _leftButtonPressed = false; |
| 471 | if (event.button.button == SDL_BUTTON_RIGHT) _rightButtonPressed = false; |
| 472 | if (event.button.button == SDL_BUTTON_MIDDLE) _middleButtonPressed = false; |
| 473 | break; |
| 474 | } |
| 475 | case SDL_MOUSEMOTION: { |
| 476 | Size visualSize = SharedApplication.getVisualSize(); |
| 477 | Size winSize = SharedApplication.getWinSize(); |
| 478 | _mousePos = { |
| 479 | s_cast<float>(event.motion.x) * visualSize.width / winSize.width, |
| 480 | s_cast<float>(event.motion.y) * visualSize.height / winSize.height}; |
| 481 | break; |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | /* TouchDispatcher */ |
| 487 |
nothing calls this directly
no test coverage detected