MCPcopy Create free account
hub / github.com/DavidColson/Polybox / GetMousePosition

Function GetMousePosition

source/input.cpp:744–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742// ***********************************************************************
743
744Vec2i GetMousePosition() {
745 // TODO: This becomes wrong at the edge of the screen, must apply screen warning to it as well
746 Vec2i mousePosition;
747 SDL_GetMouseState(&mousePosition.x, &mousePosition.y);
748 f32 xAdjusted = (f32)mousePosition.x / pInputState->windowResolution.x * pInputState->targetResolution.x;
749 f32 yAdjusted = pInputState->targetResolution.y - ((f32)mousePosition.y / pInputState->windowResolution.y * pInputState->targetResolution.y);
750 return Vec2i((int)xAdjusted, (int)yAdjusted);
751}
752
753// ***********************************************************************
754

Callers 1

LuaGetMousePositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected