From b6695cd3fad581a988f941d27f16d851154e2be6 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 29 Oct 2011 21:58:11 +0200 Subject: [PATCH] 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. --- src/Main/FGEventHandler.cxx | 2 +- src/Main/FGEventHandler.hxx | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Main/FGEventHandler.cxx b/src/Main/FGEventHandler.cxx index 65777a623..562d80791 100644 --- a/src/Main/FGEventHandler.cxx +++ b/src/Main/FGEventHandler.cxx @@ -39,7 +39,7 @@ FGEventHandler::FGEventHandler() : keyHandler(0), mouseClickHandler(0), mouseMotionHandler(0), - statsHandler(new osgViewer::StatsHandler), + statsHandler(new FGStatsHandler), statsEvent(new osgGA::GUIEventAdapter), statsType(osgViewer::StatsHandler::NO_STATS), currentModifiers(0), diff --git a/src/Main/FGEventHandler.hxx b/src/Main/FGEventHandler.hxx index 4be0caf21..3abea015e 100644 --- a/src/Main/FGEventHandler.hxx +++ b/src/Main/FGEventHandler.hxx @@ -5,11 +5,26 @@ #include #include #include +#include #include "fg_os.hxx" 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 { public: FGEventHandler(); @@ -86,7 +101,7 @@ protected: fgKeyHandler keyHandler; fgMouseClickHandler mouseClickHandler; fgMouseMotionHandler mouseMotionHandler; - osg::ref_ptr statsHandler; + osg::ref_ptr statsHandler; osg::ref_ptr statsEvent; int statsType; int currentModifiers;