TextBox::setOnEditStart(runnable)

This commit is contained in:
MihailRis
2024-01-12 19:29:49 +03:00
parent 175613692f
commit 5669e6ebed
3 changed files with 27 additions and 1 deletions
+6 -1
View File
@@ -3,6 +3,7 @@
#include <iostream>
#include <sstream>
#include <memory>
#include <string>
#include <assert.h>
#include <stdexcept>
#include <GL/glew.h>
@@ -110,7 +111,7 @@ void HudRenderer::createDebugPanel(Engine* engine) {
TextBox* box = new TextBox(L"");
box->textSupplier([=]() {
Hitbox* hitbox = level->player->hitbox.get();
return std::to_wstring(hitbox->position[ax]);
return util::to_wstring(hitbox->position[ax], 2);
});
box->textConsumer([=](std::wstring text) {
try {
@@ -120,6 +121,10 @@ void HudRenderer::createDebugPanel(Engine* engine) {
} catch (std::invalid_argument& _){
}
});
box->setOnEditStart([=](){
Hitbox* hitbox = level->player->hitbox.get();
box->text(std::to_wstring(int(hitbox->position[ax])));
});
sub->add(box);
panel->add(sub);