Add TextView UI component

This commit is contained in:
vottozi committed 2026-02-06 15:11:27 +06:00
1 parent e799b4ec79
commit a1d54b01b0
3 files changed
+87 -1

No files matched your search

+13
View File
@@ -275,6 +275,15 @@ namespace ZL
loadGameplayUI = [this]() {
uiManager.loadFromFile("resources/config/ui.json", renderer, CONST_ZIP_FILE);
auto velocityTv = uiManager.findTextView("velocityText");
if (velocityTv) {
velocityTv->rect.x = 10.0f;
velocityTv->rect.y = static_cast<float>(Environment::height) - velocityTv->rect.h - 10.0f;
}
else {
std::cerr << "Failed to find velocityText in UI" << std::endl;
}
uiManager.startAnimationOnNode("backgroundNode", "bgScroll");
static bool isExitButtonAnimating = false;
uiManager.setAnimationCallback("settingsButton", "buttonsExit", [this]() {
@@ -1206,6 +1215,10 @@ namespace ZL
}
}
// update velocity text
std::string velocityStr = "Velocity: " + std::to_string(static_cast<int>(Environment::shipState.velocity));
uiManager.setText("velocityText", velocityStr);
uiManager.update(static_cast<float>(delta));
lastTickCount = newTickCount;
}