Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 12 and Version 13 of dev/projects/HUDbyChai


Ignore:
Timestamp:
Apr 2, 2008, 11:48:40 PM (17 years ago)
Author:
chaiy
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • dev/projects/HUDbyChai

    v12 v13  
    11= HUD =
    2 See also: Ticket #233
     2See also: Ticket #233,#252
    33
    44== Author ==
     
    1717For Windows Users there is already an editor made by Patrick Kooman: [http://www.ogre3d.org/wiki/index.php/Overlay_Editor Overlay Editor]
    1818
    19 == Already Done ==
     19== Fall 2007 ==
    2020
    2121See Printscreen: Version 2.0
    2222
     23== Spring 2008 ==
     24
     25Instead 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:
     26{{{
     27HUD hud = new HUD(int zoom);
     28}}}
     29the idea is to create a flexible HUD, which can become bigger or smaller easily.
     30
     31A simple element of the HUD can be created as following:
     32{{{
     33Ogre:: OverlayManager& overlayManager = Ogre:: OverlayManager::getSingleton();
     34Ogre:: OverlayElement* element = overlayManager.createOverlayElement("Panel",name);
     35}}}
     36
     37In 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.
     38
     39Class Bar:
     40{{{
     41class _OrxonoxExport Bar
     42{
     43
     44.....
     45.....
     46
     47public:
     48  Ogre:: OverlayElement* element;
     49
     50  Bar(Ogre:: Real left, Ogre:: Real top, Ogre:: Real width, Ogre:: Real height,
     51      int dir, int colour, std::string name);
     52  ~Bar(void);
     53  void reset(int percentage);
     54  void setColour(int colour);
     55  void show();
     56  void hide();
     57};
     58}}}
     59
     60Single 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.
     61{{{
     62Bar* energyCounter;
     63Ogre::OverlayContainer* energyCounterPanel;
     64
     65...
     66
     67Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD");
     68orxonoxOverlay->add2D(energyCounterPanel);
     69orxonoxOverlay->show();
     70}}}
     71
     72
     73
    2374== TODO ==
    2475
    25  * To make HUD cuter, easier to use.
     76 * To find out how to write letters or numbers with C files.
     77 * To create more module classes.
    2678 * To realize Radar System.
    2779
     
    3688=== Version 1.0 ===
    3789
    38 [[Image(HUD1.0.png)]] 
     90[[Image(HUD1.0.png,250)]] 
    3991
    4092=== Version 2.0 ===
    4193
    42 [[Image(HUD2.0.png)]]
     94[[Image(HUD2.0.png, 250)]]
    4395