|
|
@ -96,16 +96,17 @@ static void draw_chevron(UIState *s, float x_in, float y_in, float sz, |
|
|
|
nvgFill(s->vg); |
|
|
|
nvgFill(s->vg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_circle_image(NVGcontext *vg, float x, float y, int size, int image, NVGcolor color, float img_alpha, int img_y = 0) { |
|
|
|
static void ui_draw_circle_image(NVGcontext *vg, int x, int y, int size, int image, NVGcolor color, float img_alpha, int img_y = 0) { |
|
|
|
const int img_size = size * 1.5; |
|
|
|
const int img_size = size * 1.5; |
|
|
|
nvgBeginPath(vg); |
|
|
|
nvgBeginPath(vg); |
|
|
|
nvgCircle(vg, x, y + (bdr_s * 1.5), size); |
|
|
|
nvgCircle(vg, x, y + (bdr_s * 1.5), size); |
|
|
|
nvgFillColor(vg, color); |
|
|
|
nvgFillColor(vg, color); |
|
|
|
nvgFill(vg); |
|
|
|
nvgFill(vg); |
|
|
|
ui_draw_image(vg, x - (img_size / 2), img_y ? img_y : y - (size / 4), img_size, img_size, image, img_alpha); |
|
|
|
const Rect rect = {x - (img_size / 2), img_y ? img_y : y - (size / 4), img_size, img_size}; |
|
|
|
|
|
|
|
ui_draw_image(vg, rect, image, img_alpha); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_circle_image(NVGcontext *vg, float x, float y, int size, int image, bool active) { |
|
|
|
static void ui_draw_circle_image(NVGcontext *vg, int x, int y, int size, int image, bool active) { |
|
|
|
float bg_alpha = active ? 0.3f : 0.1f; |
|
|
|
float bg_alpha = active ? 0.3f : 0.1f; |
|
|
|
float img_alpha = active ? 1.0f : 0.15f; |
|
|
|
float img_alpha = active ? 1.0f : 0.15f; |
|
|
|
ui_draw_circle_image(vg, x, y, size, image, nvgRGBA(0, 0, 0, (255 * bg_alpha)), img_alpha); |
|
|
|
ui_draw_circle_image(vg, x, y, size, image, nvgRGBA(0, 0, 0, (255 * bg_alpha)), img_alpha); |
|
|
@ -322,7 +323,8 @@ static void ui_draw_vision_event(UIState *s) { |
|
|
|
if (s->scene.controls_state.getDecelForModel() && s->scene.controls_state.getEnabled()) { |
|
|
|
if (s->scene.controls_state.getDecelForModel() && s->scene.controls_state.getEnabled()) { |
|
|
|
// draw winding road sign
|
|
|
|
// draw winding road sign
|
|
|
|
const int img_turn_size = 160*1.5; |
|
|
|
const int img_turn_size = 160*1.5; |
|
|
|
ui_draw_image(s->vg, viz_event_x - (img_turn_size / 4), viz_event_y + bdr_s - 25, img_turn_size, img_turn_size, s->img_turn, 1.0f); |
|
|
|
const Rect rect = {viz_event_x - (img_turn_size / 4), viz_event_y + bdr_s - 25, img_turn_size, img_turn_size}; |
|
|
|
|
|
|
|
ui_draw_image(s->vg, rect, s->img_turn, 1.0f); |
|
|
|
} else if (s->scene.controls_state.getEngageable()) { |
|
|
|
} else if (s->scene.controls_state.getEngageable()) { |
|
|
|
// draw steering wheel
|
|
|
|
// draw steering wheel
|
|
|
|
const int bg_wheel_size = 96; |
|
|
|
const int bg_wheel_size = 96; |
|
|
@ -526,10 +528,10 @@ void ui_draw(UIState *s) { |
|
|
|
glDisable(GL_BLEND); |
|
|
|
glDisable(GL_BLEND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ui_draw_image(NVGcontext *vg, float x, float y, float w, float h, int image, float alpha){ |
|
|
|
void ui_draw_image(NVGcontext *vg, const Rect &r, int image, float alpha){ |
|
|
|
nvgBeginPath(vg); |
|
|
|
nvgBeginPath(vg); |
|
|
|
NVGpaint imgPaint = nvgImagePattern(vg, x, y, w, h, 0, image, alpha); |
|
|
|
NVGpaint imgPaint = nvgImagePattern(vg, r.x, r.y, r.w, r.h, 0, image, alpha); |
|
|
|
nvgRect(vg, x, y, w, h); |
|
|
|
nvgRect(vg, r.x, r.y, r.w, r.h); |
|
|
|
nvgFillPaint(vg, imgPaint); |
|
|
|
nvgFillPaint(vg, imgPaint); |
|
|
|
nvgFill(vg); |
|
|
|
nvgFill(vg); |
|
|
|
} |
|
|
|
} |
|
|
|