1
0
Fork 0

Configure font in osg StatsHandler for OSG3.

OSG3 relies on "fonts/arial.ttf" being available. FG doesn't provide it -
so it's not necessarily available everywhere (not here). Use one of our
txf fonts instead.
This commit is contained in:
ThorstenB 2011-10-29 21:58:11 +02:00
parent 355a17a562
commit b6695cd3fa
2 changed files with 17 additions and 2 deletions

View file

@ -39,7 +39,7 @@ FGEventHandler::FGEventHandler() :
keyHandler(0), keyHandler(0),
mouseClickHandler(0), mouseClickHandler(0),
mouseMotionHandler(0), mouseMotionHandler(0),
statsHandler(new osgViewer::StatsHandler), statsHandler(new FGStatsHandler),
statsEvent(new osgGA::GUIEventAdapter), statsEvent(new osgGA::GUIEventAdapter),
statsType(osgViewer::StatsHandler::NO_STATS), statsType(osgViewer::StatsHandler::NO_STATS),
currentModifiers(0), currentModifiers(0),

View file

@ -5,11 +5,26 @@
#include <osg/Quat> #include <osg/Quat>
#include <osgGA/GUIEventHandler> #include <osgGA/GUIEventHandler>
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
#include <simgear/structure/OSGVersion.hxx>
#include "fg_os.hxx" #include "fg_os.hxx"
namespace flightgear namespace flightgear
{ {
class FGStatsHandler : public osgViewer::StatsHandler
{
public:
FGStatsHandler()
{
#if (SG_OSG_VERSION >= 30000)
// Adjust font type/size for >=OSG3.
// OSG defaults aren't working/available for FG.
_font = "Fonts/helvetica_medium.txf";
_characterSize = 12.0f;
#endif
}
};
class FGEventHandler : public osgGA::GUIEventHandler { class FGEventHandler : public osgGA::GUIEventHandler {
public: public:
FGEventHandler(); FGEventHandler();
@ -86,7 +101,7 @@ protected:
fgKeyHandler keyHandler; fgKeyHandler keyHandler;
fgMouseClickHandler mouseClickHandler; fgMouseClickHandler mouseClickHandler;
fgMouseMotionHandler mouseMotionHandler; fgMouseMotionHandler mouseMotionHandler;
osg::ref_ptr<osgViewer::StatsHandler> statsHandler; osg::ref_ptr<FGStatsHandler> statsHandler;
osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent; osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent;
int statsType; int statsType;
int currentModifiers; int currentModifiers;