#include <Hud.h>
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. |
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.
Integrate with osgWidget
Definition at line 42 of file Hud.h.
Creates a HUD with appropriate update callback and root nodes.
Definition at line 45 of file Hud.h.
References create2DProjection(), pProjection, pRoot2D, and setHudStatset().
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] |
osg::Vec3 Hud::fromCornerLT | ( | float | x, | |
float | y | |||
) | const [inline] |
osg::Vec3 Hud::fromCornerRB | ( | float | x, | |
float | y | |||
) | const [inline] |
osg::Vec3 Hud::fromCornerRT | ( | float | x, | |
float | y | |||
) | const [inline] |
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] |
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] |
float Hud::relativeFromLeft | ( | float | percent | ) | const [inline] |
float Hud::relativeFromRight | ( | float | percent | ) | const [inline] |
float Hud::relativeFromTop | ( | float | percent | ) | const [inline] |
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] |
UINT Hud::bottom [private] |
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] |
UINT Hud::right [private] |
Coordinate for 2D projection.
Definition at line 120 of file Hud.h.
Referenced by fromTop(), and heightRelative().