Mini-map in MyGUI

Celebrien

20-09-2008 15:31:55

Hi all,

I'm in a need of creating a mini-map for my game. I found this interesting article on the web about creating a mini-map using CEGUI in Ogre (http://www.gamedboy.com/modules.php?name=Content&pa=showpage&pid=10), but I am not sure how to "translate" it into MyGUI. I guess MyGUI allows for the creation of mini-maps... or not?

Could someone help me out here? Thanks a lot!

Altren

20-09-2008 16:13:08

You should use RenderBox widget for it. Code is almost same, but you don't need to create texture manually and last (GUI related) part is only one line :)
MyGUI::RenderBoxPtr minimap = MyGUI::Gui::getInstance().createWidget<MyGUI::RenderBox>("RenderBox", IntCoord(50, 50, 300, 300), Align::Default, "Main");

Ogre::Radian fieldOfView = _camera->getFOVy();
float height = _sceneLength/2 / Ogre::Math::Sin(fieldOfView / 2);

Vector3 cameraPosition = Vector3(_sceneLength/2,_sceneWidth/2, height);
Vector3 lookAt = Vector3(_sceneLength/2,_sceneWidth/2, 0);

//create a minimap camera, use the same settings as main camera
_= _sceneManager->createCamera("minimapCamera");
_mmCamera->setNearClipDistance(_camera->getNearClipDistance());
_mmCamera->setFarClipDistance(_camera->getFarClipDistance());
//AspectRatio(1) is for a square minimap
_mmCamera->setAspectRatio(1);
_mmCamera->setPosition(cameraPosition);
_mmCamera->lookAt(lookAt);

minimap->setRenderTarget(_mmCamera);

Celebrien

20-09-2008 16:16:48

Cool! Thanks a lot, I'll check it out :)

Celebrien

20-09-2008 22:48:42

It doesn't seem to work if I put it that way. The map keeps reproducing itself recursively...