MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / handleEvent

Method handleEvent

Source/Input/TouchDispather.cpp:457–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void 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

Callers

nothing calls this directly

Calls 2

getVisualSizeMethod · 0.80
getWinSizeMethod · 0.80

Tested by

no test coverage detected