aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:58:52 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:58:52 +0100
commit8d3fd95ad8564740bb169f4e08bc085a232a4d83 (patch)
tree7d0334ee18d0f9278817143b73be0385516b4093 /src/crepe/system
parent31fe4b1d44a7a7114c7ef8c0c5310a6070214cb2 (diff)
workig rending text
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/RenderSystem.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 872ba29..2641435 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -76,20 +76,24 @@ void RenderSystem::update() {
this->present_screen();
}
-
-void RenderSystem::render_text(){
+void RenderSystem::render_text() {
SDLContext & ctx = this->mediator.sdl_context;
ComponentManager & mgr = this->mediator.component_manager;
ResourceManager & resource_manager = this->mediator.resource_manager;
RefVector<Text> texts = mgr.get_components_by_type<Text>();
- for (const Text & text : texts) {
+ for (const Text & text : texts) {
if (!text.active) continue;
- const Font & res = resource_manager.get<Font>(text.font.value());
- ctx.draw_text(text, res);
+ const Font & font = resource_manager.get<Font>(text.font.value());
+ const auto & transform
+ = mgr.get_components_by_id<Transform>(text.game_object_id).front().get();
+ ctx.draw_text(SDLContext::RenderText{
+ .text = text,
+ .font = font,
+ .transform = transform,
+ });
}
-
}
bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) {