Patch Overlays and RSettings to default txt size + cf
This commit is contained in:
parent
33bb37be06
commit
688570b3cd
@ -71,8 +71,8 @@ void CustomizeColor(RD7Color color, unsigned int custom);
|
|||||||
void ColorNew(RD7Color color, unsigned int new_color);
|
void ColorNew(RD7Color color, unsigned int new_color);
|
||||||
void UndoColorEdit(RD7Color color);
|
void UndoColorEdit(RD7Color color);
|
||||||
void UndoAllColorEdits();
|
void UndoAllColorEdits();
|
||||||
void ThemeLoad(const std::string& path);
|
void ThemeLoad(const std::string &path);
|
||||||
void ThemeSave(const std::string& path);
|
void ThemeSave(const std::string &path);
|
||||||
void ThemeDefault();
|
void ThemeDefault();
|
||||||
namespace Color {
|
namespace Color {
|
||||||
/// @brief RGBA Class
|
/// @brief RGBA Class
|
||||||
|
@ -45,7 +45,7 @@ void EndMenu();
|
|||||||
void Grid(const std::string &name, const R7Vec2 &size,
|
void Grid(const std::string &name, const R7Vec2 &size,
|
||||||
R7Vec2 (*display_func)(void *, R7Vec2), void **data_array,
|
R7Vec2 (*display_func)(void *, R7Vec2), void **data_array,
|
||||||
size_t num_entrys);
|
size_t num_entrys);
|
||||||
bool BeginTree(const std::string& text);
|
bool BeginTree(const std::string &text);
|
||||||
void EndTree();
|
void EndTree();
|
||||||
R7Vec2 GetCursorPos();
|
R7Vec2 GetCursorPos();
|
||||||
void SetCursorPos(R7Vec2 cp);
|
void SetCursorPos(R7Vec2 cp);
|
||||||
|
@ -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
|
||||||
|
@ -105,11 +105,11 @@ void Sample::Draw() const {
|
|||||||
UI7::Checkbox("RD7-Debug", rd7_debugging);
|
UI7::Checkbox("RD7-Debug", rd7_debugging);
|
||||||
UI7::InputText("Search", search__, "Tap Here");
|
UI7::InputText("Search", search__, "Tap Here");
|
||||||
UI7::Label("Text Control:");
|
UI7::Label("Text Control:");
|
||||||
if(UI7::Button("text++")) txt_size+=0.01;
|
if (UI7::Button("text++")) txt_size += 0.01;
|
||||||
UI7::SameLine();
|
UI7::SameLine();
|
||||||
if(UI7::Button("text--")) txt_size -= 0.01;
|
if (UI7::Button("text--")) txt_size -= 0.01;
|
||||||
UI7::SameLine();
|
UI7::SameLine();
|
||||||
if(UI7::Button("def")) txt_size = 0.5;
|
if (UI7::Button("def")) txt_size = 0.5;
|
||||||
}
|
}
|
||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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() {
|
||||||
|
@ -242,7 +242,7 @@ bool Button(const std::string &label, R7Vec2 size) {
|
|||||||
|
|
||||||
void Checkbox(const std::string &label, bool &c) {
|
void Checkbox(const std::string &label, bool &c) {
|
||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
float sv = (RenderD7::TextGetSize()*40)*0.9;
|
float sv = (RenderD7::TextGetSize() * 40) * 0.9;
|
||||||
R7Vec2 cbs = R7Vec2(sv, sv);
|
R7Vec2 cbs = R7Vec2(sv, sv);
|
||||||
R7Vec2 txtdim = RenderD7::GetTextDimensions(label);
|
R7Vec2 txtdim = RenderD7::GetTextDimensions(label);
|
||||||
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -361,7 +362,7 @@ void BrowserList(const std::vector<std::string> &entrys, int &selection,
|
|||||||
void InputText(const std::string &label, std::string &text,
|
void InputText(const std::string &label, std::string &text,
|
||||||
const std::string &hint) {
|
const std::string &hint) {
|
||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
float sv = (RenderD7::TextGetSize()*40)*0.9;
|
float sv = (RenderD7::TextGetSize() * 40) * 0.9;
|
||||||
R7Vec2 cbs = R7Vec2(144, sv);
|
R7Vec2 cbs = R7Vec2(144, sv);
|
||||||
R7Vec2 txtdim = RenderD7::GetTextDimensions(label);
|
R7Vec2 txtdim = RenderD7::GetTextDimensions(label);
|
||||||
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
||||||
@ -399,7 +400,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
size.y = 240;
|
size.y = 240;
|
||||||
}
|
}
|
||||||
RD7TextFlags txtflags = 0;
|
RD7TextFlags txtflags = 0;
|
||||||
float tbh = RenderD7::TextGetSize()*40;
|
float tbh = RenderD7::TextGetSize() * 40;
|
||||||
if (flags & UI7MenuFlags_NoTitlebar) titlebar = false;
|
if (flags & UI7MenuFlags_NoTitlebar) titlebar = false;
|
||||||
if (flags & UI7MenuFlags_TitleMid) txtflags = RD7TextFlags_AlignMid;
|
if (flags & UI7MenuFlags_TitleMid) txtflags = RD7TextFlags_AlignMid;
|
||||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), size,
|
RenderD7::Draw2::RFS(R7Vec2(0, 0), size,
|
||||||
@ -412,7 +413,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
RenderD7::UndoColorEdit(RD7Color_Text);
|
RenderD7::UndoColorEdit(RD7Color_Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCursorPos(R7Vec2(5, tbh+5));
|
SetCursorPos(R7Vec2(5, tbh + 5));
|
||||||
return UI7CtxBeginMenu(title);
|
return UI7CtxBeginMenu(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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();
|
||||||
|
@ -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);
|
||||||
@ -591,10 +593,10 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
// List Bg
|
// List Bg
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
if ((i % 2 == 0))
|
if ((i % 2 == 0))
|
||||||
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
|
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
|
||||||
RenderD7::StyleColor(RD7Color_List0));
|
RenderD7::StyleColor(RD7Color_List0));
|
||||||
else
|
else
|
||||||
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
|
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
|
||||||
RenderD7::StyleColor(RD7Color_List1));
|
RenderD7::StyleColor(RD7Color_List1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user