carrot/selfdrive/ui/carrot.h

30 lines
1.2 KiB
C
Raw Normal View History

2024-09-03 16:09:00 +09:00
#pragma once
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/onroad/alerts.h"
#include "selfdrive/ui/qt/onroad/model.h"
typedef struct Rect1 {
int x, y, w, h;
int centerX() const { return x + w / 2; }
int centerY() const { return y + h / 2; }
int right() const { return x + w; }
int bottom() const { return y + h; }
bool ptInRect(int px, int py) const {
return px >= x && px < (x + w) && py >= y && py < (y + h);
}
} Rect1;
void ui_draw(UIState *s, ModelRenderer *model, int w, int h);
void ui_update_alert(const OnroadAlerts::Alert& a);
void ui_draw_alert(UIState* s);
void ui_draw_image(const UIState *s, const Rect1 &r, const char *name, float alpha);
void ui_draw_rect(NVGcontext *vg, const Rect1 &r, NVGcolor color, int width, float radius = 0);
void ui_fill_rect(NVGcontext *vg, const Rect1 &r, const NVGpaint &paint, float radius = 0, float stroke_width = 0, NVGcolor* stroke_color = nullptr);
void ui_fill_rect(NVGcontext *vg, const Rect1 &r, const NVGcolor &color, float radius = 0, float stroke_width = 0, NVGcolor* stroke_color = nullptr);
void ui_nvg_init(UIState *s);
void ui_resize(UIState *s, int width, int height);
void ui_update_params(UIState *s);