Draw viewpos
This commit is contained in:
parent
3872821a40
commit
2717e5061b
@ -19,9 +19,11 @@ namespace fps
|
|||||||
std::chrono::nanoseconds frametime;
|
std::chrono::nanoseconds frametime;
|
||||||
auto lastframe = std::chrono::high_resolution_clock::now();
|
auto lastframe = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
float fps_color_good[4] = { 0.6f, 1.0f, 0.0f, 1.0f };
|
game::dvar_t* cg_drawfps;
|
||||||
float fps_color_ok[4] = { 1.0f, 0.7f, 0.3f, 1.0f };
|
|
||||||
float fps_color_bad[4] = { 1.0f, 0.3f, 0.3f, 1.0f };
|
float fps_color_good[4] = {0.6f, 1.0f, 0.0f, 1.0f};
|
||||||
|
float fps_color_ok[4] = {1.0f, 0.7f, 0.3f, 1.0f};
|
||||||
|
float fps_color_bad[4] = {1.0f, 0.3f, 0.3f, 1.0f};
|
||||||
|
|
||||||
float screen_max[2];
|
float screen_max[2];
|
||||||
|
|
||||||
@ -67,9 +69,38 @@ namespace fps
|
|||||||
const auto fps_string = utils::string::va("%i", average_fps());
|
const auto fps_string = utils::string::va("%i", average_fps());
|
||||||
const auto x = screen_max[0] - 15.f - game::R_TextWidth(fps_string, 0x7FFFFFFF, fps_font);
|
const auto x = screen_max[0] - 15.f - game::R_TextWidth(fps_string, 0x7FFFFFFF, fps_font);
|
||||||
|
|
||||||
game::R_AddCmdDrawText(fps_string, 0x7FFFFFFF, fps_font, x, 25.f, 1.0f, 1.0f, 0.0f,
|
game::R_AddCmdDrawText(fps_string, 0x7FFFFFFF, fps_font, x, 35.f, 1.0f, 1.0f, 0.0f,
|
||||||
fps >= 60 ? fps_color_good : (fps >= 30 ? fps_color_ok : fps_color_bad), 0);
|
fps >= 60 ? fps_color_good : (fps >= 30 ? fps_color_ok : fps_color_bad), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_pos()
|
||||||
|
{
|
||||||
|
if (game::CL_IsCgameInitialized() && game::g_entities[0].origin)
|
||||||
|
{
|
||||||
|
const auto pos_string = utils::string::va("%f %f %f",
|
||||||
|
game::g_entities[0].origin[0],
|
||||||
|
game::g_entities[0].origin[1],
|
||||||
|
game::g_entities[0].origin[2]);
|
||||||
|
|
||||||
|
const auto x = screen_max[0] - 15.f - game::R_TextWidth(pos_string, 0x7FFFFFFF, fps_font);
|
||||||
|
|
||||||
|
game::R_AddCmdDrawText(pos_string, 0x7FFFFFFF, fps_font, x,
|
||||||
|
60.f, 1.0f, 1.0f, 0.0f, fps_color_ok, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
if (cg_drawfps->current.integer >= 1)
|
||||||
|
{
|
||||||
|
draw_fps();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cg_drawfps->current.integer >= 2)
|
||||||
|
{
|
||||||
|
draw_pos();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
@ -77,7 +108,9 @@ namespace fps
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
scheduler::loop(draw_fps, scheduler::pipeline::renderer);
|
cg_drawfps = game::Dvar_RegisterInt(game::generateHashValue("cg_drawfps"), "", 0, 0, 4, game::DVAR_FLAG_SAVED);
|
||||||
|
|
||||||
|
scheduler::loop(draw, scheduler::pipeline::renderer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,11 @@ namespace game
|
|||||||
|
|
||||||
struct gentity_s
|
struct gentity_s
|
||||||
{
|
{
|
||||||
char __pad0[760];
|
char __pad0[0x1C];
|
||||||
|
vec3_t origin;
|
||||||
|
char __pad1[0xF0];
|
||||||
|
gclient_s* client;
|
||||||
|
//char __pad3[480];
|
||||||
}; // size = 760
|
}; // size = 760
|
||||||
|
|
||||||
struct Material
|
struct Material
|
||||||
|
@ -20,8 +20,8 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x618F90};
|
WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x618F90};
|
||||||
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x5A75D0};
|
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x5A75D0};
|
||||||
WEAK symbol<dvar_t*(const char* dvarName, bool value, unsigned int flags, const char* description)>
|
WEAK symbol<dvar_t*(int hash, const char* name, bool value, unsigned int flags)> Dvar_RegisterBool{0x617BB0};
|
||||||
Dvar_RegisterBool{0x617BB0};
|
WEAK symbol<dvar_t*(int hash, const char* name, int value, int min, int max, unsigned int flags)> Dvar_RegisterInt{0x618090};
|
||||||
WEAK symbol<dvar_t* (int hash, const char* dvarName, float value, float min, float max, unsigned int flags)>
|
WEAK symbol<dvar_t* (int hash, const char* dvarName, float value, float min, float max, unsigned int flags)>
|
||||||
Dvar_RegisterFloat{0x617F80};
|
Dvar_RegisterFloat{0x617F80};
|
||||||
WEAK symbol<dvar_t* (int hash, const char* dvarName, const char* value, unsigned int flags)>
|
WEAK symbol<dvar_t* (int hash, const char* dvarName, const char* value, unsigned int flags)>
|
||||||
|
Loading…
Reference in New Issue
Block a user