void field(const string &in endpoint, const string &in key, const string &in label, float y) {
float value = 0;
string text = label + ": --";
if (wt::read_number(endpoint, key, value)) text = label + ": " + value;
render::text(24, y, text);
}
void on_frame() {
render::text(24, 24, "War Thunder / own vehicle instruments", 0xff994dff);
if (!wt::enabled()) {
adapter::set_status("unavailable", "WT telemetry consent is off");
render::text(24, 64, "Enable WT telemetry in the client before Load script.");
return;
}
if (!wt::available()) {
adapter::set_status("waiting", "Waiting for valid own-vehicle telemetry");
render::text(24, 64, "Waiting for valid local telemetry / enter a test drive or flight.");
return;
}
if (!adapter::set_status("ready")) return;
field("state", "IAS, km/h", "IAS (km/h)", 64);
field("state", "TAS, km/h", "TAS (km/h)", 92);
field("state", "H, m", "Altitude (m)", 120);
field("state", "Mfuel, kg", "Fuel (kg)", 148);
field("indicators", "rpm", "RPM (raw)", 176);
field("indicators", "speed", "Speed (raw indicator)", 204);
field("indicators", "gear", "Gear", 232);
field("indicators", "crew_current", "Crew", 260);
render::text(24, 302, "Unavailable fields stay --. No enemy data or game memory access.");
}
Easy Universal / Примеры и шаблоны