Draw fps, console, branding on top of ui elements

This commit is contained in:
Federico Cecchetto 2021-09-19 18:20:15 +02:00
parent d44a55dc11
commit 1501929977
7 changed files with 66 additions and 48 deletions

View File

@ -10,14 +10,7 @@
namespace branding
{
class component final : public component_interface
{
public:
void post_unpack() override
{
localized_strings::override("MENU_SP_CAMPAIGN", "H2-Mod");
scheduler::loop([]()
void draw()
{
const auto x = 15.f;
const auto y = 15.f;
@ -32,7 +25,14 @@ namespace branding
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);
}
class component final : public component_interface
{
public:
void post_unpack() override
{
localized_strings::override("MENU_SP_CAMPAIGN", "H2-Mod");
}
};
}

View File

@ -0,0 +1,6 @@
#pragma once
namespace branding
{
void draw();
}

View File

@ -240,6 +240,7 @@ namespace fps
game::R_AddCmdDrawText(pos_string, 0x7FFFFFFF, font, x,
60.f, 1.0f, 1.0f, 0.0f, fps_color_ok, 0);
}
}
void draw()
{
@ -255,7 +256,6 @@ namespace fps
draw_speed();
draw_speed_graph();
}
}
class component final : public component_interface
{
@ -276,8 +276,6 @@ namespace fps
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);
scheduler::loop(draw, scheduler::pipeline::renderer);
}
};
}

View File

@ -0,0 +1,6 @@
#pragma once
namespace fps
{
void draw();
}

View File

@ -391,6 +391,7 @@ namespace game_console
draw_output_scrollbar(x, y, width, height);
draw_output_text(x, y);
}
}
void draw_console()
{
@ -411,7 +412,6 @@ namespace game_console
draw_input();
}
}
}
void print(const int type, const char* fmt, ...)
{
@ -683,8 +683,6 @@ namespace game_console
public:
void post_unpack() override
{
scheduler::loop(draw_console, scheduler::pipeline::renderer);
con.cursor = 0;
con.visible_line_count = 0;
con.output_visible = false;

View File

@ -9,6 +9,8 @@ namespace game_console
con_type_info = 7
};
void draw_console();
void print(int type, const char* fmt, ...);
bool console_char_event(int local_client_num, int key);

View File

@ -7,6 +7,11 @@
#include "chat.hpp"
#include "scheduler.hpp"
#include "command.hpp"
#include "game_console.hpp"
#include "fps.hpp"
#include "branding.hpp"
#include "ui_scripting.hpp"
#include "game/ui_scripting/lua/engine.hpp"
@ -29,6 +34,9 @@ namespace ui_scripting
scheduler::loop([]()
{
ui_scripting::lua::engine::run_frame();
fps::draw();
branding::draw();
game_console::draw_console();
}, scheduler::pipeline::renderer);
command::add("reloadmenus", []()