Skip to content
Snippets Groups Projects
Commit 7ffc4d00 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Improve stats icons and add capabilities

parent 705528c1
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28351 passed
......@@ -66,6 +66,15 @@ void Camera::update(double delta) {
jcam["Focal"] = cam.fx;
jcam["Principle"] = std::to_string(int(cam.cx)) + std::string(",") + std::to_string(int(cam.cy));
}
if (frame.has(Channel::Capabilities)) {
const auto &caps = frame.get<std::unordered_set<ftl::rgbd::Capability>>(Channel::Capabilities);
auto &jmeta = mod->getJSON(StatisticsPanel::MEDIA_META);
if (caps.count(Capability::TOUCH)) jmeta["Touch"] = nlohmann::json{{"icon", ENTYPO_ICON_MOUSE_POINTER},{"value", true}};
if (caps.count(Capability::MOVABLE)) jmeta["Movable"] = nlohmann::json{{"icon", ENTYPO_ICON_COMPASS},{"value", true}};
if (caps.count(Capability::VR)) jmeta["VR"] = nlohmann::json{{"value", true}};
}
}
}
}
......
......@@ -84,19 +84,24 @@ void StatisticsWidget::draw(NVGcontext *ctx) {
nvgFontSize(ctx, fsize);
nvgTextAlign(ctx, NVG_ALIGN_RIGHT);
float tw = 0.0f;
if (msg.size() > 0) {
nvgFontFace(ctx, "sans-bold");
nvgFillColor(ctx, nanogui::Color(8, 8, 8, 255)); // shadow
tw = nvgTextBounds(ctx, pos[0] + width(), rowh, msg.c_str(), nullptr, nullptr);
nvgFillColor(ctx, colour);
nvgText(ctx, pos[0] + width() - 1, rowh - 1, msg.c_str(), nullptr);
tw += 10;
}
if (entypo > 0) {
auto icon = nanogui::utf8(entypo);
nvgFontFace(ctx, "icons");
nvgFontSize(ctx, float(fsize)*0.8f);
nvgFillColor(ctx, nanogui::Color(8, 8, 8, 255)); // shadow
nvgText(ctx, pos[0] + width(), rowh, icon.data(), nullptr);
nvgText(ctx, pos[0] + width() - tw, rowh, icon.data(), nullptr);
nvgFillColor(ctx, colour);
nvgText(ctx, pos[0] + width() - 1, rowh - 1, icon.data(), nullptr);
} else {
nvgFontFace(ctx, "sans-bold");
nvgFillColor(ctx, nanogui::Color(8, 8, 8, 255)); // shadow
nvgText(ctx, pos[0] + width(), rowh, msg.c_str(), nullptr);
nvgFillColor(ctx, colour);
nvgText(ctx, pos[0] + width() - 1, rowh - 1, msg.c_str(), nullptr);
nvgText(ctx, pos[0] + width() - 1 - tw, rowh - 1, icon.data(), nullptr);
}
++count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment