]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Merge branch 'ehofman/atc-sound' into next
[flightgear.git] / src / Cockpit / panel.cxx
index b529b037201bb928ede8666151619368f77f5634..be2f12570e8fb3d336e9e79d0c68ccee5b2a0155 100644 (file)
 #  include <config.h>
 #endif
 
+#include "panel.hxx"
+
 #include <stdio.h>     // sprintf
 #include <string.h>
+#include <iostream>
 
 #include <osg/CullFace>
 #include <osg/Depth>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/scene/model/model.hxx>
+#include <osg/GLU>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/viewmgr.hxx>
 #include <Time/light.hxx>
 #include <GUI/new_gui.hxx>     // FGFontCache
+#include <Main/viewer.hxx>
+#include <Instrumentation/dclgps.hxx>
 
 #include "hud.hxx"
-#include "panel.hxx"
+
 
 #define WIN_X 0
 #define WIN_Y 0
@@ -912,7 +918,7 @@ FGSpecialInstrument::~FGSpecialInstrument ()
 void
 FGSpecialInstrument::draw (osg::State& state)
 {
-  complex->draw();
+  complex->draw(state);
 }
 
 
@@ -1103,14 +1109,19 @@ FGTextLayer::draw (osg::State& state)
     transform();
 
     FGFontCache *fc = globals->get_fontcache();
-    text_renderer.setFont(fc->getTexFont(_font_name.c_str()));
+    fntFont* font = fc->getTexFont(_font_name.c_str());
+    if (!font) {
+        return; // don't crash on missing fonts
+    }
+    
+    text_renderer.setFont(font);
 
     text_renderer.setPointSize(_pointSize);
     text_renderer.begin();
     text_renderer.start3f(0, 0, 0);
 
     _now.stamp();
-    long diff = _now - _then;
+    double diff = (_now - _then).toUSecs();
 
     if (diff > 100000 || diff < 0 ) {
       // ( diff < 0 ) is a sanity check and indicates our time stamp
@@ -1164,6 +1175,11 @@ void
 FGTextLayer::setFontName(const string &name)
 {
   _font_name = name + ".txf";
+  FGFontCache *fc = globals->get_fontcache();
+  fntFont* font = fc->getTexFont(_font_name.c_str());
+  if (!font) {
+      SG_LOG(SG_GENERAL, SG_WARN, "unable to find font:" << name);
+  }
 }