]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Oops. A change to an upstream header seems to have remove glu.h, which
[flightgear.git] / src / Cockpit / panel.cxx
index 822c2ba26102f2795cf7a4a3bb24e544a6df6dd3..09194ef12de8cc31178e675b7a994227a78dd98b 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdio.h>     // sprintf
 #include <string.h>
 
+#include <GL/glu.h>
+
 #include <plib/ssg.h>
 #include <plib/fnt.h>
 
@@ -53,7 +55,6 @@
 // my hardware/driver requires many more.
 #define POFF_UNITS 4
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Local functions.
 ////////////////////////////////////////////////////////////////////////
@@ -1092,8 +1093,9 @@ FGTextLayer::Chunk::Chunk (const string &text, const string &fmt)
 }
 
 FGTextLayer::Chunk::Chunk (ChunkType type, const SGPropertyNode * node,
-                          const string &fmt, float mult)
-  : _type(type), _fmt(fmt), _mult(mult)
+                          const string &fmt, float mult, float offs,
+                           bool truncation)
+  : _type(type), _fmt(fmt), _mult(mult), _offs(offs), _trunc(truncation)
 {
   if (_fmt.empty()) {
     if (type == TEXT_VALUE)
@@ -1117,7 +1119,9 @@ FGTextLayer::Chunk::getValue () const
       sprintf(_buf, _fmt.c_str(), _node->getStringValue());
       break;
     case DOUBLE_VALUE:
-      sprintf(_buf, _fmt.c_str(), _node->getFloatValue() * _mult);
+      double d = _offs + _node->getFloatValue() * _mult;
+      if (_trunc)  d = (d < 0) ? -floor(-d) : floor(d);
+      sprintf(_buf, _fmt.c_str(), d);
       break;
     }
     return _buf;