| 45 | #include <CEGUI/WindowManager.h> |
| 46 | |
| 47 | MiniMapDrawn::MiniMapDrawn(CEGUI::Window* miniMapWindow) : |
| 48 | mMiniMapWindow(miniMapWindow), |
| 49 | mTopLeftCornerX(0), |
| 50 | mTopLeftCornerY(0), |
| 51 | mGrainSize(4), |
| 52 | mWidth(static_cast<unsigned int>(mMiniMapWindow->getPixelSize().d_width) |
| 53 | + mGrainSize - (static_cast<unsigned int>(mMiniMapWindow->getPixelSize().d_width) % mGrainSize)), |
| 54 | mHeight(static_cast<unsigned int>(mMiniMapWindow->getPixelSize().d_height) |
| 55 | + mGrainSize - (static_cast<unsigned int>(mMiniMapWindow->getPixelSize().d_height) % mGrainSize)), |
| 56 | mTiles(mWidth * mHeight, Color(0,0,0)), |
| 57 | mPixelBox(mWidth, mHeight, 1, Ogre::PF_R8G8B8), |
| 58 | mMiniMapOgreTexture(Ogre::TextureManager::getSingletonPtr()->createManual( |
| 59 | "miniMapOgreTexture", |
| 60 | Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, |
| 61 | Ogre::TEX_TYPE_2D, |
| 62 | mWidth, mHeight, 0, Ogre::PF_R8G8B8, |
| 63 | Ogre::TU_DYNAMIC_WRITE_ONLY)), |
| 64 | mPixelBuffer(mMiniMapOgreTexture->getBuffer()), |
| 65 | mGameMap(*ODFrameListener::getSingleton().getClientGameMap()), |
| 66 | mCameraManager(*ODFrameListener::getSingleton().getCameraManager()) |
| 67 | { |
| 68 | CEGUI::Texture& miniMapTextureGui = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingletonPtr() |
| 69 | ->getRenderer())->createTexture("miniMapTextureGui", mMiniMapOgreTexture); |
| 70 | |
| 71 | CEGUI::BasicImage& imageset = dynamic_cast<CEGUI::BasicImage&>(CEGUI::ImageManager::getSingletonPtr()->create("BasicImage", "MiniMapImageset")); |
| 72 | imageset.setArea(CEGUI::Rectf(CEGUI::Vector2f(0.0, 0.0), |
| 73 | CEGUI::Size<float>( |
| 74 | static_cast<float>(mWidth), static_cast<float>(mHeight) |
| 75 | ) |
| 76 | )); |
| 77 | |
| 78 | // Link the image to the minimap |
| 79 | imageset.setTexture(&miniMapTextureGui); |
| 80 | mMiniMapWindow->setProperty("Image", CEGUI::PropertyHelper<CEGUI::Image*>::toString(&imageset)); |
| 81 | |
| 82 | mMiniMapOgreTexture->load(); |
| 83 | |
| 84 | mTopLeftCornerX = mMiniMapWindow->getUnclippedOuterRect().get().getPosition().d_x; |
| 85 | mTopLeftCornerY = mMiniMapWindow->getUnclippedOuterRect().get().getPosition().d_y; |
| 86 | } |
| 87 | |
| 88 | MiniMapDrawn::~MiniMapDrawn() |
| 89 | { |
nothing calls this directly
no test coverage detected