MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / camera_2dPositionFromClick

Method camera_2dPositionFromClick

source/gamemap/MiniMapDrawnFull.cpp:453–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453Ogre::Vector2 MiniMapDrawnFull::camera_2dPositionFromClick(int xx, int yy)
454{
455 Ogre::Vector2 v(0, 0);
456 Ogre::Real gainX = static_cast<Ogre::Real>(mGameMap.getMapSizeX())
457 / static_cast<Ogre::Real>(mWidth);
458 Ogre::Real gainY = static_cast<Ogre::Real>(mGameMap.getMapSizeY())
459 / static_cast<Ogre::Real>(mHeight);
460
461 v.x = round(static_cast<Ogre::Real>(xx - mTopLeftCornerX) * gainX);
462 v.y = round(static_cast<Ogre::Real>(mHeight - yy + mTopLeftCornerY) * gainY);
463
464 return v;
465}
466
467void MiniMapDrawnFull::updateTileState(uint32_t minimapXMin, uint32_t minimapXMax,
468 uint32_t minimapYMin, uint32_t minimapYMax, uint32_t tileXMin,

Callers

nothing calls this directly

Calls 3

roundFunction · 0.85
getMapSizeXMethod · 0.80
getMapSizeYMethod · 0.80

Tested by

no test coverage detected