Make console, ... stay on top of ui elements

This commit is contained in:
Federico Cecchetto 2021-09-15 03:34:26 +02:00
parent 9b93c1ccd2
commit fb90cc22dc
3 changed files with 27 additions and 16 deletions

View File

@ -10,6 +10,18 @@
namespace branding namespace branding
{ {
namespace
{
void draw_brand()
{
const auto font = game::R_RegisterFont("fonts/defaultBold.otf", 22);
float color[4] = {0.9f, 0.9f, 0.5f, 1.f};
game::R_AddCmdDrawText("h2-mod", 0x7FFFFFFF, font, 15.f, 15.f + static_cast<float>(font->pixelHeight),
1.f, 1.f, 0.0f, color, 0);
}
}
class component final : public component_interface class component final : public component_interface
{ {
public: public:
@ -17,21 +29,12 @@ namespace branding
{ {
localized_strings::override("MENU_SP_CAMPAIGN", "H2-Mod"); localized_strings::override("MENU_SP_CAMPAIGN", "H2-Mod");
scheduler::loop([]() scheduler::once([]()
{ {
const auto x = 15.f; scheduler::loop([]()
const auto y = 15.f; {
const auto scale = 1.0f; draw_brand();
float color[4] = {0.9f, 0.9f, 0.5f, 1.f}; }, scheduler::pipeline::renderer);
const auto* text = "h2-mod";
auto* font = game::R_RegisterFont("fonts/defaultBold.otf", 22);
if (!font) return;
game::R_AddCmdDrawText(text, 0x7FFFFFFF, font, static_cast<float>(x),
y + static_cast<float>(font->pixelHeight) * scale,
scale, scale, 0.0f, color, 0);
}, scheduler::pipeline::renderer); }, scheduler::pipeline::renderer);
} }
}; };

View File

@ -262,6 +262,11 @@ namespace fps
public: public:
void post_unpack() override void post_unpack() override
{ {
scheduler::once([]()
{
scheduler::loop(draw, scheduler::pipeline::renderer);
}, scheduler::pipeline::renderer);
cg_drawSpeed = dvars::register_int("cg_drawSpeed", 0, 0, 2, game::DVAR_FLAG_SAVED); cg_drawSpeed = dvars::register_int("cg_drawSpeed", 0, 0, 2, game::DVAR_FLAG_SAVED);
cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED, false); cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED, false);
@ -277,7 +282,6 @@ namespace fps
cg_speedGraphWidth = dvars::register_int("cg_speedGraphWidth", 200, 0, 1000, game::DVAR_FLAG_SAVED); cg_speedGraphWidth = dvars::register_int("cg_speedGraphWidth", 200, 0, 1000, game::DVAR_FLAG_SAVED);
cg_speedGraphHeight = dvars::register_int("cg_speedGraphHeight", 80, 0, 1000, game::DVAR_FLAG_SAVED); cg_speedGraphHeight = dvars::register_int("cg_speedGraphHeight", 80, 0, 1000, game::DVAR_FLAG_SAVED);
scheduler::loop(draw, scheduler::pipeline::renderer);
} }
}; };
} }

View File

@ -683,7 +683,11 @@ namespace game_console
public: public:
void post_unpack() override void post_unpack() override
{ {
scheduler::loop(draw_console, scheduler::pipeline::renderer); scheduler::once([]()
{
scheduler::loop(draw_console, scheduler::pipeline::renderer);
}, scheduler::pipeline::renderer);
con.cursor = 0; con.cursor = 0;
con.visible_line_count = 0; con.visible_line_count = 0;