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

Method moveCursor

source/render/RenderManager.cpp:1499–1523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1497}
1498
1499void RenderManager::moveCursor(float relX, float relY)
1500{
1501 Ogre::Camera* cam = mViewport->getCamera();
1502 if(cam->getFOVy() != mCurrentFOVy)
1503 {
1504 mCurrentFOVy = cam->getFOVy();
1505 Ogre::Radian angle = cam->getFOVy() * 0.5f;
1506 Ogre::Real tan = Ogre::Math::Tan(angle);
1507 Ogre::Real shortestSize = KEEPER_HAND_POS_Z * tan * 2.0f;
1508 Ogre::Real width = mViewport->getActualWidth();
1509 Ogre::Real height = mViewport->getActualHeight();
1510 if(width > height)
1511 {
1512 mFactorHeight = shortestSize;
1513 mFactorWidth = shortestSize * width / height;
1514 }
1515 else
1516 {
1517 mFactorWidth = shortestSize;
1518 mFactorHeight = shortestSize * height / width;
1519 }
1520 }
1521
1522 mHandKeeperNode->setPosition(mFactorWidth * (relX - 0.5f), mFactorHeight * (0.5f - relY), -KEEPER_HAND_POS_Z);
1523}
1524
1525void RenderManager::moveWorldCoords(Ogre::Real x, Ogre::Real y)
1526{

Callers 1

frameRenderingQueuedMethod · 0.80

Calls 2

getCameraMethod · 0.80
setPositionMethod · 0.45

Tested by

no test coverage detected