Patch Overlays and RSettings to default txt size + cf

This commit is contained in:
tobid7 2024-02-20 20:56:14 +01:00
parent 33bb37be06
commit 688570b3cd
8 changed files with 29 additions and 21 deletions

View File

@ -114,6 +114,7 @@ class RSettings : public RenderD7::Scene {
std::string kbd_test; std::string kbd_test;
bool statemtold = false; bool statemtold = false;
bool stateftold = false; bool stateftold = false;
float tmp_txt;
public: public:
/// @brief Constructor /// @brief Constructor

View File

@ -27,6 +27,8 @@ namespace RenderD7 {
float GetDeltaTime(); // Extern from renderd7.cpp float GetDeltaTime(); // Extern from renderd7.cpp
void ProcessMessages() { void ProcessMessages() {
float tmp_txt = RenderD7::TextGetSize();
RenderD7::TextDefaultSize();
// Draw in ovl mode // Draw in ovl mode
RenderD7::OnScreen(Top); RenderD7::OnScreen(Top);
float fol = anim_len - fade_outs; float fol = anim_len - fade_outs;
@ -82,6 +84,7 @@ void ProcessMessages() {
// ReReverse ?? lol // ReReverse ?? lol
// Cause otherwise the Toasts will swap // Cause otherwise the Toasts will swap
std::reverse(msg_lst.begin(), msg_lst.end()); std::reverse(msg_lst.begin(), msg_lst.end());
RenderD7::CustomTextSize(tmp_txt);
} }
void PushMessage(const Message &msg) { void PushMessage(const Message &msg) {

View File

@ -244,6 +244,8 @@ namespace RenderD7 {
Ovl_Ftrace::Ovl_Ftrace(bool* is_enabled) { i_is_enabled = is_enabled; } Ovl_Ftrace::Ovl_Ftrace(bool* is_enabled) { i_is_enabled = is_enabled; }
void Ovl_Ftrace::Draw(void) const { void Ovl_Ftrace::Draw(void) const {
float tmp_txt = RenderD7::TextGetSize();
RenderD7::TextDefaultSize();
RenderD7::OnScreen(Top); RenderD7::OnScreen(Top);
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20), RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
RenderD7::StyleColor(RD7Color_Background)); RenderD7::StyleColor(RD7Color_Background));
@ -256,6 +258,7 @@ void Ovl_Ftrace::Draw(void) const {
RenderD7::Draw2::Text(R7Vec2(295, 30 + i * 15), RenderD7::Draw2::Text(R7Vec2(295, 30 + i * 15),
RenderD7::MsTimeFmt(dt[i].time_of)); RenderD7::MsTimeFmt(dt[i].time_of));
} }
RenderD7::CustomTextSize(tmp_txt);
} }
void Ovl_Ftrace::Logic() { void Ovl_Ftrace::Logic() {
@ -357,6 +360,8 @@ Ovl_Keyboard::~Ovl_Keyboard() {
} }
void Ovl_Keyboard::Draw(void) const { void Ovl_Keyboard::Draw(void) const {
float tmp_txt = RenderD7::TextGetSize();
RenderD7::TextDefaultSize();
if (ft3 > 5) RenderD7::Hid::Unlock(); if (ft3 > 5) RenderD7::Hid::Unlock();
auto key_table = keyboard_layout; auto key_table = keyboard_layout;
if (mode == 1) if (mode == 1)
@ -416,6 +421,7 @@ void Ovl_Keyboard::Draw(void) const {
RenderD7::UndoColorEdit(RD7Color_Text); RenderD7::UndoColorEdit(RD7Color_Text);
} }
if (ft3 > 5) RenderD7::Hid::Lock(); if (ft3 > 5) RenderD7::Hid::Lock();
RenderD7::CustomTextSize(tmp_txt);
} }
void Ovl_Keyboard::Logic() { void Ovl_Keyboard::Logic() {

View File

@ -273,10 +273,11 @@ void Label(const std::string &label, RD7TextFlags flags) {
if (!UI7CtxValidate()) return; if (!UI7CtxValidate()) return;
R7Vec2 textdim = RenderD7::GetTextDimensions(label); R7Vec2 textdim = RenderD7::GetTextDimensions(label);
R7Vec2 pos = GetCursorPos(); R7Vec2 pos = GetCursorPos();
float tbh = RenderD7::TextGetSize() * 40;
// Remove some y offset cause texts have some offset // Remove some y offset cause texts have some offset
UI7CtxCursorMove(textdim - R7Vec2(0, 4)); UI7CtxCursorMove(textdim - R7Vec2(0, 4));
RenderD7::TextColorByBg( RenderD7::TextColorByBg(
(pos.y + textdim.y < 20 ? RD7Color_Header : RD7Color_Background)); (pos.y + textdim.y < tbh ? RD7Color_Header : RD7Color_Background));
RenderD7::Draw2::Text(pos, label, flags); RenderD7::Draw2::Text(pos, label, flags);
RenderD7::UndoColorEdit(RD7Color_Text); RenderD7::UndoColorEdit(RD7Color_Text);
} }
@ -462,14 +463,9 @@ void Grid(const std::string &name, const R7Vec2 &size,
UI7CtxCursorMove(size); UI7CtxCursorMove(size);
} }
bool BeginTree(const std::string& text) { bool BeginTree(const std::string &text) { return false; }
return false; void EndTree() {}
}
void EndTree() {
}
R7Vec2 GetCursorPos() { R7Vec2 GetCursorPos() {
if (!UI7CtxValidate()) return R7Vec2(); if (!UI7CtxValidate()) return R7Vec2();

View File

@ -454,6 +454,8 @@ void RenderD7::FrameEnd() {
} }
RenderD7::RSettings::RSettings() { RenderD7::RSettings::RSettings() {
tmp_txt = RenderD7::TextGetSize();
RenderD7::TextDefaultSize();
RenderD7::FadeIn(); RenderD7::FadeIn();
std::fstream cfg_ldr(rd7i_config_path + "/config.rc7", std::ios::in); std::fstream cfg_ldr(rd7i_config_path + "/config.rc7", std::ios::in);
cfg_ldr >> rd7i_config; cfg_ldr >> rd7i_config;
@ -463,7 +465,7 @@ RenderD7::RSettings::RSettings() {
stateftold = rd7i_ftraced; stateftold = rd7i_ftraced;
} }
RenderD7::RSettings::~RSettings() {} RenderD7::RSettings::~RSettings() { RenderD7::CustomTextSize(tmp_txt); }
std::vector<std::string> StrHelper(std::string input) { std::vector<std::string> StrHelper(std::string input) {
std::string ss(input); std::string ss(input);