fixed fonts
This commit is contained in:
@@ -66,13 +66,13 @@ static const float COL_GREEN_LO[3] = { 0.00f, 0.55f, 0.18f };
|
||||
/* Layout helpers */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static const float SCALE_TITLE = 1.25f;
|
||||
static const float SCALE_NORMAL = 1.00f;
|
||||
static const float SCALE_SMALL = 0.85f;
|
||||
static const float MARGIN = static_cast<float>(TEXT_MARGIN);
|
||||
static const float LH = LINE_HEIGHT; /* line height at scale 1.0 */
|
||||
static const float LH = LINE_HEIGHT;
|
||||
static const float LH_LARGE = LINE_HEIGHT_LARGE;
|
||||
|
||||
/* Render one line of text and advance y downward by one line. */
|
||||
/* Render one body-text line and advance y downward. */
|
||||
static void text_line(const std::string& text, float x, float& y,
|
||||
float scale,
|
||||
float cr, float cg, float cb) {
|
||||
@@ -80,6 +80,13 @@ static void text_line(const std::string& text, float x, float& y,
|
||||
y -= LH * scale;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
g_text_renderer_large.render_text(text, x, y, 1.0f, cr, cg, cb);
|
||||
y -= LH_LARGE;
|
||||
}
|
||||
|
||||
/* Render a blank spacer line. */
|
||||
static void blank_line(float& y, float scale) {
|
||||
y -= LH * scale * 0.6f;
|
||||
@@ -123,16 +130,16 @@ static void render_scope_name(const std::string& radar_name) {
|
||||
const float scope_w = static_cast<float>(SCOPE_WIDTH);
|
||||
const float scope_h = static_cast<float>(SCOPE_HEIGHT);
|
||||
|
||||
float name_w = g_text_renderer.get_text_width(radar_name, 2.0f);
|
||||
float name_w = g_text_renderer_large.get_text_width(radar_name, 1.0f);
|
||||
float nx = (scope_w - name_w) / 2.0f;
|
||||
float ny = scope_h / 2.0f + 20.0f;
|
||||
g_text_renderer.render_text(radar_name, nx, ny, 2.0f,
|
||||
COL_GREEN_DIM[0], COL_GREEN_DIM[1], COL_GREEN_DIM[2]);
|
||||
g_text_renderer_large.render_text(radar_name, nx, ny, 1.0f,
|
||||
COL_GREEN_DIM[0], COL_GREEN_DIM[1], COL_GREEN_DIM[2]);
|
||||
|
||||
std::string sub = "[ stub - initialization test only ]";
|
||||
float sub_w = g_text_renderer.get_text_width(sub, SCALE_NORMAL);
|
||||
float sx = (scope_w - sub_w) / 2.0f;
|
||||
float sy = ny - LH * 2.0f;
|
||||
float sy = ny - LH_LARGE;
|
||||
g_text_renderer.render_text(sub, sx, sy, SCALE_NORMAL,
|
||||
COL_GREEN_LO[0], COL_GREEN_LO[1], COL_GREEN_LO[2]);
|
||||
}
|
||||
@@ -157,11 +164,11 @@ static void render_common_status(float x, float& y, float scale) {
|
||||
/* ================================================================== */
|
||||
|
||||
void ChainHomeRadar::render_left_panel() {
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH * SCALE_TITLE;
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH_LARGE;
|
||||
float x = MARGIN;
|
||||
|
||||
text_line("CHAIN HOME RADAR", x, y, SCALE_TITLE,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
text_line_large("CHAIN HOME RADAR", x, y,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
blank_line(y, SCALE_NORMAL);
|
||||
|
||||
text_line("Location: Ventnor, Isle of Wight", x, y, SCALE_SMALL,
|
||||
@@ -231,11 +238,11 @@ void ChainHomeRadar::render_status_bar() {
|
||||
/* ================================================================== */
|
||||
|
||||
void MarineAScopeRadar::render_left_panel() {
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH * SCALE_TITLE;
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH_LARGE;
|
||||
float x = MARGIN;
|
||||
|
||||
text_line("MARINE A-SCOPE RADAR", x, y, SCALE_TITLE,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
text_line_large("MARINE A-SCOPE RADAR", x, y,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
blank_line(y, SCALE_NORMAL);
|
||||
|
||||
text_line("Location: Community Boating Center,", x, y, SCALE_SMALL,
|
||||
@@ -303,11 +310,11 @@ void MarineAScopeRadar::render_status_bar() {
|
||||
/* ================================================================== */
|
||||
|
||||
void MarineTrafficRadar::render_left_panel() {
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH * SCALE_TITLE;
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH_LARGE;
|
||||
float x = MARGIN;
|
||||
|
||||
text_line("MARINE TRAFFIC CONTROL RADAR", x, y, SCALE_TITLE,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
text_line_large("MARINE TRAFFIC CONTROL RADAR", x, y,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
blank_line(y, SCALE_NORMAL);
|
||||
|
||||
text_line("Location: Center of Bellingham Bay,", x, y, SCALE_SMALL,
|
||||
@@ -379,11 +386,11 @@ void MarineTrafficRadar::render_status_bar() {
|
||||
/* ================================================================== */
|
||||
|
||||
void PoliceboatRadar::render_left_panel() {
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH * SCALE_TITLE;
|
||||
float y = static_cast<float>(WINDOW_HEIGHT) - MARGIN - LH_LARGE;
|
||||
float x = MARGIN;
|
||||
|
||||
text_line("POLICE BOAT RADAR", x, y, SCALE_TITLE,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
text_line_large("POLICE BOAT RADAR", x, y,
|
||||
COL_WHITE[0], COL_WHITE[1], COL_WHITE[2]);
|
||||
blank_line(y, SCALE_NORMAL);
|
||||
|
||||
text_line("Starting location: Taylor Dock /", x, y, SCALE_SMALL,
|
||||
|
||||
Reference in New Issue
Block a user