From 949a0821f890c727d0ece9bd358d1ff65e09fe41 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Fri, 20 May 2022 20:57:27 +0200 Subject: [PATCH] Dont render console twice --- src/client/component/branding.cpp | 25 +++++++++++++++---------- src/client/component/game_console.cpp | 6 ++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index 58765332..06b71bc2 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -27,11 +27,26 @@ namespace branding const auto* const build_num = ui_get_formatted_build_number_hook.invoke(); return utils::string::va("%s (%s)", VERSION, build_num); } + + void draw_branding() + { + const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20); + if (font) + { + game::R_AddCmdDrawText("H1-Mod: " VERSION, 0x7FFFFFFF, font, 10.f, + 5.f + static_cast(font->pixelHeight), 1.f, 1.f, 0.0f, color, 0); + } + } } class component final : public component_interface { public: + void post_start() override + { + scheduler::loop(draw_branding, scheduler::pipeline::renderer); + } + void post_unpack() override { if (game::environment::is_dedi()) @@ -49,16 +64,6 @@ namespace branding ui_get_formatted_build_number_hook.create( SELECT_VALUE(0x0, 0x1DF300_b), ui_get_formatted_build_number_stub); - - scheduler::loop([]() - { - const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20); - if (font) - { - game::R_AddCmdDrawText("H1-Mod: " VERSION, 0x7FFFFFFF, font, 10.f, - 5.f + static_cast(font->pixelHeight), 1.f, 1.f, 0.0f, color, 0); - } - }, scheduler::pipeline::renderer); } }; } diff --git a/src/client/component/game_console.cpp b/src/client/component/game_console.cpp index 6f67d4a5..ef8b5fda 100644 --- a/src/client/component/game_console.cpp +++ b/src/client/component/game_console.cpp @@ -723,19 +723,17 @@ namespace game_console { return; } - - scheduler::loop(draw_console, scheduler::pipeline::renderer); } void post_unpack() override { - scheduler::loop(draw_console, scheduler::pipeline::renderer); - if (game::environment::is_dedi()) { return; } + scheduler::loop(draw_console, scheduler::pipeline::renderer); + // initialize our structs con.cursor = 0; con.visible_line_count = 0;