Hud Class Reference

A HUD is a special node that displays 2D/3D information, and that already have an update callback. More...

#include <Hud.h>

List of all members.

Classes

class  HudCB
 Relay callback. More...

Public Member Functions

 Hud (UINT left, UINT right, UINT bottom, UINT top)
 Creates a HUD with appropriate update callback and root nodes.
virtual void onProjectionChanged (UINT left, UINT right, UINT bottom, UINT top)
 Callback method for projection change.
virtual void updateCB (osg::Node *node, osg::NodeVisitor *nv)=0
 Update callback (same prototype as osg::NodeCallback). This method is acutally not derived from osg::NodeCallback::operator(), but it is directly called by the update callback of the node.
Placement utility methods
float fromLeft (float x) const
float fromRight (float x) const
float fromBottom (float y) const
float fromTop (float y) const
osg::Vec3 fromCornerLT (float x, float y) const
osg::Vec3 fromCornerLB (float x, float y) const
osg::Vec3 fromCornerRT (float x, float y) const
osg::Vec3 fromCornerRB (float x, float y) const
float relativeFromLeft (float percent) const
float relativeFromRight (float percent) const
float relativeFromBottom (float percent) const
float relativeFromTop (float percent) const
float widthRelative (float percent) const
float heightRelative (float percent) const

Protected Member Functions

void set2DProjection (UINT left, UINT right, UINT bottom, UINT top)
 Changes projection parameters.

Protected Attributes

osg::Projection * pProjection
 Node on top of pRoot2D (2D projection).
osg::MatrixTransform * pRoot2D
 Node under which 2D elements of the HUD are added.

Private Attributes

UINT left
UINT right
UINT bottom
UINT top
 Coordinate for 2D projection.


Detailed Description

A HUD is a special node that displays 2D/3D information, and that already have an update callback.

It is an abstract class. Derivate it by creating appropriate elements in contructor, and by giving an update callback (operator()). The origin is on the lower-left corner, with X+ right and Y+ up. If not, osgText::Text objects won't be displayed correctly.

Todo:
A HUD that can display 3D objects rendered at a 2D position and size.

Integrate with osgWidget

Version:
0.2.0
Author:
Sukender

Definition at line 42 of file Hud.h.


Constructor & Destructor Documentation

Hud::Hud ( UINT  left,
UINT  right,
UINT  bottom,
UINT  top 
) [inline]

Creates a HUD with appropriate update callback and root nodes.

Definition at line 45 of file Hud.h.

References create2DProjection(), pProjection, pRoot2D, and setHudStatset().


Member Function Documentation

float Hud::fromBottom ( float  y  )  const [inline]

Definition at line 80 of file Hud.h.

References bottom.

Referenced by fromCornerLB(), fromCornerRB(), and relativeFromBottom().

osg::Vec3 Hud::fromCornerLB ( float  x,
float  y 
) const [inline]

Definition at line 84 of file Hud.h.

References fromBottom(), and fromLeft().

osg::Vec3 Hud::fromCornerLT ( float  x,
float  y 
) const [inline]

Definition at line 83 of file Hud.h.

References fromLeft(), and fromTop().

osg::Vec3 Hud::fromCornerRB ( float  x,
float  y 
) const [inline]

Definition at line 86 of file Hud.h.

References fromBottom(), and fromRight().

osg::Vec3 Hud::fromCornerRT ( float  x,
float  y 
) const [inline]

Definition at line 85 of file Hud.h.

References fromRight(), and fromTop().

float Hud::fromLeft ( float  x  )  const [inline]

Definition at line 78 of file Hud.h.

References left.

Referenced by fromCornerLB(), fromCornerLT(), and relativeFromLeft().

float Hud::fromRight ( float  x  )  const [inline]

Definition at line 79 of file Hud.h.

References right.

Referenced by fromCornerRB(), fromCornerRT(), and relativeFromRight().

float Hud::fromTop ( float  y  )  const [inline]

Definition at line 81 of file Hud.h.

References top.

Referenced by fromCornerLT(), fromCornerRT(), and relativeFromTop().

float Hud::heightRelative ( float  percent  )  const [inline]

Definition at line 94 of file Hud.h.

References bottom, and top.

Referenced by relativeFromBottom(), and relativeFromTop().

virtual void Hud::onProjectionChanged ( UINT  left,
UINT  right,
UINT  bottom,
UINT  top 
) [inline, virtual]

Callback method for projection change.

Generally called by the app, when the user resized the window. This should handle resizing of HUD components.

Definition at line 68 of file Hud.h.

References set2DProjection().

float Hud::relativeFromBottom ( float  percent  )  const [inline]

Definition at line 90 of file Hud.h.

References fromBottom(), and heightRelative().

float Hud::relativeFromLeft ( float  percent  )  const [inline]

Definition at line 88 of file Hud.h.

References fromLeft(), and widthRelative().

float Hud::relativeFromRight ( float  percent  )  const [inline]

Definition at line 89 of file Hud.h.

References fromRight(), and widthRelative().

float Hud::relativeFromTop ( float  percent  )  const [inline]

Definition at line 91 of file Hud.h.

References fromTop(), and heightRelative().

void Hud::set2DProjection ( UINT  left,
UINT  right,
UINT  bottom,
UINT  top 
) [inline, protected]

Changes projection parameters.

Definition at line 114 of file Hud.h.

References pProjection.

Referenced by onProjectionChanged().

virtual void Hud::updateCB ( osg::Node *  node,
osg::NodeVisitor *  nv 
) [pure virtual]

Update callback (same prototype as osg::NodeCallback). This method is acutally not derived from osg::NodeCallback::operator(), but it is directly called by the update callback of the node.

Referenced by Hud::HudCB::operator()().

float Hud::widthRelative ( float  percent  )  const [inline]

Definition at line 93 of file Hud.h.

References left, and right.

Referenced by relativeFromLeft(), and relativeFromRight().


Member Data Documentation

UINT Hud::bottom [private]

Definition at line 120 of file Hud.h.

Referenced by fromBottom(), and heightRelative().

UINT Hud::left [private]

Definition at line 120 of file Hud.h.

Referenced by fromLeft(), and widthRelative().

osg::Projection* Hud::pProjection [protected]

Node on top of pRoot2D (2D projection).

Definition at line 99 of file Hud.h.

Referenced by Hud(), and set2DProjection().

osg::MatrixTransform* Hud::pRoot2D [protected]

Node under which 2D elements of the HUD are added.

Definition at line 100 of file Hud.h.

Referenced by Hud().

UINT Hud::right [private]

Definition at line 120 of file Hud.h.

Referenced by fromRight(), and widthRelative().

UINT Hud::top [private]

Coordinate for 2D projection.

Definition at line 120 of file Hud.h.

Referenced by fromTop(), and heightRelative().


The documentation for this class was generated from the following file:

Generated on Sun Jan 17 11:39:28 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9