counter_text.Position(glm::vec3(-25.0f, 25.0f, 0.0f), Gravity::NORTH_EAST);
counter_text.Foreground(glm::vec4(1.0f));
counter_text.Background(glm::vec4(0.5f));
+ position_text.Hide();
+ position_text.Position(glm::vec3(-25.0f, 25.0f + font.LineSkip(), 0.0f), Gravity::NORTH_EAST);
+ position_text.Foreground(glm::vec4(1.0f));
+ position_text.Background(glm::vec4(0.5f));
messages.Position(glm::vec3(25.0f, -25.0f, 0.0f), Gravity::SOUTH_WEST);
messages.Foreground(glm::vec4(1.0f));
messages.Background(glm::vec4(0.5f));
ToggleVisual();
break;
case SDLK_F3:
- ToggleCounter();
+ ToggleDebug();
break;
case SDLK_F4:
ToggleAudio();
}
}
-void Interface::ToggleCounter() {
+void Interface::ToggleDebug() {
counter_text.Toggle();
+ position_text.Toggle();
if (counter_text.Visible()) {
UpdateCounter();
+ UpdatePosition();
}
}
counter_text.Set(font, text);
}
+void Interface::UpdatePosition() {
+ std::stringstream s;
+ s << std::setprecision(3) << "pos: " << ctrl.Controlled().AbsolutePosition();
+ position_text.Set(font, s.str());
+}
+
void Interface::Handle(const SDL_MouseMotionEvent &event) {
if (config.mouse_disabled) return;
if (counter_text.Visible() && counter.Changed()) {
UpdateCounter();
}
+ if (position_text.Visible()) {
+ UpdatePosition();
+ }
}
namespace {
if (counter_text.Visible()) {
counter_text.Render(viewport);
}
+ if (position_text.Visible()) {
+ position_text.Render(viewport);
+ }
if (msg_timer.Running()) {
messages.Render(viewport);