|
|
@ -325,23 +325,11 @@ static void ui_draw_vision_maxspeed(UIState *s) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_vision_speed(UIState *s) { |
|
|
|
static void ui_draw_vision_speed(UIState *s) { |
|
|
|
const Rect &viz_rect = s->scene.viz_rect; |
|
|
|
const float speed = s->scene.controls_state.getVEgo() * (s->is_metric ? 3.6 : 2.2369363); |
|
|
|
float v_ego = s->scene.controls_state.getVEgo(); |
|
|
|
const std::string speed_str = std::to_string((int)std::nearbyint(speed)); |
|
|
|
float speed = v_ego * 2.2369363 + 0.5; |
|
|
|
|
|
|
|
if (s->is_metric){ |
|
|
|
|
|
|
|
speed = v_ego * 3.6 + 0.5; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const int viz_speed_w = 280; |
|
|
|
|
|
|
|
const int viz_speed_x = viz_rect.centerX() - viz_speed_w/2; |
|
|
|
|
|
|
|
char speed_str[32]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nvgBeginPath(s->vg); |
|
|
|
|
|
|
|
nvgRect(s->vg, viz_speed_x, viz_rect.y, viz_speed_w, header_h); |
|
|
|
|
|
|
|
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); |
|
|
|
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); |
|
|
|
|
|
|
|
ui_draw_text(s->vg, s->scene.viz_rect.centerX(), 240, speed_str.c_str(), 96 * 2.5, COLOR_WHITE, s->font_sans_bold); |
|
|
|
snprintf(speed_str, sizeof(speed_str), "%d", (int)speed); |
|
|
|
ui_draw_text(s->vg, s->scene.viz_rect.centerX(), 320, s->is_metric ? "km/h" : "mph", 36 * 2.5, COLOR_WHITE_ALPHA(200), s->font_sans_regular); |
|
|
|
ui_draw_text(s->vg, viz_rect.centerX(), 240, speed_str, 96*2.5, COLOR_WHITE, s->font_sans_bold); |
|
|
|
|
|
|
|
ui_draw_text(s->vg, viz_rect.centerX(), 320, s->is_metric?"km/h":"mph", 36*2.5, COLOR_WHITE_ALPHA(200), s->font_sans_regular); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_vision_event(UIState *s) { |
|
|
|
static void ui_draw_vision_event(UIState *s) { |
|
|
|