add logo render for ga, bbq, and ufos
This commit is contained in:
+3
-23
@@ -46,27 +46,10 @@ private:
|
||||
Text track = {"", 40, 14, 0, WHITE};
|
||||
Text vertical_speed = {"", 40, 21, 0, WHITE};
|
||||
|
||||
const char *ga_logo_path = "";
|
||||
const char *ufo_logo_path = "";
|
||||
std::vector<uint8_t> ga_logo;
|
||||
std::vector<uint8_t> ufo_logo;
|
||||
const uint8_t *current_logo = nullptr;
|
||||
|
||||
TrackedAircraft *current_aircraft;
|
||||
|
||||
static std::vector<uint8_t> load_logo(const char *path) {
|
||||
std::vector<uint8_t> data;
|
||||
if (!path || !*path) {
|
||||
return data;
|
||||
}
|
||||
std::ifstream f(path, std::ios::binary);
|
||||
data.assign(std::istreambuf_iterator<char>(f), {});
|
||||
if (data.size() != LOGO_SIZE * LOGO_SIZE * 3) {
|
||||
data.clear();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static const uint8_t *find_logo(const std::string &code) {
|
||||
for (int i = 0; i < LOGO_COUNT; i++) {
|
||||
if (code == LOGOS[i].code) {
|
||||
@@ -142,9 +125,6 @@ public:
|
||||
{"VS", 27, 21, 0, WHITE},
|
||||
};
|
||||
|
||||
ga_logo = load_logo(ga_logo_path);
|
||||
ufo_logo = load_logo(ufo_logo_path);
|
||||
|
||||
current_aircraft = t;
|
||||
}
|
||||
|
||||
@@ -181,15 +161,15 @@ public:
|
||||
if (op == "N") {
|
||||
flight_operator.text = "GA";
|
||||
flight_number.text = num.substr(0, 4);
|
||||
current_logo = ga_logo.empty() ? nullptr : ga_logo.data();
|
||||
current_logo = find_logo("GA");
|
||||
|
||||
// if other flight number
|
||||
} else {
|
||||
flight_operator.text = op;
|
||||
flight_number.text = num.substr(0, 4);
|
||||
current_logo = find_logo(op);
|
||||
if (!current_logo && !ufo_logo.empty()) {
|
||||
current_logo = ufo_logo.data();
|
||||
if (!current_logo) {
|
||||
current_logo = find_logo("UFO");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user