Files
StarPilot/openpilot/tools/cabana/ui/helpoverlay.h
T
Trey Moen 2b4d050e9c cabana: fix video startup and desktop interactions (#38798)
* cabana: fix video startup and desktop interactions

* cabana: remove util comments
2026-09-07 12:43:41 -07:00

30 lines
775 B
C++

#pragma once
#include <string>
#include <utility>
#include <vector>
#include "imgui_internal.h"
// Dims the window and shows each widget's whatsThis text at its center; any click closes it.
// The texts are rich text: <b>, <br />, <span style="color:..;background-color:..">, &entities; and #rrggbb
// tokens (the video legend) are rendered, everything else is ignored.
class HelpOverlay {
public:
void toggle();
bool visible() const { return visible_; }
// collected while the widgets draw, consumed by draw()
void add(const std::string &text, const ImRect &rect);
void draw();
private:
struct Entry {
std::string text;
ImRect rect;
ImGuiViewport *viewport;
};
std::vector<Entry> texts_;
bool visible_ = false;
int opened_frame_ = -1;
};