The codes are ugly at several point of view, cause Bar is not an inherited class from Ogre::OverlayElement, but it has a public variable as OverlayElement and several functions to modify it.
Code: Select all
Bar* newBar;
newBar = new Bar(0,0,100,10,Bar::LEFT, Bar::RED,"hallo");
newBar->reset(50);
.........
.........
panel->addChild(newBar->element);
reset() can only change the length of the bar (I dont think that other things would be changed during the game)
With "addChild()" the new element can be added to a panel.
Class SmartBar actually does the same thing, but it changed colour depends on bar's length, it means, green if the bar is full, yellow semifull, and red nearly empty.
Now, some advices and suggestions are welcome, and new ideas about new modules are welcome as well.
I will commit all when the holidays are over