]> git.mxchange.org Git - flightgear.git/commitdiff
add <label-offset> param for adjusting number labels in scales
authormfranz <mfranz>
Thu, 12 Mar 2009 00:05:45 +0000 (00:05 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 18 Mar 2009 07:00:07 +0000 (08:00 +0100)
src/Instrumentation/HUD/HUD.hxx
src/Instrumentation/HUD/HUD_ladder.cxx
src/Instrumentation/HUD/HUD_tape.cxx

index 4801ef94748679b9d74853f53f49bb72348fdb4b..4f8f0523f71c27a6f1e17e63e804600e3cd9c2e0 100644 (file)
@@ -459,6 +459,7 @@ private:
     bool   _draw_cap_right;
     bool   _draw_cap_left;
     float  _marker_offset;
+    float  _label_offset;
     float  _label_gap;
     bool   _pointer;
     Format _label_fmt;
index 9181a82a9c2b3a38c7ca6379d94ab51857ef2024..9fe33149345f61e7018db2744f8c0dd0d0b7d713 100644 (file)
 
 
 // FIXME
-float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; }
-float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); }
-float get__Vx() { return fgGetFloat("/velocities/uBody-fps"); }
-float get__Vy() { return fgGetFloat("/velocities/vBody-fps"); }
-float get__Vz() { return fgGetFloat("/velocities/wBody-fps"); }
-float get__Ax() { return fgGetFloat("/accelerations/pilot/x-accel-fps_sec"); }
-float get__Ay() { return fgGetFloat("/accelerations/pilot/y-accel-fps_sec"); }
-float get__Az() { return fgGetFloat("/accelerations/pilot/z-accel-fps_sec"); }
-float get__alpha() { return fgGetFloat("/orientation/alpha-deg"); }
-float get__beta() { return fgGetFloat("/orientation/side-slip-deg"); }
+static float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; }
+static float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); }
+static float get__Vx() { return fgGetFloat("/velocities/uBody-fps"); }
+static float get__Vy() { return fgGetFloat("/velocities/vBody-fps"); }
+static float get__Vz() { return fgGetFloat("/velocities/wBody-fps"); }
+static float get__Ax() { return fgGetFloat("/accelerations/pilot/x-accel-fps_sec"); }
+static float get__Ay() { return fgGetFloat("/accelerations/pilot/y-accel-fps_sec"); }
+static float get__Az() { return fgGetFloat("/accelerations/pilot/z-accel-fps_sec"); }
+static float get__alpha() { return fgGetFloat("/orientation/alpha-deg"); }
+static float get__beta() { return fgGetFloat("/orientation/side-slip-deg"); }
 #undef ENABLE_SP_FDM
 
 
index 89c4ceae93423dd3baea2c4e6ed7b030e981edbd..5e73dfc1b23b410746ff0039f2589400c95e0cf3 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "HUD.hxx"
 
+static const float TICK_OFFSET = 2.f;
+
 
 HUD::Tape::Tape(HUD *hud, const SGPropertyNode *n, float x, float y) :
     Scale(hud, n, x, y),
@@ -33,6 +35,7 @@ HUD::Tape::Tape(HUD *hud, const SGPropertyNode *n, float x, float y) :
     _draw_cap_right(n->getBoolValue("cap-right", false)),
     _draw_cap_left(n->getBoolValue("cap-left", false)),
     _marker_offset(n->getFloatValue("marker-offset")),
+    _label_offset(n->getFloatValue("label-offset", 3.0)),
     _label_gap(n->getFloatValue("label-gap-width") / 2.0),
     _pointer(n->getBoolValue("enable-pointer", true)),
     _format(n->getStringValue("format", "%d"))
@@ -248,9 +251,9 @@ void HUD::Tape::draw_vertical(float value)
 
         float y = _y + (v - vmin) * factor();
 
-        if (y < _y + 0)
+        if (y < _y + TICK_OFFSET)
             continue;
-        if (y > top - 0)
+        if (y > top - TICK_OFFSET)
             break;
 
         if (_div_ratio && i % _div_ratio) { // minor div
@@ -317,9 +320,9 @@ void HUD::Tape::draw_vertical(float value)
                     draw_bullet(marker_xs + 4, y, 5.0);
 
                 if (option_left())
-                    x = marker_xs, align = RIGHT|VCENTER;
+                    x = marker_xs - _label_offset, align = RIGHT|VCENTER;
                 else
-                    x = marker_xe, align = LEFT|VCENTER;
+                    x = marker_xe + _label_offset, align = LEFT|VCENTER;
             }
 
             if (!option_notext()) {
@@ -456,9 +459,9 @@ void HUD::Tape::draw_horizontal(float value)
 
         float x = _x + (v - vmin) * factor();
 
-        if (x < _x + 0)
+        if (x < _x + TICK_OFFSET)
             continue;
-        if (x > right - 0)
+        if (x > right - TICK_OFFSET)
             break;
 
         if (_div_ratio && i % _div_ratio) { // minor div
@@ -502,9 +505,9 @@ void HUD::Tape::draw_horizontal(float value)
                 draw_line(x, marker_ys, x, marker_ye);
 
                 if (option_top())
-                    y = top, align = TOP|HCENTER;
+                    y = top - _label_offset, align = TOP|HCENTER;
                 else
-                    y = _y, align = BOTTOM|HCENTER;
+                    y = _y + _label_offset, align = BOTTOM|HCENTER;
             }
 
             if (!option_notext()) {