Fix some Format stuff

This commit is contained in:
2024-05-03 15:51:06 +02:00
parent 6f658af674
commit 19450ba2c9
9 changed files with 64 additions and 46 deletions

View File

@ -247,8 +247,9 @@ void Ovl_Ftrace::Draw(void) const {
float tmp_txt = RenderD7::TextGetSize();
RenderD7::TextDefaultSize();
RenderD7::OnScreen(Top);
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
RenderD7::StyleColor(RD7Color_Background));
RenderD7::Color::RGBA bg(RD7Color_Background);
bg.changeA(150);
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20), bg.toRGBA());
std::vector<RenderD7::Ftrace::FTRes> dt;
for (auto const& it : RenderD7::Ftrace::rd7_traces)
@ -344,12 +345,14 @@ void Ovl_Metrik::Logic() {
if (!i_is_enabled[0]) this->Kill();
}
Ovl_Keyboard::Ovl_Keyboard(std::string& ref, const std::string& hint,
RD7Keyboard type) {
Ovl_Keyboard::Ovl_Keyboard(std::string& ref, RD7KeyboardState& state,
const std::string& hint, RD7Keyboard type) {
// Blocks All Input outside of Keyboard
// Doesnt work for Hidkeys down etc
RenderD7::Hid::Lock();
typed_text = &ref;
this->state = &state;
*this->state = RD7KeyboardState_None;
str_bak = ref;
ft3 = 0;
}
@ -439,8 +442,10 @@ void Ovl_Keyboard::Logic() {
// Enter
} else if (it.first == 0x05) {
*typed_text = str_bak;
*state = RD7KeyboardState_Cancel;
this->Kill();
} else if (it.first == 0x06) {
*state = RD7KeyboardState_Confirm;
this->Kill();
} else if (it.first == 0x07) {
// this->typed_text += '\t'; // Tab

View File

@ -421,6 +421,7 @@ void InputText(const std::string &label, std::string &text,
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
RD7Color bg = RD7Color_FrameBg;
auto id = UI7CtxNewID(label);
RD7KeyboardState kbd_state; // tmp (goes out of scope)
R7Vec2 pos = GetCursorPos();
@ -429,7 +430,8 @@ void InputText(const std::string &label, std::string &text,
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, inp)) {
bg = RD7Color_FrameBgHovered;
RenderD7::AddOvl(std::make_unique<RenderD7::Ovl_Keyboard>(text, hint));
RenderD7::AddOvl(
std::make_unique<RenderD7::Ovl_Keyboard>(text, kbd_state, hint));
} else if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Held) &&
InBox(RenderD7::Hid::GetTouchPosition(), pos, inp)) {
bg = RD7Color_FrameBgHovered;

View File

@ -65,7 +65,7 @@ std::string RenderD7::Lang::GetSys() {
}
}
std::string RenderD7::Lang::Get(const std::string &key) {
if(!appJson.contains("keys")) return "ERR-01";
if (!appJson.contains("keys")) return "ERR-01";
nlohmann::json js = appJson["keys"];
if (!js.contains(key)) return key;
return js.at(key).get<std::string>();

View File

@ -599,10 +599,10 @@ void RenderD7::RSettings::Draw(void) const {
// List Bg
for (int i = 0; i < 12; i++) {
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));
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));
}
@ -731,7 +731,8 @@ void RenderD7::RSettings::Logic() {
return;
}
} else if (it.first == 0x00000003) {
if (it.second) RenderD7::AddOvl(std::make_unique<Ovl_Keyboard>(kbd_test));
if (it.second)
RenderD7::AddOvl(std::make_unique<Ovl_Keyboard>(kbd_test, kbd_state));
}
}
/// Clear if handled