aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crepe/api/Asset.h2
-rw-r--r--src/crepe/system/RenderSystem.cpp2
-rw-r--r--src/example/loadfont.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/crepe/api/Asset.h b/src/crepe/api/Asset.h
index b367a92..bfd0ac7 100644
--- a/src/crepe/api/Asset.h
+++ b/src/crepe/api/Asset.h
@@ -37,7 +37,7 @@ public:
private:
//! path to asset
- std::string src;
+ const std::string src;
private:
/**
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index a03c636..5b2528a 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -147,7 +147,7 @@ void RenderSystem::render_text(Text & text, const Transform & tm) {
SDLContext & ctx = this->mediator.sdl_context;
if (!text.font.has_value()) {
- text.font = ctx.get_font_from_name(text.font_family);
+ text.font.emplace(ctx.get_font_from_name(text.font_family));
}
ResourceManager & resource_manager = this->mediator.resource_manager;
diff --git a/src/example/loadfont.cpp b/src/example/loadfont.cpp
index ed67ffa..6fb9760 100644
--- a/src/example/loadfont.cpp
+++ b/src/example/loadfont.cpp
@@ -26,7 +26,7 @@ int main() {
std::unique_ptr<Text> label2 = std::make_unique<Text>(
1, vec2(100, 100), vec2(0, 0), "fsaafdafsdafsdafsdasfdds", Text::Data{});
Asset asset = Asset("test test");
- label->font = asset;
+ label->font.emplace(asset);
std::cout << label->font.value().get_path() << std::endl;
// label2->font = std::make_optional(asset);
// std::cout << "Path: " << label2->font.get_path() << std::endl;