From 8d3fd95ad8564740bb169f4e08bc085a232a4d83 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Tue, 17 Dec 2024 13:58:52 +0100 Subject: workig rending text --- src/crepe/system/RenderSystem.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/crepe/system') 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 texts = mgr.get_components_by_type(); - for (const Text & text : texts) { + for (const Text & text : texts) { if (!text.active) continue; - const Font & res = resource_manager.get(text.font.value()); - ctx.draw_text(text, res); + const Font & font = resource_manager.get(text.font.value()); + const auto & transform + = mgr.get_components_by_id(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) { -- cgit v1.2.3