mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-21 05:52:06 +08:00
UI: draw header gradient in OnroadHud (#23137)
This commit is contained in:
@@ -127,23 +127,12 @@ static void ui_draw_world(UIState *s) {
|
||||
nvgResetScissor(s->vg);
|
||||
}
|
||||
|
||||
static void ui_draw_vision_header(UIState *s) {
|
||||
NVGpaint gradient = nvgLinearGradient(s->vg, 0, header_h - (header_h / 2.5), 0, header_h,
|
||||
nvgRGBAf(0, 0, 0, 0.45), nvgRGBAf(0, 0, 0, 0));
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRect(s->vg, 0, 0, s->fb_w, header_h);
|
||||
nvgFillPaint(s->vg, gradient);
|
||||
nvgFill(s->vg);
|
||||
}
|
||||
|
||||
static void ui_draw_vision(UIState *s) {
|
||||
const UIScene *scene = &s->scene;
|
||||
// Draw augmented elements
|
||||
if (scene->world_objects_visible) {
|
||||
ui_draw_world(s);
|
||||
}
|
||||
// TODO: move this to Qt
|
||||
ui_draw_vision_header(s);
|
||||
}
|
||||
|
||||
void ui_draw(UIState *s, int w, int h) {
|
||||
|
||||
@@ -198,6 +198,12 @@ void OnroadHud::paintEvent(QPaintEvent *event) {
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// Header gradient
|
||||
QLinearGradient bg(0, header_h - (header_h / 2.5), 0, header_h);
|
||||
bg.setColorAt(0, QColor::fromRgbF(0, 0, 0, 0.45));
|
||||
bg.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0));
|
||||
p.fillRect(0, 0, width(), header_h, bg);
|
||||
|
||||
// max speed
|
||||
QRect rc(bdr_s * 2, bdr_s * 1.5, 184, 202);
|
||||
p.setPen(QPen(QColor(0xff, 0xff, 0xff, 100), 10));
|
||||
|
||||
Reference in New Issue
Block a user