From 0e722245596826a108cefd26f666e4e91308eacc Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 12 Mar 2009 00:05:45 +0000 Subject: [PATCH] add param for adjusting number labels in scales --- src/Instrumentation/HUD/HUD.hxx | 1 + src/Instrumentation/HUD/HUD_ladder.cxx | 20 ++++++++++---------- src/Instrumentation/HUD/HUD_tape.cxx | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/Instrumentation/HUD/HUD.hxx b/src/Instrumentation/HUD/HUD.hxx index 4801ef947..4f8f0523f 100644 --- a/src/Instrumentation/HUD/HUD.hxx +++ b/src/Instrumentation/HUD/HUD.hxx @@ -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; diff --git a/src/Instrumentation/HUD/HUD_ladder.cxx b/src/Instrumentation/HUD/HUD_ladder.cxx index 9181a82a9..9fe331493 100644 --- a/src/Instrumentation/HUD/HUD_ladder.cxx +++ b/src/Instrumentation/HUD/HUD_ladder.cxx @@ -30,16 +30,16 @@ // 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 diff --git a/src/Instrumentation/HUD/HUD_tape.cxx b/src/Instrumentation/HUD/HUD_tape.cxx index 89c4ceae9..5e73dfc1b 100644 --- a/src/Instrumentation/HUD/HUD_tape.cxx +++ b/src/Instrumentation/HUD/HUD_tape.cxx @@ -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()) { -- 2.39.5