Fix max range, range cursor, and stc range control readouts
This commit is contained in:
@@ -80,6 +80,14 @@ static void text_line(const std::string& text, float x, float& y,
|
||||
y -= LH * scale;
|
||||
}
|
||||
|
||||
/* Render a body-text line with word wrapping; y advances by one line per
|
||||
* wrapped output line. max_width is the available horizontal pixel span. */
|
||||
static void text_line_wrapped(const std::string& text, float x, float& y,
|
||||
float scale, float max_width,
|
||||
float cr, float cg, float cb) {
|
||||
g_text_renderer.render_text_wrapped(text, x, y, scale, max_width, LH, cr, cg, cb);
|
||||
}
|
||||
|
||||
/* Render one title-size line using the large renderer at scale 1.0. */
|
||||
static void text_line_large(const std::string& text, float x, float& y,
|
||||
float cr, float cg, float cb) {
|
||||
@@ -151,12 +159,12 @@ static void render_scope_name(const std::string& radar_name) {
|
||||
static void render_common_status(float x, float& y, float scale) {
|
||||
char buf[320];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Intensity: %.2f | Sensitivity: %.2f | STC Sens: %.2f | STC Range: %.2f",
|
||||
"Intensity: %.2f | Sensitivity: %.2f | STC Sens: %.2f | STC Range: %.1f nm",
|
||||
uniform_intensity, uniform_sensitivity,
|
||||
uniform_stc_sensitivity, uniform_stc_range);
|
||||
g_text_renderer.render_text(buf, x, y, scale,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
y -= LH * scale;
|
||||
uniform_stc_sensitivity, uniform_stc_range * uniform_max_range);
|
||||
float max_w = static_cast<float>(LEFT_PANEL_WIDTH) - 2.0f * MARGIN;
|
||||
text_line_wrapped(buf, x, y, scale, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
@@ -221,16 +229,18 @@ void ChainHomeRadar::render_scope() {
|
||||
void ChainHomeRadar::render_status_bar() {
|
||||
float x = MARGIN;
|
||||
float y = static_cast<float>(STATUS_BAR_HEIGHT) - MARGIN - LH;
|
||||
float max_w = static_cast<float>(LEFT_PANEL_WIDTH) - 2.0f * MARGIN;
|
||||
|
||||
text_line("CHAIN HOME RADAR (Ventnor, Isle of Wight) | Fixed range: 200 km",
|
||||
x, y, SCALE_NORMAL, COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped("CHAIN HOME RADAR (Ventnor, Isle of Wight) | Fixed range: 200 nm",
|
||||
x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
|
||||
render_common_status(x, y, SCALE_NORMAL);
|
||||
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf), "Radiogoniometer: %.1f deg", uniform_radiogoniometer);
|
||||
g_text_renderer.render_text(buf, x, y, SCALE_NORMAL,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped(buf, x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
@@ -291,18 +301,20 @@ void MarineAScopeRadar::render_scope() {
|
||||
void MarineAScopeRadar::render_status_bar() {
|
||||
float x = MARGIN;
|
||||
float y = static_cast<float>(STATUS_BAR_HEIGHT) - MARGIN - LH;
|
||||
float max_w = static_cast<float>(LEFT_PANEL_WIDTH) - 2.0f * MARGIN;
|
||||
|
||||
text_line("MARINE A-SCOPE RADAR (Community Boating Center, Bellingham Bay)",
|
||||
x, y, SCALE_NORMAL, COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped("MARINE A-SCOPE RADAR (Community Boating Center, Bellingham Bay)",
|
||||
x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
|
||||
render_common_status(x, y, SCALE_NORMAL);
|
||||
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Max Range (normalized): %.2f | Antenna Bearing: %.1f deg",
|
||||
"Max Range: %.1f nm | Antenna Bearing: %.1f deg",
|
||||
uniform_max_range, uniform_marine_a_bearing);
|
||||
g_text_renderer.render_text(buf, x, y, SCALE_NORMAL,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped(buf, x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
@@ -365,20 +377,22 @@ void MarineTrafficRadar::render_scope() {
|
||||
void MarineTrafficRadar::render_status_bar() {
|
||||
float x = MARGIN;
|
||||
float y = static_cast<float>(STATUS_BAR_HEIGHT) - MARGIN - LH;
|
||||
float max_w = static_cast<float>(LEFT_PANEL_WIDTH) - 2.0f * MARGIN;
|
||||
|
||||
text_line("MARINE TRAFFIC CONTROL RADAR (Bellingham Bay)",
|
||||
x, y, SCALE_NORMAL, COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped("MARINE TRAFFIC CONTROL RADAR (Bellingham Bay)",
|
||||
x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
|
||||
render_common_status(x, y, SCALE_NORMAL);
|
||||
|
||||
char buf[280];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Noise Filter: %.2f | Max Range (norm): %.2f | "
|
||||
"Range Cursor: %.2f | Bearing Cursor: %.1f deg",
|
||||
"Noise Filter: %.2f | Max Range: %.1f nm | "
|
||||
"Range Cursor: %.2f nm | Bearing Cursor: %.1f deg",
|
||||
uniform_noise_filter, uniform_max_range,
|
||||
uniform_range_cursor, uniform_bearing_cursor);
|
||||
g_text_renderer.render_text(buf, x, y, SCALE_NORMAL,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
uniform_range_cursor * uniform_max_range, uniform_bearing_cursor);
|
||||
text_line_wrapped(buf, x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
@@ -443,18 +457,20 @@ void PoliceboatRadar::render_scope() {
|
||||
void PoliceboatRadar::render_status_bar() {
|
||||
float x = MARGIN;
|
||||
float y = static_cast<float>(STATUS_BAR_HEIGHT) - MARGIN - LH;
|
||||
float max_w = static_cast<float>(LEFT_PANEL_WIDTH) - 2.0f * MARGIN;
|
||||
|
||||
text_line("POLICE BOAT RADAR (Bellingham Bay - moving)",
|
||||
x, y, SCALE_NORMAL, COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
text_line_wrapped("POLICE BOAT RADAR (Bellingham Bay - moving)",
|
||||
x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
|
||||
render_common_status(x, y, SCALE_NORMAL);
|
||||
|
||||
char buf[280];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Noise Filter: %.2f | Max Range (norm): %.2f | "
|
||||
"Range Cursor: %.2f | Bearing Cursor: %.1f deg",
|
||||
"Noise Filter: %.2f | Max Range: %.1f nm | "
|
||||
"Range Cursor: %.2f nm | Bearing Cursor: %.1f deg",
|
||||
uniform_noise_filter, uniform_max_range,
|
||||
uniform_range_cursor, uniform_bearing_cursor);
|
||||
g_text_renderer.render_text(buf, x, y, SCALE_NORMAL,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
uniform_range_cursor * uniform_max_range, uniform_bearing_cursor);
|
||||
text_line_wrapped(buf, x, y, SCALE_NORMAL, max_w,
|
||||
COL_YELLOW[0], COL_YELLOW[1], COL_YELLOW[2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user