summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kurator/src/Battle.cpp7
-rw-r--r--kurator/src/components.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp
index 9a92180..cb97ce7 100644
--- a/kurator/src/Battle.cpp
+++ b/kurator/src/Battle.cpp
@@ -3,6 +3,7 @@
#include <algorithm>
#include <cmath>
#include <memory>
+#include <string>
#include <utility>
#include <raylib.h>
@@ -86,7 +87,7 @@ Battle::draw() const
for (const auto& [entity, text, transform] : pops.each()) {
const int x = width/2 + transform.position.x*scale - text.width/2;
const int y = height/2 + transform.position.y*scale - text.font_size/2;
- DrawText(text.text, x, y, text.font_size, text.color);
+ DrawText(text.text.c_str(), x, y, text.font_size, text.color);
}
}
@@ -98,10 +99,10 @@ Battle::receive(const battles::Hit& hit)
if (!registry.valid(hit.victim))
return;
const auto entity = registry.create();
- const auto text = TextFormat("%.1f", hit.damage);
+ const std::string text = TextFormat("%.1f", hit.damage);
const auto& transform = registry.get<battles::Transform>(hit.victim);
registry.emplace<Timed>(entity, 1.2);
- registry.emplace<CenteredText>(entity, text, MeasureText(text, 10), 10, RED);
+ registry.emplace<CenteredText>(entity, text, MeasureText(text.c_str(), 10), 10, RED);
registry.emplace<battles::Transform>(entity, transform.position, 0.0);
registry.emplace<PopMove>(entity, battles::Point{0.0, -0.6}, 0.998);
}
diff --git a/kurator/src/components.h b/kurator/src/components.h
index 7d54ea5..6e03412 100644
--- a/kurator/src/components.h
+++ b/kurator/src/components.h
@@ -19,7 +19,7 @@ struct Timed
struct CenteredText
{
- const char* text;
+ std::string text;
int width;
int font_size;
Color color;