| 94 | } |
| 95 | |
| 96 | Ogre::Vector2 MiniMapDrawn::camera_2dPositionFromClick(int xx, int yy) |
| 97 | { |
| 98 | Ogre::Real mm, nn, oo, pp; |
| 99 | // Compute move and normalise |
| 100 | mm = (xx - mTopLeftCornerX) / static_cast<double>(mWidth) - 0.5; |
| 101 | nn = (yy - mTopLeftCornerY) / static_cast<double>(mHeight) - 0.5; |
| 102 | // Applying rotation |
| 103 | oo = nn * mSinRotation + mm * mCosRotation; |
| 104 | pp = nn * mCosRotation - mm * mSinRotation; |
| 105 | // Apply result to camera |
| 106 | mCamera_2dPosition.x += static_cast<Ogre::Real>(oo * mWidth / mGrainSize); |
| 107 | mCamera_2dPosition.y -= static_cast<Ogre::Real>(pp * mHeight / mGrainSize); |
| 108 | |
| 109 | return mCamera_2dPosition; |
| 110 | } |
| 111 | |
| 112 | void MiniMapDrawn::update(Ogre::Real timeSinceLastFrame, const std::vector<Ogre::Vector3>& cornerTiles) |
| 113 | { |