Draw fps, console, branding on top of ui elements
This commit is contained in:
parent
d44a55dc11
commit
1501929977
@ -10,29 +10,29 @@
|
||||
|
||||
namespace branding
|
||||
{
|
||||
void draw()
|
||||
{
|
||||
const auto x = 15.f;
|
||||
const auto y = 15.f;
|
||||
const auto scale = 1.0f;
|
||||
float color[4] = { 0.9f, 0.9f, 0.5f, 1.f };
|
||||
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);
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
localized_strings::override("MENU_SP_CAMPAIGN", "H2-Mod");
|
||||
|
||||
scheduler::loop([]()
|
||||
{
|
||||
const auto x = 15.f;
|
||||
const auto y = 15.f;
|
||||
const auto scale = 1.0f;
|
||||
float color[4] = {0.9f, 0.9f, 0.5f, 1.f};
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
6
src/client/component/branding.hpp
Normal file
6
src/client/component/branding.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace branding
|
||||
{
|
||||
void draw();
|
||||
}
|
@ -240,21 +240,21 @@ namespace fps
|
||||
game::R_AddCmdDrawText(pos_string, 0x7FFFFFFF, font, x,
|
||||
60.f, 1.0f, 1.0f, 0.0f, fps_color_ok, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void draw()
|
||||
void draw()
|
||||
{
|
||||
check_resize();
|
||||
draw_fps();
|
||||
|
||||
if (!game::CL_IsCgameInitialized() || !game::g_entities[0].client)
|
||||
{
|
||||
check_resize();
|
||||
draw_fps();
|
||||
|
||||
if (!game::CL_IsCgameInitialized() || !game::g_entities[0].client)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
draw_pos();
|
||||
draw_speed();
|
||||
draw_speed_graph();
|
||||
return;
|
||||
}
|
||||
|
||||
draw_pos();
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
6
src/client/component/fps.hpp
Normal file
6
src/client/component/fps.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace fps
|
||||
{
|
||||
void draw();
|
||||
}
|
@ -391,25 +391,25 @@ namespace game_console
|
||||
draw_output_scrollbar(x, y, width, height);
|
||||
draw_output_text(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_console()
|
||||
void draw_console()
|
||||
{
|
||||
check_resize();
|
||||
|
||||
if (*game::keyCatchers & 1)
|
||||
{
|
||||
check_resize();
|
||||
|
||||
if (*game::keyCatchers & 1)
|
||||
if (!(*game::keyCatchers & 1))
|
||||
{
|
||||
if (!(*game::keyCatchers & 1))
|
||||
{
|
||||
con.output_visible = false;
|
||||
}
|
||||
|
||||
if (con.output_visible)
|
||||
{
|
||||
draw_output_window();
|
||||
}
|
||||
|
||||
draw_input();
|
||||
con.output_visible = false;
|
||||
}
|
||||
|
||||
if (con.output_visible)
|
||||
{
|
||||
draw_output_window();
|
||||
}
|
||||
|
||||
draw_input();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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", []()
|
||||
|
Loading…
Reference in New Issue
Block a user