Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 13 (modified by chaiy, 17 years ago) (diff)

HUD

See also: Ticket #233,#252

Author

Yuning Chai?

What's HUD

A full description of HUD can be found under WikiPedia.

HUD with Ogre

Ogre has its own class for HUD designing: CLASS OVERLAY.
There are two ways to write an overlay, neither it can be written in a script, or it can be dynamically created in C++ file. All possibilities and variabilities for an overlay script are found unter Ogre Tutorial. For Windows Users there is already an editor made by Patrick Kooman: Overlay Editor

Fall 2007

See Printscreen: Version 2.0

Spring 2008

Instead defining the whole HUD in a single script, and then linking every object of the script into a C++ file, it is now possible to directly creating the HUD in a single C++ file. In orxonox.cc, only one command is needed:

HUD hud = new HUD(int zoom);

the idea is to create a flexible HUD, which can become bigger or smaller easily.

A simple element of the HUD can be created as following:

Ogre:: OverlayManager& overlayManager = Ogre:: OverlayManager::getSingleton();
Ogre:: OverlayElement* element = overlayManager.createOverlayElement("Panel",name);

In the second step, it is to create few inherited classes to Ogre:: OverlayElement, so more complicated and often used elements can be easily implemented. There is a problem about inheritance: Ogre:: OverlayElement doesnt have a constructor for itself, and Ogre:: OverlayManager::getSingleton().createOverlayElement() only creates an OverlayElement, but not its inherited classes. I could not find out how to inherit Ogre:: OverlayElement, so I wrote classes, which have an OverlayElement as public variable and several functions to change this OverlayElement.

Class Bar:

class _OrxonoxExport Bar
{

.....
.....

public:
  Ogre:: OverlayElement* element;

  Bar(Ogre:: Real left, Ogre:: Real top, Ogre:: Real width, Ogre:: Real height,
      int dir, int colour, std::string name);
  ~Bar(void);
  void reset(int percentage);
  void setColour(int colour);
  void show();
  void hide();
};

Single elements cannot be directly put into HUD, they have to be added into a panel at first. The panel will be set into the whole overlay afterwards.

Bar* energyCounter;
Ogre::OverlayContainer* energyCounterPanel;

...

Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD"); 
orxonoxOverlay->add2D(energyCounterPanel);
orxonoxOverlay->show();

TODO

  • To find out how to write letters or numbers with C files.
  • To create more module classes.
  • To realize Radar System.

Proposals

  • use SVG for drwaing - saves space, and is resolution indendant; drawback need to be implemented in OGRE/framework
  • more suitable font.
  • improve radar: removed grid, add distance rings

Printscreens

Version 1.0

Version 2.0

Attachments (3)

Download all attachments as: .zip