New UI7Menu Api, Scrolling in Menus (on tusch screen), small fixes
This commit is contained in:
parent
17c36bb05e
commit
66337e0f6e
@ -61,8 +61,8 @@ inline void End(std::string group, std::string func_name) {
|
||||
std::string trace_id = scomb(group, func_name);
|
||||
rd7_traces[trace_id].time_end = svcGetSystemTick();
|
||||
rd7_traces[trace_id].time_of = static_cast<float>(
|
||||
rd7_traces[trace_id].time_end / (float)TICKS_PER_MSEC -
|
||||
rd7_traces[trace_id].time_start / (float)TICKS_PER_MSEC);
|
||||
((float)rd7_traces[trace_id].time_end / (float)TICKS_PER_MSEC) -
|
||||
((float)rd7_traces[trace_id].time_start / (float)TICKS_PER_MSEC));
|
||||
}
|
||||
} // namespace Ftrace
|
||||
} // namespace RenderD7
|
||||
|
@ -32,6 +32,7 @@ enum UI7MenuFlags_ {
|
||||
UI7MenuFlags_None = 0,
|
||||
UI7MenuFlags_NoTitlebar = UI7MAKEFLAG(0),
|
||||
UI7MenuFlags_TitleMid = UI7MAKEFLAG(1),
|
||||
UI7MenuFlags_ForceScrolling = MAKEFLAG(2),
|
||||
};
|
||||
|
||||
namespace UI7 {
|
||||
@ -70,4 +71,5 @@ R7Vec2 GetCursorPos();
|
||||
void SetCursorPos(R7Vec2 cp);
|
||||
void RestoreCursor();
|
||||
void SameLine();
|
||||
float GetScrollingOffset();
|
||||
} // namespace UI7
|
||||
|
@ -98,12 +98,10 @@ class RSettings : public RenderD7::Scene {
|
||||
/// @brief State (Define for Menus)
|
||||
enum RState {
|
||||
RSETTINGS, // Main Settings Menu
|
||||
RINFO,
|
||||
RIDB, // Internal Debugger
|
||||
ROVERLAYS,
|
||||
RFTRACE, // FTRace Menu
|
||||
RUI7, // UI7 Menu
|
||||
RCREDITS // Unused?
|
||||
RIDB, // Internal Debugger
|
||||
ROVERLAYS, // Overlay Settings
|
||||
RFTRACE, // FTRace Menu
|
||||
RUI7, // UI7 Menu
|
||||
};
|
||||
|
||||
/// @param shared_request Defines requests from Draw to Logic
|
||||
|
129
source/UI7.cpp
129
source/UI7.cpp
@ -33,7 +33,7 @@
|
||||
/// Independent of the main RenderD7 api
|
||||
#define TICKS_PER_MSEC 268111.856
|
||||
#include <3ds.h>
|
||||
#define __get_time() svcGetSystemTick() / TICKS_PER_MSEC
|
||||
#define __get_time() (float)svcGetSystemTick() / (float)TICKS_PER_MSEC
|
||||
#else
|
||||
#include <chrono>
|
||||
#define __get_time() \
|
||||
@ -119,29 +119,40 @@ struct UI7OBJ {
|
||||
bool s = false;
|
||||
};
|
||||
|
||||
struct UI7Menu {
|
||||
UI7Menu() {}
|
||||
UI7ID menuid; // menu ID
|
||||
R7Vec2 cursor; // cursor
|
||||
R7Vec2 cb; // backup cursor
|
||||
R7Vec2 slc; // sameline cursor
|
||||
float scrolling_offset = 0.f; // For MenuScrolling
|
||||
bool enable_scrolling = false; // Menu Scrolling
|
||||
float tbh; // TabBar Height
|
||||
|
||||
R7Vec2 ms; // Max Size
|
||||
R7Vec2 mdp; // Mouse/Touch Initial pos
|
||||
// For Smart Pointer
|
||||
using Ref = std::shared_ptr<UI7Menu>;
|
||||
static Ref New() { return std::make_shared<UI7Menu>(); }
|
||||
};
|
||||
|
||||
struct UI7_Ctx {
|
||||
UI7_Ctx() {
|
||||
delta = 0.0f;
|
||||
time = 0.0f;
|
||||
is_activated = false;
|
||||
_last = 0;
|
||||
cursor = R7Vec2();
|
||||
slc = R7Vec2();
|
||||
cbackup = R7Vec2();
|
||||
in_menu = false;
|
||||
current_menu = UI7ID("");
|
||||
debugging = false;
|
||||
}
|
||||
float delta;
|
||||
float time;
|
||||
bool is_activated;
|
||||
unsigned long long _last;
|
||||
R7Vec2 cursor;
|
||||
R7Vec2 cbackup;
|
||||
R7Vec2 slc;
|
||||
float _last;
|
||||
bool in_menu;
|
||||
bool debugging;
|
||||
UI7ID current_menu;
|
||||
std::map<std::string, UI7Menu::Ref> menus;
|
||||
UI7Menu::Ref cm;
|
||||
std::unordered_map<std::string, UI7ID *> ids;
|
||||
std::vector<UI7OBJ> objects;
|
||||
};
|
||||
@ -161,8 +172,12 @@ bool UI7CtxInMenu() {
|
||||
|
||||
bool UI7CtxBeginMenu(const std::string &lb) {
|
||||
if (!UI7CtxValidate()) return false;
|
||||
if (UI7CtxInMenu()) return false;
|
||||
ui7_ctx->current_menu = UI7ID(lb);
|
||||
auto id = UI7ID(lb);
|
||||
if (ui7_ctx->menus.find(id.ID()) == ui7_ctx->menus.end())
|
||||
ui7_ctx->menus.insert(std::make_pair(id.ID(), UI7Menu::New()));
|
||||
ui7_ctx->cm = ui7_ctx->menus[id.ID()];
|
||||
ui7_ctx->cm->menuid = id;
|
||||
ui7_ctx->cm->cursor = R7Vec2(0, 0);
|
||||
ui7_ctx->in_menu = true;
|
||||
return true;
|
||||
}
|
||||
@ -170,17 +185,17 @@ bool UI7CtxBeginMenu(const std::string &lb) {
|
||||
void UI7CtxEndMenu() {
|
||||
if (!UI7CtxValidate()) return;
|
||||
if (!UI7CtxInMenu()) return;
|
||||
ui7_ctx->current_menu = UI7ID("");
|
||||
ui7_ctx->cm = nullptr;
|
||||
ui7_ctx->in_menu = false;
|
||||
}
|
||||
|
||||
void UI7CtxCursorMove(R7Vec2 size) {
|
||||
if (!UI7CtxValidate()) return;
|
||||
if (!UI7CtxInMenu()) return;
|
||||
ui7_ctx->slc = ui7_ctx->cursor + R7Vec2(5, 0);
|
||||
ui7_ctx->cursor.x = 5;
|
||||
ui7_ctx->cursor += R7Vec2(0, size.y + 5);
|
||||
ui7_ctx->slc += R7Vec2(size.x, 0);
|
||||
ui7_ctx->cm->slc = ui7_ctx->cm->cursor + R7Vec2(size.x + 5, 0);
|
||||
ui7_ctx->cm->cursor.x = 5;
|
||||
ui7_ctx->cm->cursor += R7Vec2(0, size.y + 5);
|
||||
ui7_ctx->cm->ms = R7Vec2(ui7_ctx->cm->slc.x, ui7_ctx->cm->cursor.y);
|
||||
}
|
||||
|
||||
void UI7CtxRegObj(const UI7OBJ &obj) {
|
||||
@ -231,7 +246,7 @@ void Init() {
|
||||
ui7_ctx = new UI7_Ctx;
|
||||
ui7_ctx->delta = 0.0f;
|
||||
ui7_ctx->time = 0.0f;
|
||||
ui7_ctx->cursor = R7Vec2(0, 0);
|
||||
ui7_ctx->_last = __get_time();
|
||||
ui7_ctx->is_activated = true;
|
||||
}
|
||||
|
||||
@ -244,17 +259,17 @@ void Deinit() {
|
||||
for (auto &it : ui7_ctx->ids) {
|
||||
delete it.second;
|
||||
}
|
||||
ui7_ctx->menus.clear();
|
||||
delete ui7_ctx;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
// Dont do anithing without ctx;
|
||||
if (!UI7CtxValidate()) return;
|
||||
unsigned long long current = __get_time();
|
||||
ui7_ctx->delta = (float)((float)current - (float)ui7_ctx->_last) / 1000.f;
|
||||
float current = __get_time();
|
||||
ui7_ctx->delta = (current - ui7_ctx->_last) / 1000.f;
|
||||
ui7_ctx->_last = current;
|
||||
ui7_ctx->time += ui7_ctx->delta;
|
||||
ui7_ctx->cursor = R7Vec2();
|
||||
UI7CtxClearIDs();
|
||||
if (ui7_ctx->debugging) ui7_ctx->objects.clear();
|
||||
}
|
||||
@ -281,7 +296,10 @@ bool Button(const std::string &label, R7Vec2 size) {
|
||||
}
|
||||
RD7Color btn = RD7Color_Button;
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, size), 1));
|
||||
UI7CtxCursorMove(size);
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return false;
|
||||
|
||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
|
||||
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, size)) {
|
||||
@ -298,7 +316,6 @@ bool Button(const std::string &label, R7Vec2 size) {
|
||||
RenderD7::TextColorByBg(btn);
|
||||
RenderD7::Draw2::Text(pos, label);
|
||||
RenderD7::UndoColorEdit(RD7Color_Text);
|
||||
UI7CtxCursorMove(size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -311,8 +328,10 @@ void Checkbox(const std::string &label, bool &c) {
|
||||
RD7Color bg = RD7Color_FrameBg;
|
||||
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
|
||||
UI7CtxCursorMove(inp);
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return;
|
||||
|
||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
|
||||
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, inp)) {
|
||||
@ -338,14 +357,16 @@ void Label(const std::string &label, RD7TextFlags flags) {
|
||||
if (!UI7CtxValidate()) return;
|
||||
R7Vec2 textdim = RenderD7::GetTextDimensions(label);
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
// Remove some y offset cause texts have some offset
|
||||
UI7CtxCursorMove(textdim - R7Vec2(0, 4));
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return;
|
||||
float tbh = RenderD7::TextGetSize() * 40;
|
||||
if (flags & RD7TextFlags_AlignRight) {
|
||||
UI7CtxRegObj(UI7OBJ(R7Vec4(pos - R7Vec2(textdim.x, 0), textdim), 1));
|
||||
} else {
|
||||
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, textdim), 1));
|
||||
}
|
||||
// Remove some y offset cause texts have some offset
|
||||
UI7CtxCursorMove(textdim - R7Vec2(0, 4));
|
||||
RenderD7::TextColorByBg(
|
||||
(pos.y + textdim.y < tbh ? RD7Color_Header : RD7Color_Background));
|
||||
RenderD7::Draw2::Text(pos, label, flags);
|
||||
@ -355,8 +376,10 @@ void Label(const std::string &label, RD7TextFlags flags) {
|
||||
void Progressbar(float value) {
|
||||
if (!UI7CtxValidate()) return;
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
R7Vec2 size = R7Vec2((rd7i_current_screen ? 400 : 320) - (pos.x * 2), 20);
|
||||
UI7CtxCursorMove(size);
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return;
|
||||
|
||||
RenderD7::Draw2::RFS(pos, size, RenderD7::StyleColor(RD7Color_FrameBg));
|
||||
RenderD7::Draw2::RFS(pos + R7Vec2(2, 2), size - R7Vec2(4, 4),
|
||||
@ -370,7 +393,9 @@ void Progressbar(float value) {
|
||||
void Image(RenderD7::Image *img) {
|
||||
if (!UI7CtxValidate()) return;
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
UI7CtxCursorMove(R7Vec2(img->get_size().x, img->get_size().y));
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return;
|
||||
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, img->get_size()), 1));
|
||||
|
||||
RenderD7::Draw2::Image(img, pos);
|
||||
@ -442,8 +467,9 @@ void InputText(const std::string &label, std::string &text,
|
||||
RD7KeyboardState kbd_state; // tmp (goes out of scope)
|
||||
|
||||
R7Vec2 pos = GetCursorPos();
|
||||
|
||||
pos -= R7Vec2(0, ui7_ctx->cm->scrolling_offset);
|
||||
UI7CtxCursorMove(inp);
|
||||
if (pos.y > 240 || pos.y < ui7_ctx->cm->tbh - 5) return;
|
||||
|
||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
|
||||
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, inp)) {
|
||||
@ -464,7 +490,10 @@ void InputText(const std::string &label, std::string &text,
|
||||
|
||||
bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
||||
if (!UI7CtxValidate()) return false;
|
||||
if (UI7CtxInMenu()) return false;
|
||||
auto id = UI7CtxNewID(title);
|
||||
auto ret = UI7CtxBeginMenu(title);
|
||||
if (!ret) return ret;
|
||||
bool titlebar = true;
|
||||
if (size.x == 0) {
|
||||
size.x = rd7i_current_screen ? 400 : 320;
|
||||
@ -474,8 +503,36 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
||||
}
|
||||
RD7TextFlags txtflags = 0;
|
||||
float tbh = RenderD7::TextGetSize() * 40;
|
||||
ui7_ctx->cm->tbh = tbh;
|
||||
|
||||
if (flags & UI7MenuFlags_NoTitlebar) titlebar = false;
|
||||
if (flags & UI7MenuFlags_TitleMid) txtflags = RD7TextFlags_AlignMid;
|
||||
if (flags & UI7MenuFlags_ForceScrolling) ui7_ctx->cm->enable_scrolling = true;
|
||||
if (ui7_ctx->cm->enable_scrolling && !rd7i_current_screen) {
|
||||
if (ui7_ctx->cm->scrolling_offset != 0.f && ui7_ctx->cm->ms.y < 235) {
|
||||
ui7_ctx->cm->scrolling_offset = 0.f;
|
||||
}
|
||||
if (ui7_ctx->cm->scrolling_offset > ui7_ctx->cm->ms.y - 240 &&
|
||||
ui7_ctx->cm->ms.y != 0 && ui7_ctx->cm->ms.y >= 235) {
|
||||
ui7_ctx->cm->scrolling_offset -= 3;
|
||||
}
|
||||
if (ui7_ctx->cm->scrolling_offset < 0) {
|
||||
ui7_ctx->cm->scrolling_offset += 3;
|
||||
if (ui7_ctx->cm->scrolling_offset > 0) ui7_ctx->cm->scrolling_offset = 0;
|
||||
}
|
||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Down)) {
|
||||
ui7_ctx->cm->mdp = RenderD7::Hid::GetTouchPosition();
|
||||
} else if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up)) {
|
||||
ui7_ctx->cm->mdp = R7Vec2();
|
||||
}
|
||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Held)) {
|
||||
auto np = RenderD7::Hid::GetTouchPosition();
|
||||
if (ui7_ctx->cm->scrolling_offset < ui7_ctx->cm->ms.y - 200 &&
|
||||
ui7_ctx->cm->scrolling_offset > -40)
|
||||
ui7_ctx->cm->scrolling_offset += (ui7_ctx->cm->mdp.y - np.y);
|
||||
ui7_ctx->cm->mdp = np;
|
||||
}
|
||||
}
|
||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), size,
|
||||
RenderD7::StyleColor(RD7Color_Background));
|
||||
if (titlebar) {
|
||||
@ -490,7 +547,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
||||
UI7CtxRegObj(UI7OBJ(R7Vec4(R7Vec2(), size), 0));
|
||||
if (titlebar) UI7CtxRegObj(UI7OBJ(R7Vec4(R7Vec2(), R7Vec2(size.x, tbh)), 1));
|
||||
|
||||
return UI7CtxBeginMenu(title);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EndMenu() { UI7CtxEndMenu(); }
|
||||
@ -549,23 +606,27 @@ void EndTree() {
|
||||
|
||||
R7Vec2 GetCursorPos() {
|
||||
if (!UI7CtxValidate()) return R7Vec2();
|
||||
return ui7_ctx->cursor;
|
||||
if (!UI7CtxInMenu()) return R7Vec2();
|
||||
return ui7_ctx->cm->cursor;
|
||||
}
|
||||
|
||||
void SetCursorPos(R7Vec2 cp) {
|
||||
if (!UI7CtxValidate()) return;
|
||||
ui7_ctx->cbackup = ui7_ctx->cursor;
|
||||
ui7_ctx->cursor = cp;
|
||||
if (!UI7CtxInMenu()) return;
|
||||
ui7_ctx->cm->cb = ui7_ctx->cm->cursor;
|
||||
ui7_ctx->cm->cursor = cp;
|
||||
}
|
||||
|
||||
void RestoreCursor() {
|
||||
if (!UI7CtxValidate()) return;
|
||||
ui7_ctx->cursor = ui7_ctx->cbackup;
|
||||
if (!UI7CtxInMenu()) return;
|
||||
ui7_ctx->cm->cursor = ui7_ctx->cm->cb;
|
||||
}
|
||||
|
||||
void SameLine() {
|
||||
if (!UI7CtxValidate()) return;
|
||||
ui7_ctx->cursor = ui7_ctx->slc;
|
||||
if (!UI7CtxInMenu()) return;
|
||||
ui7_ctx->cm->cursor = ui7_ctx->cm->slc;
|
||||
}
|
||||
|
||||
void Debug() {
|
||||
@ -577,6 +638,12 @@ void Debug() {
|
||||
}
|
||||
}
|
||||
|
||||
float GetScrollingOffset() {
|
||||
if (!UI7CtxValidate()) return 0.f;
|
||||
if (!UI7CtxInMenu()) return 0.f;
|
||||
return ui7_ctx->cm->scrolling_offset;
|
||||
}
|
||||
|
||||
bool &IsDebugging() {
|
||||
if (!UI7CtxValidate()) {
|
||||
// Return a Default Val
|
||||
|
@ -214,6 +214,7 @@ static bool rd7i_idb_fp = false;
|
||||
|
||||
void KillIdbServer() {
|
||||
rd7i_idb_fp = true;
|
||||
rd7i_idb_server.join(100);
|
||||
socExit();
|
||||
}
|
||||
|
||||
|
@ -522,12 +522,10 @@ void RenderD7::RSettings::Draw(void) const {
|
||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||
UI7::RestoreCursor();
|
||||
|
||||
std::string verc = "Config Version: ";
|
||||
verc += CFGVER;
|
||||
UI7::Label(verc);
|
||||
UI7::Label("Metrik Overlay: " + mtovlstate);
|
||||
UI7::Label("Metrik Screen: " + mtscreenstate);
|
||||
UI7::Label("Config Version: " + std::string(CFGVER));
|
||||
UI7::Label("App: " + rd7i_app_name);
|
||||
UI7::Label("RenderD7: " + std::string(RENDERD7VSTRING));
|
||||
UI7::Label("Citra: " + std::string(rd7i_is_citra ? "true" : "false"));
|
||||
UI7::Label("Current: " + std::to_string(RenderD7::Memory::GetCurrent()) +
|
||||
"b");
|
||||
UI7::Label("Delta: " + std::to_string(RenderD7::GetDeltaTime()));
|
||||
@ -584,35 +582,6 @@ void RenderD7::RSettings::Draw(void) const {
|
||||
UI7::EndMenu();
|
||||
}
|
||||
|
||||
} else if (m_state == RINFO) {
|
||||
std::string rd7ver = RENDERD7VSTRING;
|
||||
std::string rd7cfgver = CFGVER;
|
||||
std::string citras = rd7i_is_citra ? "true" : "false";
|
||||
std::string buildtime = V_RD7BTIME;
|
||||
std::string commit = V_RD7CSTRING;
|
||||
RenderD7::OnScreen(Top);
|
||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 240),
|
||||
RenderD7::StyleColor(RD7Color_Background));
|
||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
|
||||
RenderD7::StyleColor(RD7Color_Header));
|
||||
RenderD7::TextColorByBg(RD7Color_Header);
|
||||
RenderD7::Draw2::Text(R7Vec2(5, 2), "RenderD7 -> Info");
|
||||
RenderD7::Draw2::Text(R7Vec2(395, 2), RENDERD7VSTRING,
|
||||
RD7TextFlags_AlignRight);
|
||||
RenderD7::UndoColorEdit(RD7Color_Text);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 30), "App: " + rd7i_app_name);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 45), "RenderD7: " + rd7ver);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 60), "Config-Version: " + rd7cfgver);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 75), "Citra: " + citras);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 90), "RenderD7-Build-Time: \n" + buildtime);
|
||||
RenderD7::Draw2::Text(R7Vec2(0, 120), "RenderD7-Commit: " + commit);
|
||||
RenderD7::Draw2::Text(
|
||||
R7Vec2(0, 135),
|
||||
"RenderD7-Overlays: " + std::to_string(rd7i_overlays.size()));
|
||||
RenderD7::OnScreen(Bottom);
|
||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(320, 240),
|
||||
RenderD7::StyleColor(RD7Color_Background));
|
||||
RenderD7::Draw2::Text(R7Vec2(5, 2), "Press \uE001 to go back!");
|
||||
} else if (m_state == RFTRACE) {
|
||||
RenderD7::OnScreen(Top);
|
||||
RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 240),
|
||||
@ -705,7 +674,7 @@ void RenderD7::RSettings::Draw(void) const {
|
||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||
UI7::RestoreCursor();
|
||||
UI7::Label("Time: " + std::to_string(UI7::GetTime()));
|
||||
UI7::Label("Delta: " + std::to_string(UI7::GetDeltaTime()));
|
||||
UI7::Label("Delta: " + std::to_string(UI7::GetDeltaTime() * 1000.f));
|
||||
UI7::Label("Hid Down Touch: " +
|
||||
std::to_string(Hid::IsEvent("touch", Hid::Down)));
|
||||
UI7::Label("Hid Held Touch: " +
|
||||
@ -722,7 +691,13 @@ void RenderD7::RSettings::Draw(void) const {
|
||||
}
|
||||
|
||||
RenderD7::OnScreen(Bottom);
|
||||
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
||||
if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(),
|
||||
UI7MenuFlags_ForceScrolling)) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
UI7::Label("Line: " + std::to_string(i));
|
||||
}
|
||||
UI7::Label("Scrolling Offset: " +
|
||||
std::to_string(UI7::GetScrollingOffset()));
|
||||
if (UI7::Button("Go back")) {
|
||||
/// Request a state switch to state RSETTINGS
|
||||
shared_request[0x00000001] = RSETTINGS;
|
||||
@ -732,10 +707,12 @@ void RenderD7::RSettings::Draw(void) const {
|
||||
}
|
||||
} else if (m_state == ROVERLAYS) {
|
||||
RenderD7::OnScreen(Top);
|
||||
if (UI7::BeginMenu("RenderD7 -> Metrik")) {
|
||||
if (UI7::BeginMenu("RenderD7 -> Overlays")) {
|
||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||
UI7::RestoreCursor();
|
||||
UI7::Label("Metrik Overlay: " + mtovlstate);
|
||||
UI7::Label("Metrik Screen: " + mtscreenstate);
|
||||
UI7::EndMenu();
|
||||
}
|
||||
|
||||
@ -792,8 +769,6 @@ void RenderD7::RSettings::Logic() {
|
||||
stateftold = rd7i_ftraced;
|
||||
|
||||
if (m_state == RSETTINGS) {
|
||||
mtovlstate = rd7i_metrikd ? "true" : "false";
|
||||
mtscreenstate = rd7i_mt_screen ? "Bottom" : "Top";
|
||||
if (d7_hDown & KEY_B) {
|
||||
std::fstream cfg_wrt(rd7i_config_path + "/config.rc7", std::ios::out);
|
||||
rd7i_config["metrik-settings"]["enableoverlay"] = rd7i_metrikd;
|
||||
@ -805,17 +780,14 @@ void RenderD7::RSettings::Logic() {
|
||||
RenderD7::Scene::Back();
|
||||
}
|
||||
}
|
||||
if (m_state == RINFO) {
|
||||
if (d7_hDown & KEY_B) {
|
||||
m_state = RSETTINGS;
|
||||
}
|
||||
}
|
||||
if (m_state == RUI7) {
|
||||
if (d7_hDown & KEY_B) {
|
||||
m_state = RSETTINGS;
|
||||
}
|
||||
}
|
||||
if (m_state == ROVERLAYS) {
|
||||
mtovlstate = rd7i_metrikd ? "true" : "false";
|
||||
mtscreenstate = rd7i_mt_screen ? "Bottom" : "Top";
|
||||
if (d7_hDown & KEY_B) {
|
||||
m_state = RSETTINGS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user