Render2 Static Class
This commit is contained in:
parent
1c4917fab4
commit
ed188b7303
@ -29,7 +29,7 @@ enum R2Screen {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace RenderD7 {
|
namespace RenderD7 {
|
||||||
class R2Base {
|
class R2 {
|
||||||
public:
|
public:
|
||||||
struct R2Cmd {
|
struct R2Cmd {
|
||||||
R7Vec2 pos; //< Position
|
R7Vec2 pos; //< Position
|
||||||
@ -48,48 +48,50 @@ class R2Base {
|
|||||||
std::string text; // Text
|
std::string text; // Text
|
||||||
RD7_SMART_CTOR(R2Cmd)
|
RD7_SMART_CTOR(R2Cmd)
|
||||||
};
|
};
|
||||||
R2Base();
|
R2() = default;
|
||||||
~R2Base() = default;
|
~R2() = default;
|
||||||
RD7_SMART_CTOR(R2Base)
|
|
||||||
|
static void Init();
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
void SetFont(Font::Ref fnt);
|
static void SetFont(Font::Ref fnt);
|
||||||
Font::Ref GetFont();
|
static Font::Ref GetFont();
|
||||||
void DefaultFont();
|
static void DefaultFont();
|
||||||
void DrawNextLined();
|
static void DrawNextLined();
|
||||||
void OnScreen(R2Screen screen);
|
static void OnScreen(R2Screen screen);
|
||||||
R2Screen GetCurrentScreen();
|
static R2Screen GetCurrentScreen();
|
||||||
void SetTextSize(float szs);
|
static void SetTextSize(float szs);
|
||||||
void DefaultTextSize();
|
static void DefaultTextSize();
|
||||||
float GetTextSize();
|
static float GetTextSize();
|
||||||
R7Vec2 GetCurrentScreenSize();
|
static R7Vec2 GetCurrentScreenSize();
|
||||||
// Processing
|
// Processing
|
||||||
void Process();
|
static void Process();
|
||||||
R7Vec2 GetTextDimensions(const std::string& text);
|
static R7Vec2 GetTextDimensions(const std::string& text);
|
||||||
std::string WrapText(const std ::string& in, int maxlen);
|
static std::string WrapText(const std ::string& in, int maxlen);
|
||||||
std::string ShortText(const std::string& in, int maxlen);
|
static std::string ShortText(const std::string& in, int maxlen);
|
||||||
// Draw Functions
|
// Draw Functions
|
||||||
void AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr);
|
static void AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr);
|
||||||
void AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr);
|
static void AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr);
|
||||||
void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr);
|
static void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr);
|
||||||
void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, unsigned int clr);
|
static void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
||||||
void AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
|
unsigned int clr);
|
||||||
|
static void AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
|
||||||
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
|
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
|
||||||
void AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
|
static void AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
|
||||||
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
|
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
|
||||||
void AddImage(R7Vec2 pos, Image::Ref img);
|
static void AddImage(R7Vec2 pos, Image::Ref img);
|
||||||
void AddSprite(Sprite::Ref spr);
|
static void AddSprite(Sprite::Ref spr);
|
||||||
void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t = 1);
|
static void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t = 1);
|
||||||
void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t = 1);
|
static void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t = 1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const float default_text_size = 0.5f;
|
static const float default_text_size;
|
||||||
float text_size = 0.5;
|
static float text_size;
|
||||||
Font::Ref font;
|
static Font::Ref font;
|
||||||
std::map<std::string, float> ts;
|
static std::map<std::string, float> ts;
|
||||||
std::map<std::string, int> mln;
|
static std::map<std::string, int> mln;
|
||||||
bool next_lined = false;
|
static bool next_lined;
|
||||||
std::vector<R2Cmd::Ref> commands;
|
static std::vector<R2Cmd::Ref> commands;
|
||||||
R2Screen current_screen = R2Screen_Bottom;
|
static R2Screen current_screen;
|
||||||
};
|
};
|
||||||
} // namespace RenderD7
|
} // namespace RenderD7
|
0
source/LI7.cpp
Normal file
0
source/LI7.cpp
Normal file
@ -26,10 +26,10 @@ namespace RenderD7 {
|
|||||||
float GetDeltaTime(); // Extern from renderd7.cpp
|
float GetDeltaTime(); // Extern from renderd7.cpp
|
||||||
|
|
||||||
void ProcessMessages() {
|
void ProcessMessages() {
|
||||||
float tmp_txt = R2()->GetTextSize();
|
float tmp_txt = R2::GetTextSize();
|
||||||
R2()->DefaultTextSize();
|
R2::DefaultTextSize();
|
||||||
// Draw in ovl mode
|
// Draw in ovl mode
|
||||||
R2()->OnScreen(R2Screen_Top);
|
R2::OnScreen(R2Screen_Top);
|
||||||
float fol = anim_len - fade_outs;
|
float fol = anim_len - fade_outs;
|
||||||
std::reverse(msg_lst.begin(), msg_lst.end());
|
std::reverse(msg_lst.begin(), msg_lst.end());
|
||||||
for (size_t i = 0; i < msg_lst.size(); i++) {
|
for (size_t i = 0; i < msg_lst.size(); i++) {
|
||||||
@ -51,11 +51,11 @@ void ProcessMessages() {
|
|||||||
.toRGBA();
|
.toRGBA();
|
||||||
auto tc =
|
auto tc =
|
||||||
RenderD7::Color::RGBA(RD7Color_Text2).changeA(new_alpha).toRGBA();
|
RenderD7::Color::RGBA(RD7Color_Text2).changeA(new_alpha).toRGBA();
|
||||||
R2()->AddRect(pos, R7Vec2(150, 50), bgc);
|
R2::AddRect(pos, R7Vec2(150, 50), bgc);
|
||||||
R2()->AddText(pos + R7Vec2(5, 1), msg_lst[i]->title, tc);
|
R2::AddText(pos + R7Vec2(5, 1), msg_lst[i]->title, tc);
|
||||||
R2()->AddText(pos + R7Vec2(5, 17), msg_lst[i]->message, tc);
|
R2::AddText(pos + R7Vec2(5, 17), msg_lst[i]->message, tc);
|
||||||
if (rd7i_debugging)
|
if (rd7i_debugging)
|
||||||
R2()->AddText(pos + R7Vec2(155, 1),
|
R2::AddText(pos + R7Vec2(155, 1),
|
||||||
std::to_string(msg_lst[i]->animationframe), tc);
|
std::to_string(msg_lst[i]->animationframe), tc);
|
||||||
// Why Frameadd? because Message uses int as frame and
|
// Why Frameadd? because Message uses int as frame and
|
||||||
// It seems that lower 0.5 will be rounded to 0
|
// It seems that lower 0.5 will be rounded to 0
|
||||||
@ -78,7 +78,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());
|
||||||
R2()->SetTextSize(tmp_txt);
|
R2::SetTextSize(tmp_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushMessage(const Message &msg) {
|
void PushMessage(const Message &msg) {
|
||||||
|
@ -267,22 +267,22 @@ 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 = R2()->GetTextSize();
|
float tmp_txt = R2::GetTextSize();
|
||||||
R2()->DefaultTextSize();
|
R2::DefaultTextSize();
|
||||||
R2()->OnScreen(R2Screen_Top);
|
R2::OnScreen(R2Screen_Top);
|
||||||
RenderD7::Color::RGBA bg(RD7Color_Background);
|
RenderD7::Color::RGBA bg(RD7Color_Background);
|
||||||
bg.changeA(150);
|
bg.changeA(150);
|
||||||
R2()->AddRect(R7Vec2(0, 0), R7Vec2(400, 20), bg.toRGBA());
|
R2::AddRect(R7Vec2(0, 0), R7Vec2(400, 20), bg.toRGBA());
|
||||||
|
|
||||||
std::vector<RenderD7::Ftrace::FTRes> dt;
|
std::vector<RenderD7::Ftrace::FTRes> dt;
|
||||||
for (auto const& it : RenderD7::Ftrace::rd7_traces)
|
for (auto const& it : RenderD7::Ftrace::rd7_traces)
|
||||||
if (it.second.is_ovl && dt.size() < 10) dt.push_back(it.second);
|
if (it.second.is_ovl && dt.size() < 10) dt.push_back(it.second);
|
||||||
for (size_t i = 0; i < (dt.size() < 10 ? dt.size() : 10); i++) {
|
for (size_t i = 0; i < (dt.size() < 10 ? dt.size() : 10); i++) {
|
||||||
R2()->AddText(R7Vec2(5, 30 + i * 15), dt[i].func_name, RD7Color_Text);
|
R2::AddText(R7Vec2(5, 30 + i * 15), dt[i].func_name, RD7Color_Text);
|
||||||
R2()->AddText(R7Vec2(295, 30 + i * 15), RenderD7::MsTimeFmt(dt[i].time_of),
|
R2::AddText(R7Vec2(295, 30 + i * 15), RenderD7::MsTimeFmt(dt[i].time_of),
|
||||||
RD7Color_Text);
|
RD7Color_Text);
|
||||||
}
|
}
|
||||||
R2()->SetTextSize(tmp_txt);
|
R2::SetTextSize(tmp_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ovl_Ftrace::Logic() {
|
void Ovl_Ftrace::Logic() {
|
||||||
@ -299,12 +299,12 @@ Ovl_Metrik::Ovl_Metrik(bool* is_enabled, bool* screen, uint32_t* mt_color,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Ovl_Metrik::Draw(void) const {
|
void Ovl_Metrik::Draw(void) const {
|
||||||
float tmp_txt = R2()->GetTextSize();
|
float tmp_txt = R2::GetTextSize();
|
||||||
R2()->DefaultTextSize();
|
R2::DefaultTextSize();
|
||||||
R2()->OnScreen(i_screen[0] ? R2Screen_Bottom : R2Screen_Top);
|
R2::OnScreen(i_screen[0] ? R2Screen_Bottom : R2Screen_Top);
|
||||||
std::string info =
|
std::string info =
|
||||||
"RenderD7 " + std::string(RENDERD7VSTRING) + " Debug Overlay";
|
"RenderD7 " + std::string(RENDERD7VSTRING) + " Debug Overlay";
|
||||||
float dim_y = R2()->GetTextDimensions(info).y;
|
float dim_y = R2::GetTextDimensions(info).y;
|
||||||
float infoy = 240 - dim_y;
|
float infoy = 240 - dim_y;
|
||||||
mt_fps = "FPS: " + RenderD7::GetFramerate();
|
mt_fps = "FPS: " + RenderD7::GetFramerate();
|
||||||
if (rd7i_idb_running) mt_fps += " IDB -> ON";
|
if (rd7i_idb_running) mt_fps += " IDB -> ON";
|
||||||
@ -328,49 +328,49 @@ void Ovl_Metrik::Draw(void) const {
|
|||||||
" | " +
|
" | " +
|
||||||
RenderD7::FormatBytes(RenderD7::Memory::GetTotalAllocated()) +
|
RenderD7::FormatBytes(RenderD7::Memory::GetTotalAllocated()) +
|
||||||
" | " + RenderD7::FormatBytes(RenderD7::Memory::GetTotalFreed());
|
" | " + RenderD7::FormatBytes(RenderD7::Memory::GetTotalFreed());
|
||||||
R2()->AddRect(R7Vec2(0, 0), R2()->GetTextDimensions(mt_fps),
|
R2::AddRect(R7Vec2(0, 0), R2::GetTextDimensions(mt_fps),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, 50), R2()->GetTextDimensions(mt_cpu),
|
R2::AddRect(R7Vec2(0, 50), R2::GetTextDimensions(mt_cpu),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, 50 + dim_y * 1), R2()->GetTextDimensions(mt_gpu),
|
R2::AddRect(R7Vec2(0, 50 + dim_y * 1), R2::GetTextDimensions(mt_gpu),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, 50 + dim_y * 2), R2()->GetTextDimensions(mt_cmd),
|
R2::AddRect(R7Vec2(0, 50 + dim_y * 2), R2::GetTextDimensions(mt_cmd),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, 50 + dim_y * 3), R2()->GetTextDimensions(mt_lfr),
|
R2::AddRect(R7Vec2(0, 50 + dim_y * 3), R2::GetTextDimensions(mt_lfr),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, 50 + dim_y * 4), R2()->GetTextDimensions(mt_tbs),
|
R2::AddRect(R7Vec2(0, 50 + dim_y * 4), R2::GetTextDimensions(mt_tbs),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
if (rd7i_enable_memtrack)
|
if (rd7i_enable_memtrack)
|
||||||
R2()->AddRect(R7Vec2(0, 50 + dim_y * 5), R2()->GetTextDimensions(mt_mem),
|
R2::AddRect(R7Vec2(0, 50 + dim_y * 5), R2::GetTextDimensions(mt_mem),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddRect(R7Vec2(0, infoy), R2()->GetTextDimensions(info),
|
R2::AddRect(R7Vec2(0, infoy), R2::GetTextDimensions(info),
|
||||||
(unsigned int)i_mt_color[0]);
|
(unsigned int)i_mt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 0), mt_fps, (unsigned int)i_txt_color[0]);
|
R2::AddText(R7Vec2(0, 0), mt_fps, (unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 50), mt_cpu, (unsigned int)i_txt_color[0]);
|
R2::AddText(R7Vec2(0, 50), mt_cpu, (unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 50 + dim_y * 1), mt_gpu,
|
R2::AddText(R7Vec2(0, 50 + dim_y * 1), mt_gpu,
|
||||||
(unsigned int)i_txt_color[0]);
|
(unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 50 + dim_y * 2), mt_cmd,
|
R2::AddText(R7Vec2(0, 50 + dim_y * 2), mt_cmd,
|
||||||
(unsigned int)i_txt_color[0]);
|
(unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 50 + dim_y * 3), mt_lfr,
|
R2::AddText(R7Vec2(0, 50 + dim_y * 3), mt_lfr,
|
||||||
(unsigned int)i_txt_color[0]);
|
(unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, 50 + dim_y * 4), mt_tbs,
|
R2::AddText(R7Vec2(0, 50 + dim_y * 4), mt_tbs,
|
||||||
(unsigned int)i_txt_color[0]);
|
(unsigned int)i_txt_color[0]);
|
||||||
if (rd7i_enable_memtrack)
|
if (rd7i_enable_memtrack)
|
||||||
R2()->AddText(R7Vec2(0, 50 + dim_y * 5), mt_mem,
|
R2::AddText(R7Vec2(0, 50 + dim_y * 5), mt_mem,
|
||||||
(unsigned int)i_txt_color[0]);
|
(unsigned int)i_txt_color[0]);
|
||||||
R2()->AddText(R7Vec2(0, infoy), info, (unsigned int)i_txt_color[0]);
|
R2::AddText(R7Vec2(0, infoy), info, (unsigned int)i_txt_color[0]);
|
||||||
|
|
||||||
// Force Bottom (Debug Touchpos)
|
// Force Bottom (Debug Touchpos)
|
||||||
R2()->OnScreen(R2Screen_Bottom);
|
R2::OnScreen(R2Screen_Bottom);
|
||||||
if (Hid::IsEvent("touch", Hid::Held)) {
|
if (Hid::IsEvent("touch", Hid::Held)) {
|
||||||
R2()->AddLine(R7Vec2(Hid::GetTouchPosition().x, 0),
|
R2::AddLine(R7Vec2(Hid::GetTouchPosition().x, 0),
|
||||||
R7Vec2(Hid::GetTouchPosition().x, 240),
|
R7Vec2(Hid::GetTouchPosition().x, 240),
|
||||||
RenderD7::Color::Hex("#ff0000"));
|
RenderD7::Color::Hex("#ff0000"));
|
||||||
R2()->AddLine(R7Vec2(0, Hid::GetTouchPosition().y),
|
R2::AddLine(R7Vec2(0, Hid::GetTouchPosition().y),
|
||||||
R7Vec2(320, Hid::GetTouchPosition().y),
|
R7Vec2(320, Hid::GetTouchPosition().y),
|
||||||
RenderD7::Color::Hex("#ff0000"));
|
RenderD7::Color::Hex("#ff0000"));
|
||||||
}
|
}
|
||||||
R2()->SetTextSize(tmp_txt);
|
R2::SetTextSize(tmp_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ovl_Metrik::Logic() {
|
void Ovl_Metrik::Logic() {
|
||||||
@ -396,8 +396,8 @@ Ovl_Keyboard::~Ovl_Keyboard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Ovl_Keyboard::Draw(void) const {
|
void Ovl_Keyboard::Draw(void) const {
|
||||||
float tmp_txt = R2()->GetTextSize();
|
float tmp_txt = R2::GetTextSize();
|
||||||
R2()->DefaultTextSize();
|
R2::DefaultTextSize();
|
||||||
if (ft3 > 5) RenderD7::Hid::Unlock();
|
if (ft3 > 5) RenderD7::Hid::Unlock();
|
||||||
auto key_table =
|
auto key_table =
|
||||||
(type == RD7Keyboard_Numpad) ? keyboard_layout_num : keyboard_layout;
|
(type == RD7Keyboard_Numpad) ? keyboard_layout_num : keyboard_layout;
|
||||||
@ -405,20 +405,20 @@ void Ovl_Keyboard::Draw(void) const {
|
|||||||
key_table = keyboard_layout_caps;
|
key_table = keyboard_layout_caps;
|
||||||
else if (mode == 2)
|
else if (mode == 2)
|
||||||
key_table = keyboard_layout_shift;
|
key_table = keyboard_layout_shift;
|
||||||
R2()->OnScreen(R2Screen_Top);
|
R2::OnScreen(R2Screen_Top);
|
||||||
R2()->AddRect(R7Vec2(0, 0), R7Vec2(400, 240),
|
R2::AddRect(R7Vec2(0, 0), R7Vec2(400, 240),
|
||||||
RenderD7::Color::RGBA(RD7Color_FrameBg).changeA(150).toRGBA());
|
RenderD7::Color::RGBA(RD7Color_FrameBg).changeA(150).toRGBA());
|
||||||
R2()->OnScreen(R2Screen_Bottom);
|
R2::OnScreen(R2Screen_Bottom);
|
||||||
R2()->AddRect(R7Vec2(0, 0), R7Vec2(320, 112),
|
R2::AddRect(R7Vec2(0, 0), R7Vec2(320, 112),
|
||||||
RenderD7::Color::RGBA(RD7Color_FrameBg).changeA(150).toRGBA());
|
RenderD7::Color::RGBA(RD7Color_FrameBg).changeA(150).toRGBA());
|
||||||
R2()->AddRect(R7Vec2(0, 112), R7Vec2(320, 128), RD7Color_FrameBg);
|
R2::AddRect(R7Vec2(0, 112), R7Vec2(320, 128), RD7Color_FrameBg);
|
||||||
R2()->AddRect(R7Vec2(0, 112), R7Vec2(320, 20), RD7Color_Header);
|
R2::AddRect(R7Vec2(0, 112), R7Vec2(320, 20), RD7Color_Header);
|
||||||
R2()->AddText(R7Vec2(5, 114), "> " + *typed_text,
|
R2::AddText(R7Vec2(5, 114), "> " + *typed_text,
|
||||||
RenderD7::ThemeActive()->AutoText(RD7Color_Header));
|
RenderD7::ThemeActive()->AutoText(RD7Color_Header));
|
||||||
for (auto const& it : key_table) {
|
for (auto const& it : key_table) {
|
||||||
R7Vec2 szs = it.size;
|
R7Vec2 szs = it.size;
|
||||||
R7Vec2 pos = it.pos;
|
R7Vec2 pos = it.pos;
|
||||||
R7Vec2 txtdim = R2()->GetTextDimensions(it.disp);
|
R7Vec2 txtdim = R2::GetTextDimensions(it.disp);
|
||||||
RD7Color btn = RD7Color_Button;
|
RD7Color btn = RD7Color_Button;
|
||||||
if (RenderD7::Hid::IsEvent("cancel", RenderD7::Hid::Up)) {
|
if (RenderD7::Hid::IsEvent("cancel", RenderD7::Hid::Up)) {
|
||||||
RenderD7::Hid::Clear();
|
RenderD7::Hid::Clear();
|
||||||
@ -455,11 +455,11 @@ void Ovl_Keyboard::Draw(void) const {
|
|||||||
}
|
}
|
||||||
R7Vec2 txtpos = R7Vec2(pos.x + szs.x * 0.5 - txtdim.x * 0.5,
|
R7Vec2 txtpos = R7Vec2(pos.x + szs.x * 0.5 - txtdim.x * 0.5,
|
||||||
pos.y + szs.y * 0.5 - txtdim.y * 0.5);
|
pos.y + szs.y * 0.5 - txtdim.y * 0.5);
|
||||||
R2()->AddRect(pos, szs, btn);
|
R2::AddRect(pos, szs, btn);
|
||||||
R2()->AddText(txtpos, it.disp, RenderD7::ThemeActive()->AutoText(btn));
|
R2::AddText(txtpos, it.disp, RenderD7::ThemeActive()->AutoText(btn));
|
||||||
}
|
}
|
||||||
if (ft3 > 5) RenderD7::Hid::Lock();
|
if (ft3 > 5) RenderD7::Hid::Lock();
|
||||||
R2()->SetTextSize(tmp_txt);
|
R2::SetTextSize(tmp_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ovl_Keyboard::Logic() {
|
void Ovl_Keyboard::Logic() {
|
||||||
|
@ -4,42 +4,51 @@
|
|||||||
#include <renderd7/internal_db.hpp>
|
#include <renderd7/internal_db.hpp>
|
||||||
|
|
||||||
namespace RenderD7 {
|
namespace RenderD7 {
|
||||||
R2Base::R2Base() { this->font = Font::New(); }
|
const float R2::default_text_size = 0.5f;
|
||||||
|
float R2::text_size = 0.5;
|
||||||
|
Font::Ref R2::font;
|
||||||
|
std::map<std::string, float> R2::ts;
|
||||||
|
std::map<std::string, int> R2::mln;
|
||||||
|
bool R2::next_lined = false;
|
||||||
|
std::vector<R2::R2Cmd::Ref> R2::commands;
|
||||||
|
R2Screen R2::current_screen = R2Screen_Bottom;
|
||||||
|
|
||||||
void R2Base::SetFont(Font::Ref fnt) {
|
void R2::Init() { R2::font = Font::New(); }
|
||||||
|
|
||||||
|
void R2::SetFont(Font::Ref fnt) {
|
||||||
if (!fnt) return;
|
if (!fnt) return;
|
||||||
this->font = fnt;
|
R2::font = fnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Ref R2Base::GetFont() { return this->font; }
|
Font::Ref R2::GetFont() { return R2::font; }
|
||||||
|
|
||||||
void R2Base::DefaultFont() { this->font->Unload(); }
|
void R2::DefaultFont() { R2::font->Unload(); }
|
||||||
|
|
||||||
void R2Base::DrawNextLined() { this->next_lined = true; }
|
void R2::DrawNextLined() { R2::next_lined = true; }
|
||||||
|
|
||||||
void R2Base::OnScreen(R2Screen screen) {
|
void R2::OnScreen(R2Screen screen) {
|
||||||
if (screen < 0 || screen > R2Screen_Top) return;
|
if (screen < 0 || screen > R2Screen_Top) return;
|
||||||
this->current_screen = screen;
|
R2::current_screen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::SetTextSize(float szs) { text_size = szs; }
|
void R2::SetTextSize(float szs) { text_size = szs; }
|
||||||
|
|
||||||
void R2Base::DefaultTextSize() { text_size = default_text_size; }
|
void R2::DefaultTextSize() { text_size = R2::default_text_size; }
|
||||||
|
|
||||||
float R2Base::GetTextSize() { return text_size; }
|
float R2::GetTextSize() { return text_size; }
|
||||||
|
|
||||||
R2Screen R2Base::GetCurrentScreen() { return current_screen; }
|
R2Screen R2::GetCurrentScreen() { return current_screen; }
|
||||||
|
|
||||||
R7Vec2 R2Base::GetTextDimensions(const std::string& text) {
|
R7Vec2 R2::GetTextDimensions(const std::string& text) {
|
||||||
C2D_TextBufClear(rd7i_d2_dimbuf);
|
C2D_TextBufClear(rd7i_d2_dimbuf);
|
||||||
float w = 0, h = 0;
|
float w = 0, h = 0;
|
||||||
C2D_Text c2dtext;
|
C2D_Text c2dtext;
|
||||||
C2D_TextFontParse(&c2dtext, font->Ptr(), rd7i_d2_dimbuf, text.c_str());
|
C2D_TextFontParse(&c2dtext, font->Ptr(), rd7i_d2_dimbuf, text.c_str());
|
||||||
C2D_TextGetDimensions(&c2dtext, this->text_size, this->text_size, &w, &h);
|
C2D_TextGetDimensions(&c2dtext, R2::text_size, R2::text_size, &w, &h);
|
||||||
return R7Vec2(w, h);
|
return R7Vec2(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string R2Base::WrapText(const std ::string& in, int maxlen) {
|
std::string R2::WrapText(const std ::string& in, int maxlen) {
|
||||||
std::string out;
|
std::string out;
|
||||||
std::string line;
|
std::string line;
|
||||||
int line_x = 0;
|
int line_x = 0;
|
||||||
@ -47,7 +56,7 @@ std::string R2Base::WrapText(const std ::string& in, int maxlen) {
|
|||||||
std::string temp;
|
std::string temp;
|
||||||
|
|
||||||
while (istream >> temp) {
|
while (istream >> temp) {
|
||||||
R7Vec2 dim = this->GetTextDimensions(line + temp);
|
R7Vec2 dim = R2::GetTextDimensions(line + temp);
|
||||||
if (line_x + dim.x <= maxlen) {
|
if (line_x + dim.x <= maxlen) {
|
||||||
line += temp + ' ';
|
line += temp + ' ';
|
||||||
line_x += dim.x;
|
line_x += dim.x;
|
||||||
@ -61,8 +70,8 @@ std::string R2Base::WrapText(const std ::string& in, int maxlen) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string R2Base::ShortText(const std::string& in, int maxlen) {
|
std::string R2::ShortText(const std::string& in, int maxlen) {
|
||||||
auto textdim = this->GetTextDimensions(in);
|
auto textdim = R2::GetTextDimensions(in);
|
||||||
if (textdim.x < (float)maxlen) return in;
|
if (textdim.x < (float)maxlen) return in;
|
||||||
std::string ft = "";
|
std::string ft = "";
|
||||||
std::string worker = in;
|
std::string worker = in;
|
||||||
@ -71,7 +80,7 @@ std::string R2Base::ShortText(const std::string& in, int maxlen) {
|
|||||||
worker = in.substr(0, in.find_last_of('.'));
|
worker = in.substr(0, in.find_last_of('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
maxlen -= this->GetTextDimensions(ft).x - this->GetTextDimensions("(...)").x;
|
maxlen -= R2::GetTextDimensions(ft).x - R2::GetTextDimensions("(...)").x;
|
||||||
float len_mod = (float)maxlen / textdim.x;
|
float len_mod = (float)maxlen / textdim.x;
|
||||||
int pos = (in.length() * len_mod) / rd7_draw2_tsm;
|
int pos = (in.length() * len_mod) / rd7_draw2_tsm;
|
||||||
std::string out;
|
std::string out;
|
||||||
@ -80,7 +89,7 @@ std::string R2Base::ShortText(const std::string& in, int maxlen) {
|
|||||||
|
|
||||||
for (size_t i = pos; i < worker.length(); i++) {
|
for (size_t i = pos; i < worker.length(); i++) {
|
||||||
out += worker[i];
|
out += worker[i];
|
||||||
if (this->GetTextDimensions(out + "(...)" + ft).x > (float)maxlen) {
|
if (R2::GetTextDimensions(out + "(...)" + ft).x > (float)maxlen) {
|
||||||
out += "(...)";
|
out += "(...)";
|
||||||
out += ft;
|
out += ft;
|
||||||
return out;
|
return out;
|
||||||
@ -89,13 +98,13 @@ std::string R2Base::ShortText(const std::string& in, int maxlen) {
|
|||||||
return out; // Impossible to reach
|
return out; // Impossible to reach
|
||||||
}
|
}
|
||||||
|
|
||||||
R7Vec2 R2Base::GetCurrentScreenSize() {
|
R7Vec2 R2::GetCurrentScreenSize() {
|
||||||
return R7Vec2(this->current_screen == R2Screen_Bottom ? 320 : 400, 240);
|
return R7Vec2(R2::current_screen == R2Screen_Bottom ? 320 : 400, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Processing of Draw Calls
|
// Main Processing of Draw Calls
|
||||||
void R2Base::Process() {
|
void R2::Process() {
|
||||||
for (auto& it : this->commands) {
|
for (auto& it : R2::commands) {
|
||||||
if (it->type <= 0 || it->type > 6) {
|
if (it->type <= 0 || it->type > 6) {
|
||||||
// Skip
|
// Skip
|
||||||
continue;
|
continue;
|
||||||
@ -153,10 +162,10 @@ void R2Base::Process() {
|
|||||||
while (edit_text.find('\n') != edit_text.npos) {
|
while (edit_text.find('\n') != edit_text.npos) {
|
||||||
std::string current_line = edit_text.substr(0, edit_text.find('\n'));
|
std::string current_line = edit_text.substr(0, edit_text.find('\n'));
|
||||||
if (it->flags & RD7TextFlags_Short)
|
if (it->flags & RD7TextFlags_Short)
|
||||||
current_line = this->ShortText(current_line, it->pszs.x - it->pos.x);
|
current_line = R2::ShortText(current_line, it->pszs.x - it->pos.x);
|
||||||
R7Vec2 newpos = it->pos;
|
R7Vec2 newpos = it->pos;
|
||||||
// Check Flags
|
// Check Flags
|
||||||
R7Vec2 dim = this->GetTextDimensions(current_line);
|
R7Vec2 dim = R2::GetTextDimensions(current_line);
|
||||||
if (it->flags & RD7TextFlags_AlignRight) newpos.x = newpos.x - dim.x;
|
if (it->flags & RD7TextFlags_AlignRight) newpos.x = newpos.x - dim.x;
|
||||||
if (it->flags & RD7TextFlags_AlignMid) // Offset by inpos
|
if (it->flags & RD7TextFlags_AlignMid) // Offset by inpos
|
||||||
newpos.x = (it->pszs.x * 0.5) - (dim.x * 0.5) + it->pos.x;
|
newpos.x = (it->pszs.x * 0.5) - (dim.x * 0.5) + it->pos.x;
|
||||||
@ -165,8 +174,8 @@ void R2Base::Process() {
|
|||||||
// TODO: Create Code for this
|
// TODO: Create Code for this
|
||||||
}
|
}
|
||||||
if (rd7i_debugging) {
|
if (rd7i_debugging) {
|
||||||
this->DrawNextLined();
|
R2::DrawNextLined();
|
||||||
this->AddRect(newpos, dim, 0xff0000ff);
|
R2::AddRect(newpos, dim, 0xff0000ff);
|
||||||
}
|
}
|
||||||
C2D_Text c2dtext;
|
C2D_Text c2dtext;
|
||||||
C2D_TextFontParse(&c2dtext, font->Ptr(), rd7i_text_buffer,
|
C2D_TextFontParse(&c2dtext, font->Ptr(), rd7i_text_buffer,
|
||||||
@ -175,12 +184,12 @@ void R2Base::Process() {
|
|||||||
|
|
||||||
if (it->flags & RD7TextFlags_Shaddow) // performance Killer xd
|
if (it->flags & RD7TextFlags_Shaddow) // performance Killer xd
|
||||||
C2D_DrawText(&c2dtext, C2D_WithColor, newpos.x + 1 + (dim.y * line),
|
C2D_DrawText(&c2dtext, C2D_WithColor, newpos.x + 1 + (dim.y * line),
|
||||||
newpos.y + 1, 0.5, this->text_size, this->text_size,
|
newpos.y + 1, 0.5, R2::text_size, R2::text_size,
|
||||||
RenderD7::ThemeActive()->Get(RD7Color_TextDisabled));
|
RenderD7::ThemeActive()->Get(RD7Color_TextDisabled));
|
||||||
|
|
||||||
C2D_DrawText(&c2dtext, C2D_WithColor, newpos.x,
|
C2D_DrawText(&c2dtext, C2D_WithColor, newpos.x,
|
||||||
newpos.y + (dim.y * line), 0.5, this->text_size,
|
newpos.y + (dim.y * line), 0.5, R2::text_size,
|
||||||
this->text_size, it->clr);
|
R2::text_size, it->clr);
|
||||||
edit_text = edit_text.substr(edit_text.find('\n') + 1);
|
edit_text = edit_text.substr(edit_text.find('\n') + 1);
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
@ -196,10 +205,10 @@ void R2Base::Process() {
|
|||||||
it->clr, it->ap.x, 0.5f);
|
it->clr, it->ap.x, 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->commands.clear();
|
R2::commands.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr) {
|
void R2::AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos;
|
cmd->pos = pos;
|
||||||
cmd->pszs = size;
|
cmd->pszs = size;
|
||||||
@ -208,14 +217,14 @@ void R2Base::AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr) {
|
void R2::AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos;
|
cmd->pos = pos;
|
||||||
cmd->pszs = size;
|
cmd->pszs = size;
|
||||||
@ -224,14 +233,14 @@ void R2Base::AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t) {
|
void R2::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos_a;
|
cmd->pos = pos_a;
|
||||||
cmd->pszs = pos_b;
|
cmd->pszs = pos_b;
|
||||||
@ -241,14 +250,14 @@ void R2Base::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t) {
|
void R2::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos_a;
|
cmd->pos = pos_a;
|
||||||
cmd->pszs = pos_b;
|
cmd->pszs = pos_b;
|
||||||
@ -258,14 +267,14 @@ void R2Base::AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr) {
|
void R2::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos0;
|
cmd->pos = pos0;
|
||||||
cmd->pszs = pos1;
|
cmd->pszs = pos1;
|
||||||
@ -275,15 +284,14 @@ void R2Base::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
void R2::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, unsigned int clr) {
|
||||||
unsigned int clr) {
|
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos0;
|
cmd->pos = pos0;
|
||||||
cmd->pszs = pos1;
|
cmd->pszs = pos1;
|
||||||
@ -293,14 +301,14 @@ void R2Base::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
|
void R2::AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
|
||||||
RD7TextFlags flags, R7Vec2 tmb) {
|
RD7TextFlags flags, R7Vec2 tmb) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos;
|
cmd->pos = pos;
|
||||||
@ -312,14 +320,14 @@ void R2Base::AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
|
void R2::AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
|
||||||
RD7TextFlags flags, R7Vec2 tmb) {
|
RD7TextFlags flags, R7Vec2 tmb) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos;
|
cmd->pos = pos;
|
||||||
@ -331,14 +339,14 @@ void R2Base::AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddImage(R7Vec2 pos, Image::Ref img) {
|
void R2::AddImage(R7Vec2 pos, Image::Ref img) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->pos = pos;
|
cmd->pos = pos;
|
||||||
cmd->img = img;
|
cmd->img = img;
|
||||||
@ -346,25 +354,25 @@ void R2Base::AddImage(R7Vec2 pos, Image::Ref img) {
|
|||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R2Base::AddSprite(Sprite::Ref spr) {
|
void R2::AddSprite(Sprite::Ref spr) {
|
||||||
auto cmd = R2Cmd::New();
|
auto cmd = R2Cmd::New();
|
||||||
cmd->spr = spr;
|
cmd->spr = spr;
|
||||||
cmd->type = 5; // Sprite
|
cmd->type = 5; // Sprite
|
||||||
// Just assign current screen as bottom is 0 (false)
|
// Just assign current screen as bottom is 0 (false)
|
||||||
// and Top and TopRight are !0 (true)
|
// and Top and TopRight are !0 (true)
|
||||||
cmd->Screen = current_screen;
|
cmd->Screen = current_screen;
|
||||||
if (this->next_lined) {
|
if (R2::next_lined) {
|
||||||
cmd->lined = true;
|
cmd->lined = true;
|
||||||
this->next_lined = false;
|
R2::next_lined = false;
|
||||||
}
|
}
|
||||||
this->commands.push_back(cmd);
|
R2::commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace RenderD7
|
} // namespace RenderD7
|
100
source/UI7.cpp
100
source/UI7.cpp
@ -114,62 +114,62 @@ class DrawCmd {
|
|||||||
if (type == DrawCmdType_Skip) {
|
if (type == DrawCmdType_Skip) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RenderD7::R2()->OnScreen(screen ? R2Screen_Top : R2Screen_Bottom);
|
RenderD7::R2::OnScreen(screen ? R2Screen_Top : R2Screen_Bottom);
|
||||||
if (type == DrawCmdType_Rect) {
|
if (type == DrawCmdType_Rect) {
|
||||||
RenderD7::R2()->AddRect(R7Vec2(rect.x, rect.y), R7Vec2(rect.z, rect.w),
|
RenderD7::R2::AddRect(R7Vec2(rect.x, rect.y), R7Vec2(rect.z, rect.w),
|
||||||
clr);
|
clr);
|
||||||
} else if (type == DrawCmdType_Triangle) {
|
} else if (type == DrawCmdType_Triangle) {
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x, rect.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x, rect.y),
|
||||||
R7Vec2(rect.z, rect.w), add_coords, clr);
|
R7Vec2(rect.z, rect.w), add_coords, clr);
|
||||||
} else if (type == DrawCmdType_Text) {
|
} else if (type == DrawCmdType_Text) {
|
||||||
RenderD7::R2()->AddText(R7Vec2(rect.x, rect.y), text, clr, text_flags,
|
RenderD7::R2::AddText(R7Vec2(rect.x, rect.y), text, clr, text_flags,
|
||||||
text_box);
|
text_box);
|
||||||
} else if (type == DrawCmdType_Image) {
|
} else if (type == DrawCmdType_Image) {
|
||||||
RenderD7::R2()->AddImage(R7Vec2(rect.x, rect.y), img);
|
RenderD7::R2::AddImage(R7Vec2(rect.x, rect.y), img);
|
||||||
} else if (type == DrawCmdType_Debug) {
|
} else if (type == DrawCmdType_Debug) {
|
||||||
Debug();
|
Debug();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Debug() {
|
void Debug() {
|
||||||
RenderD7::R2()->OnScreen(screen ? R2Screen_Top : R2Screen_Bottom);
|
RenderD7::R2::OnScreen(screen ? R2Screen_Top : R2Screen_Bottom);
|
||||||
if (stype == DrawCmdType_Skip && type != DrawCmdType_Debug) return;
|
if (stype == DrawCmdType_Skip && type != DrawCmdType_Debug) return;
|
||||||
if (stype == DrawCmdType_Rect) {
|
if (stype == DrawCmdType_Rect) {
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x, rect.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x, rect.y),
|
||||||
R7Vec2(rect.x + rect.z, rect.y),
|
R7Vec2(rect.x + rect.z, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x + rect.z, rect.y + rect.w),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x + rect.z, rect.y + rect.w),
|
||||||
R7Vec2(rect.x + rect.z, rect.y),
|
R7Vec2(rect.x + rect.z, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
||||||
} else if (stype == DrawCmdType_Triangle) {
|
} else if (stype == DrawCmdType_Triangle) {
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x, rect.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x, rect.y),
|
||||||
R7Vec2(rect.z, rect.w), add_coords,
|
R7Vec2(rect.z, rect.w), add_coords,
|
||||||
0xff00ff00);
|
0xff00ff00);
|
||||||
} else if (stype == DrawCmdType_Text) {
|
} else if (stype == DrawCmdType_Text) {
|
||||||
auto szs = RenderD7::R2()->GetTextDimensions(text);
|
auto szs = RenderD7::R2::GetTextDimensions(text);
|
||||||
if (text_flags & RD7TextFlags_AlignRight) {
|
if (text_flags & RD7TextFlags_AlignRight) {
|
||||||
rect.x -= szs.x;
|
rect.x -= szs.x;
|
||||||
}
|
}
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x, rect.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x, rect.y),
|
||||||
R7Vec2(rect.x + szs.x, rect.y),
|
R7Vec2(rect.x + szs.x, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + szs.y), 0xff00ffff);
|
R7Vec2(rect.x, rect.y + szs.y), 0xff00ffff);
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x + szs.x, rect.y + szs.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x + szs.x, rect.y + szs.y),
|
||||||
R7Vec2(rect.x + szs.x, rect.y),
|
R7Vec2(rect.x + szs.x, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + szs.y), 0xff00ffff);
|
R7Vec2(rect.x, rect.y + szs.y), 0xff00ffff);
|
||||||
} else if (stype == DrawCmdType_Image) {
|
} else if (stype == DrawCmdType_Image) {
|
||||||
if (!img) return;
|
if (!img) return;
|
||||||
rect.z = img->GetSize().x;
|
rect.z = img->GetSize().x;
|
||||||
rect.w = img->GetSize().y;
|
rect.w = img->GetSize().y;
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x, rect.y),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x, rect.y),
|
||||||
R7Vec2(rect.x + rect.z, rect.y),
|
R7Vec2(rect.x + rect.z, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
||||||
RenderD7::R2()->DrawNextLined();
|
RenderD7::R2::DrawNextLined();
|
||||||
RenderD7::R2()->AddTriangle(R7Vec2(rect.x + rect.z, rect.y + rect.w),
|
RenderD7::R2::AddTriangle(R7Vec2(rect.x + rect.z, rect.y + rect.w),
|
||||||
R7Vec2(rect.x + rect.z, rect.y),
|
R7Vec2(rect.x + rect.z, rect.y),
|
||||||
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
R7Vec2(rect.x, rect.y + rect.w), 0xff0000ff);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ class DrawCmd {
|
|||||||
|
|
||||||
void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, RD7Color clr) {
|
void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, RD7Color clr) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos.x;
|
cmd->rect.x = pos.x;
|
||||||
cmd->rect.y = pos.y;
|
cmd->rect.y = pos.y;
|
||||||
cmd->rect.z = szs.x;
|
cmd->rect.z = szs.x;
|
||||||
@ -203,7 +203,7 @@ void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, RD7Color clr) {
|
|||||||
|
|
||||||
void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, unsigned int clr) {
|
void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, unsigned int clr) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos.x;
|
cmd->rect.x = pos.x;
|
||||||
cmd->rect.y = pos.y;
|
cmd->rect.y = pos.y;
|
||||||
cmd->rect.z = szs.x;
|
cmd->rect.z = szs.x;
|
||||||
@ -217,7 +217,7 @@ void UI7DrawList::AddRectangle(R7Vec2 pos, R7Vec2 szs, unsigned int clr) {
|
|||||||
void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
||||||
RD7Color clr) {
|
RD7Color clr) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos0.x;
|
cmd->rect.x = pos0.x;
|
||||||
cmd->rect.y = pos0.y;
|
cmd->rect.y = pos0.y;
|
||||||
cmd->rect.z = pos1.x;
|
cmd->rect.z = pos1.x;
|
||||||
@ -232,7 +232,7 @@ void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
|||||||
void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
||||||
unsigned int clr) {
|
unsigned int clr) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos0.x;
|
cmd->rect.x = pos0.x;
|
||||||
cmd->rect.y = pos0.y;
|
cmd->rect.y = pos0.y;
|
||||||
cmd->rect.z = pos1.x;
|
cmd->rect.z = pos1.x;
|
||||||
@ -247,7 +247,7 @@ void UI7DrawList::AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
|
|||||||
void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, RD7Color clr,
|
void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, RD7Color clr,
|
||||||
RD7TextFlags flags, R7Vec2 box) {
|
RD7TextFlags flags, R7Vec2 box) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos.x;
|
cmd->rect.x = pos.x;
|
||||||
cmd->rect.y = pos.y;
|
cmd->rect.y = pos.y;
|
||||||
cmd->text = text;
|
cmd->text = text;
|
||||||
@ -262,7 +262,7 @@ void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, RD7Color clr,
|
|||||||
void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, unsigned int clr,
|
void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, unsigned int clr,
|
||||||
RD7TextFlags flags, R7Vec2 box) {
|
RD7TextFlags flags, R7Vec2 box) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos.x;
|
cmd->rect.x = pos.x;
|
||||||
cmd->rect.y = pos.y;
|
cmd->rect.y = pos.y;
|
||||||
cmd->text = text;
|
cmd->text = text;
|
||||||
@ -276,7 +276,7 @@ void UI7DrawList::AddText(R7Vec2 pos, const std::string &text, unsigned int clr,
|
|||||||
|
|
||||||
void UI7DrawList::AddImage(R7Vec2 pos, RenderD7::Image::Ref img) {
|
void UI7DrawList::AddImage(R7Vec2 pos, RenderD7::Image::Ref img) {
|
||||||
auto cmd = DrawCmd::New();
|
auto cmd = DrawCmd::New();
|
||||||
cmd->screen = RenderD7::R2()->GetCurrentScreen();
|
cmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
cmd->rect.x = pos.x;
|
cmd->rect.x = pos.x;
|
||||||
cmd->rect.y = pos.y;
|
cmd->rect.y = pos.y;
|
||||||
cmd->img = img;
|
cmd->img = img;
|
||||||
@ -309,7 +309,7 @@ void UI7DrawList::AddDebugCall(std::shared_ptr<DrawCmd> cmd) {
|
|||||||
dcmd->text_flags = cmd->text_flags;
|
dcmd->text_flags = cmd->text_flags;
|
||||||
dcmd->img = cmd->img;
|
dcmd->img = cmd->img;
|
||||||
dcmd->type = DrawCmdType_Debug;
|
dcmd->type = DrawCmdType_Debug;
|
||||||
dcmd->screen = RenderD7::R2()->GetCurrentScreen();
|
dcmd->screen = RenderD7::R2::GetCurrentScreen();
|
||||||
UI7CtxPushDebugCmd(dcmd);
|
UI7CtxPushDebugCmd(dcmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ bool UI7CtxBeginMenu(const std::string &lb) {
|
|||||||
if (!ui7_ctx->cm->ctrl) ui7_ctx->cm->ctrl = NTCtrl::New();
|
if (!ui7_ctx->cm->ctrl) ui7_ctx->cm->ctrl = NTCtrl::New();
|
||||||
ui7_ctx->cm->menuid = id;
|
ui7_ctx->cm->menuid = id;
|
||||||
ui7_ctx->cm->cursor = R7Vec2(0, 0);
|
ui7_ctx->cm->cursor = R7Vec2(0, 0);
|
||||||
ui7_ctx->cm->has_touch = !RenderD7::R2()->GetCurrentScreen();
|
ui7_ctx->cm->has_touch = !RenderD7::R2::GetCurrentScreen();
|
||||||
if (!ui7_ctx->cm->background) ui7_ctx->cm->background = UI7DrawList::New();
|
if (!ui7_ctx->cm->background) ui7_ctx->cm->background = UI7DrawList::New();
|
||||||
if (!ui7_ctx->cm->main) ui7_ctx->cm->main = UI7DrawList::New();
|
if (!ui7_ctx->cm->main) ui7_ctx->cm->main = UI7DrawList::New();
|
||||||
if (!ui7_ctx->cm->front) ui7_ctx->cm->front = UI7DrawList::New();
|
if (!ui7_ctx->cm->front) ui7_ctx->cm->front = UI7DrawList::New();
|
||||||
@ -416,7 +416,7 @@ void UI7CtxEndMenu() {
|
|||||||
|
|
||||||
if (ui7_ctx->cm->show_scroolbar) {
|
if (ui7_ctx->cm->show_scroolbar) {
|
||||||
// Screen Width
|
// Screen Width
|
||||||
int sw = RenderD7::R2()->GetCurrentScreenSize().x;
|
int sw = RenderD7::R2::GetCurrentScreenSize().x;
|
||||||
// Top Start Pos
|
// Top Start Pos
|
||||||
int tsp = 5 + ui7_ctx->cm->tbh;
|
int tsp = 5 + ui7_ctx->cm->tbh;
|
||||||
// Slider Width
|
// Slider Width
|
||||||
@ -489,7 +489,7 @@ void UI7CtxEndMenu() {
|
|||||||
str << "ui7_ctx->cm->lszs: (" << ui7_ctx->cm->lszs.x << ", "
|
str << "ui7_ctx->cm->lszs: (" << ui7_ctx->cm->lszs.x << ", "
|
||||||
<< ui7_ctx->cm->lszs.y << ")" << std::endl;
|
<< ui7_ctx->cm->lszs.y << ")" << std::endl;
|
||||||
UI7::GetForegroundList()->AddRectangle(
|
UI7::GetForegroundList()->AddRectangle(
|
||||||
R7Vec2(), RenderD7::R2()->GetTextDimensions(str.str()),
|
R7Vec2(), RenderD7::R2::GetTextDimensions(str.str()),
|
||||||
(unsigned int)RGBA8(0, 0, 0, 110));
|
(unsigned int)RGBA8(0, 0, 0, 110));
|
||||||
UI7::GetForegroundList()->AddText(R7Vec2(), str.str(),
|
UI7::GetForegroundList()->AddText(R7Vec2(), str.str(),
|
||||||
(unsigned int)RGBA8(255, 255, 255, 110));
|
(unsigned int)RGBA8(255, 255, 255, 110));
|
||||||
@ -559,7 +559,7 @@ float GetDeltaTime() {
|
|||||||
bool Button(const std::string &label, R7Vec2 size) {
|
bool Button(const std::string &label, R7Vec2 size) {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (!UI7CtxValidate()) return ret;
|
if (!UI7CtxValidate()) return ret;
|
||||||
R7Vec2 textdim = RenderD7::R2()->GetTextDimensions(label);
|
R7Vec2 textdim = RenderD7::R2::GetTextDimensions(label);
|
||||||
if (size.x == 0) {
|
if (size.x == 0) {
|
||||||
size.x = textdim.x + 8;
|
size.x = textdim.x + 8;
|
||||||
}
|
}
|
||||||
@ -594,9 +594,9 @@ 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::R2()->GetTextSize() * 40) * 0.9;
|
float sv = (RenderD7::R2::GetTextSize() * 40) * 0.9;
|
||||||
R7Vec2 cbs = R7Vec2(sv, sv);
|
R7Vec2 cbs = R7Vec2(sv, sv);
|
||||||
R7Vec2 txtdim = RenderD7::R2()->GetTextDimensions(label);
|
R7Vec2 txtdim = RenderD7::R2::GetTextDimensions(label);
|
||||||
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
||||||
RD7Color bg = RD7Color_FrameBg;
|
RD7Color bg = RD7Color_FrameBg;
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ void Checkbox(const std::string &label, bool &c) {
|
|||||||
|
|
||||||
void Label(const std::string &label, RD7TextFlags flags) {
|
void Label(const std::string &label, RD7TextFlags flags) {
|
||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
R7Vec2 textdim = RenderD7::R2()->GetTextDimensions(label);
|
R7Vec2 textdim = RenderD7::R2::GetTextDimensions(label);
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
auto upos = pos;
|
auto upos = pos;
|
||||||
// Remove some y offset cause texts have some offset
|
// Remove some y offset cause texts have some offset
|
||||||
@ -639,7 +639,7 @@ void Label(const std::string &label, RD7TextFlags flags) {
|
|||||||
|
|
||||||
if (HandleScrolling(pos, textdim)) return;
|
if (HandleScrolling(pos, textdim)) return;
|
||||||
|
|
||||||
float tbh = RenderD7::R2()->GetTextSize() * 40;
|
float tbh = RenderD7::R2::GetTextSize() * 40;
|
||||||
auto &list =
|
auto &list =
|
||||||
(upos.y + textdim.y < tbh) ? ui7_ctx->cm->front : ui7_ctx->cm->main;
|
(upos.y + textdim.y < tbh) ? ui7_ctx->cm->front : ui7_ctx->cm->main;
|
||||||
|
|
||||||
@ -654,7 +654,7 @@ void Progressbar(float value) {
|
|||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
R7Vec2 size =
|
R7Vec2 size =
|
||||||
R7Vec2(RenderD7::R2()->GetCurrentScreenSize().x - (pos.x * 2), 20);
|
R7Vec2(RenderD7::R2::GetCurrentScreenSize().x - (pos.x * 2), 20);
|
||||||
if (ui7_ctx->cm->show_scroolbar && ui7_ctx->cm->enable_scrolling)
|
if (ui7_ctx->cm->show_scroolbar && ui7_ctx->cm->enable_scrolling)
|
||||||
size.x -= 16;
|
size.x -= 16;
|
||||||
MoveCursor(size);
|
MoveCursor(size);
|
||||||
@ -687,12 +687,12 @@ void BrowserList(const std::vector<std::string> &entrys, int &selection,
|
|||||||
RD7TextFlags txtflags, R7Vec2 size, int max_entrys) {
|
RD7TextFlags txtflags, R7Vec2 size, int max_entrys) {
|
||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
if (selection < 0) return;
|
if (selection < 0) return;
|
||||||
float tmp_txt = RenderD7::R2()->GetTextSize();
|
float tmp_txt = RenderD7::R2::GetTextSize();
|
||||||
RenderD7::R2()->DefaultTextSize();
|
RenderD7::R2::DefaultTextSize();
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
if (pos.y + 15 * max_entrys > 230) max_entrys = (int)((230 - pos.y) / 15);
|
if (pos.y + 15 * max_entrys > 230) max_entrys = (int)((230 - pos.y) / 15);
|
||||||
if (size.x == 0)
|
if (size.x == 0)
|
||||||
size.x = RenderD7::R2()->GetCurrentScreenSize().x - (pos.x * 2);
|
size.x = RenderD7::R2::GetCurrentScreenSize().x - (pos.x * 2);
|
||||||
if (size.y == 0) size.y = (max_entrys * 15);
|
if (size.y == 0) size.y = (max_entrys * 15);
|
||||||
MoveCursor(size);
|
MoveCursor(size);
|
||||||
ui7_ctx->cm->ctrl->AddObj();
|
ui7_ctx->cm->ctrl->AddObj();
|
||||||
@ -724,15 +724,15 @@ void BrowserList(const std::vector<std::string> &entrys, int &selection,
|
|||||||
: (i % 2 == 0 ? RD7Color_List0 : RD7Color_List1)),
|
: (i % 2 == 0 ? RD7Color_List0 : RD7Color_List1)),
|
||||||
txtflags | RD7TextFlags_Short, R7Vec2(size.x, 15));
|
txtflags | RD7TextFlags_Short, R7Vec2(size.x, 15));
|
||||||
}
|
}
|
||||||
RenderD7::R2()->SetTextSize(tmp_txt);
|
RenderD7::R2::SetTextSize(tmp_txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
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::R2()->GetTextSize() * 40) * 0.9;
|
float sv = (RenderD7::R2::GetTextSize() * 40) * 0.9;
|
||||||
R7Vec2 cbs = R7Vec2(144, sv);
|
R7Vec2 cbs = R7Vec2(144, sv);
|
||||||
R7Vec2 txtdim = RenderD7::R2()->GetTextDimensions(label);
|
R7Vec2 txtdim = RenderD7::R2::GetTextDimensions(label);
|
||||||
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
||||||
RD7Color bg = RD7Color_FrameBg;
|
RD7Color bg = RD7Color_FrameBg;
|
||||||
auto id = UI7ID(label);
|
auto id = UI7ID(label);
|
||||||
@ -772,13 +772,13 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
if (!ret) return ret;
|
if (!ret) return ret;
|
||||||
bool titlebar = true;
|
bool titlebar = true;
|
||||||
if (size.x == 0) {
|
if (size.x == 0) {
|
||||||
size.x = RenderD7::R2()->GetCurrentScreen() ? 400 : 320;
|
size.x = RenderD7::R2::GetCurrentScreen() ? 400 : 320;
|
||||||
}
|
}
|
||||||
if (size.y == 0) {
|
if (size.y == 0) {
|
||||||
size.y = 240;
|
size.y = 240;
|
||||||
}
|
}
|
||||||
RD7TextFlags txtflags = 0;
|
RD7TextFlags txtflags = 0;
|
||||||
float tbh = RenderD7::R2()->GetTextSize() * 40;
|
float tbh = RenderD7::R2::GetTextSize() * 40;
|
||||||
ui7_ctx->cm->tbh = tbh;
|
ui7_ctx->cm->tbh = tbh;
|
||||||
|
|
||||||
if (flags & UI7MenuFlags_NoTitlebar) {
|
if (flags & UI7MenuFlags_NoTitlebar) {
|
||||||
@ -787,7 +787,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
}
|
}
|
||||||
if (flags & UI7MenuFlags_TitleMid) txtflags = RD7TextFlags_AlignMid;
|
if (flags & UI7MenuFlags_TitleMid) txtflags = RD7TextFlags_AlignMid;
|
||||||
ui7_ctx->cm->enable_scrolling = (flags & UI7MenuFlags_Scrolling);
|
ui7_ctx->cm->enable_scrolling = (flags & UI7MenuFlags_Scrolling);
|
||||||
if (ui7_ctx->cm->enable_scrolling && !RenderD7::R2()->GetCurrentScreen() &&
|
if (ui7_ctx->cm->enable_scrolling && !RenderD7::R2::GetCurrentScreen() &&
|
||||||
ui7_ctx->cm->scrolling_possible) {
|
ui7_ctx->cm->scrolling_possible) {
|
||||||
// Patch that sets scrolling to 0 if max pos is not out of screen
|
// Patch that sets scrolling to 0 if max pos is not out of screen
|
||||||
if (ui7_ctx->cm->scrolling_offset != 0.f && ui7_ctx->cm->ms.y < 235) {
|
if (ui7_ctx->cm->scrolling_offset != 0.f && ui7_ctx->cm->ms.y < 235) {
|
||||||
@ -826,7 +826,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Held)) {
|
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Held)) {
|
||||||
// Set modifier
|
// Set modifier
|
||||||
if (!InBox(np,
|
if (!InBox(np,
|
||||||
R7Vec2(RenderD7::R2()->GetCurrentScreenSize().x - 8 - 5,
|
R7Vec2(RenderD7::R2::GetCurrentScreenSize().x - 8 - 5,
|
||||||
5 + ui7_ctx->cm->tbh),
|
5 + ui7_ctx->cm->tbh),
|
||||||
R7Vec2(8, 240 - ui7_ctx->cm->tbh - 10))) {
|
R7Vec2(8, 240 - ui7_ctx->cm->tbh - 10))) {
|
||||||
// Check if and do nothing if the scrolling ofset goes out of screen
|
// Check if and do nothing if the scrolling ofset goes out of screen
|
||||||
@ -927,9 +927,9 @@ void Grid(const std::string &name, const R7Vec2 &size, const R7Vec2 &entry_size,
|
|||||||
|
|
||||||
void ColorSelector(const std::string &label, unsigned int &color) {
|
void ColorSelector(const std::string &label, unsigned int &color) {
|
||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
float sv = (RenderD7::R2()->GetTextSize() * 40) * 0.9;
|
float sv = (RenderD7::R2::GetTextSize() * 40) * 0.9;
|
||||||
R7Vec2 cbs = R7Vec2(sv, sv);
|
R7Vec2 cbs = R7Vec2(sv, sv);
|
||||||
R7Vec2 txtdim = RenderD7::R2()->GetTextDimensions(label);
|
R7Vec2 txtdim = RenderD7::R2::GetTextDimensions(label);
|
||||||
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
R7Vec2 inp = cbs + R7Vec2(txtdim.x + 5, 0);
|
||||||
auto outline =
|
auto outline =
|
||||||
RenderD7::Color::RGBA(color).is_light() ? 0xff000000 : 0xffffffff;
|
RenderD7::Color::RGBA(color).is_light() ? 0xff000000 : 0xffffffff;
|
||||||
|
30
source/li7.v.pica
Normal file
30
source/li7.v.pica
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
;
|
||||||
|
LI7 Shader;
|
||||||
|
Constants.constf myconst(0.0, 1.0, 0.00392156862745, 0.0)
|
||||||
|
.alias ones myconst.yyyy;
|
||||||
|
Vector full of ones
|
||||||
|
|
||||||
|
;
|
||||||
|
Uniforms.fvec projection[4]
|
||||||
|
|
||||||
|
;
|
||||||
|
Outputs.out out_position position.out out_color color.out out_uv texcoord0
|
||||||
|
|
||||||
|
;
|
||||||
|
Inputs.alias in_xyz v0.alias in_uvc
|
||||||
|
v1.alias in_col v2
|
||||||
|
|
||||||
|
.entry vmain.proc vmain mov r0.xyz,
|
||||||
|
in_xyz.xyz mov r0.w,
|
||||||
|
ones
|
||||||
|
|
||||||
|
dp4 out_position.x,
|
||||||
|
projection[0], r0 dp4 out_position.y, projection[1], r0 dp4 out_position.z,
|
||||||
|
projection[2], r0 dp4 out_position.w, projection[3],
|
||||||
|
r0
|
||||||
|
|
||||||
|
mov out_uv,
|
||||||
|
in_uvc.xy
|
||||||
|
|
||||||
|
mul r1,
|
||||||
|
myconst.zzzz, in_col mov out_color, r1 end.end
|
@ -14,7 +14,6 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
RenderD7::R2Base::Ref rd7i_render2;
|
|
||||||
RenderD7::LoggerBase::Ref rd7i_glogger;
|
RenderD7::LoggerBase::Ref rd7i_glogger;
|
||||||
extern RenderD7::LoggerBase::Ref rd7i_logger;
|
extern RenderD7::LoggerBase::Ref rd7i_logger;
|
||||||
|
|
||||||
@ -66,11 +65,11 @@ void Npifade() {
|
|||||||
// No fade
|
// No fade
|
||||||
}
|
}
|
||||||
/*if (rd7i_fadein || rd7i_fadeout) {
|
/*if (rd7i_fadein || rd7i_fadeout) {
|
||||||
RenderD7::R2()->OnScreen(RenderD7::R2Screen_Top);
|
RenderD7::R2::OnScreen(RenderD7::R2Screen_Top);
|
||||||
RenderD7::R2()->AddRect(R7Vec2(0, 0), R7Vec2(400, 240),
|
RenderD7::R2::AddRect(R7Vec2(0, 0), R7Vec2(400, 240),
|
||||||
((rd7i_fadealpha << 24) | 0x00000000));
|
((rd7i_fadealpha << 24) | 0x00000000));
|
||||||
RenderD7::R2()->OnScreen(RenderD7::R2Screen_Bottom);
|
RenderD7::R2::OnScreen(RenderD7::R2Screen_Bottom);
|
||||||
RenderD7::R2()->AddRect(R7Vec2(0, 0), R7Vec2(320, 240),
|
RenderD7::R2::AddRect(R7Vec2(0, 0), R7Vec2(320, 240),
|
||||||
((rd7i_fadealpha << 24) | 0x00000000));
|
((rd7i_fadealpha << 24) | 0x00000000));
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
@ -86,7 +85,7 @@ void PushSplash() {
|
|||||||
C2D_TargetClear(rd7_bottom, 0xff000000);
|
C2D_TargetClear(rd7_bottom, 0xff000000);
|
||||||
RenderD7::ClearTextBufs();
|
RenderD7::ClearTextBufs();
|
||||||
C2D_SceneBegin(rd7_top);
|
C2D_SceneBegin(rd7_top);
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sheet, 0), 400 / 2 - 300 / 2,
|
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sheet, 0), 400 / 2 - 300 / 2,
|
||||||
240 / 2 - 100 / 2, 0.5);
|
240 / 2 - 100 / 2, 0.5);
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
@ -214,14 +213,6 @@ void rd7i_init_theme() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::R2Base::Ref RenderD7::R2() {
|
|
||||||
if (!rd7i_render2) {
|
|
||||||
RenderD7::Error("Render2 Was Called before being Init!");
|
|
||||||
// return schould not be reached then
|
|
||||||
}
|
|
||||||
return rd7i_render2;
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderD7::LoggerBase::Ref RenderD7::Logger() {
|
RenderD7::LoggerBase::Ref RenderD7::Logger() {
|
||||||
if (!rd7i_glogger) {
|
if (!rd7i_glogger) {
|
||||||
RenderD7::Error("Logger Was Called before being Init!");
|
RenderD7::Error("Logger Was Called before being Init!");
|
||||||
@ -327,7 +318,7 @@ void RenderD7::Init::Graphics() {
|
|||||||
rd7i_text_buffer = C2D_TextBufNew(4096);
|
rd7i_text_buffer = C2D_TextBufNew(4096);
|
||||||
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
||||||
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
||||||
rd7i_render2 = R2Base::New();
|
R2::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RenderD7::Init::Main(std::string app_name) {
|
Result RenderD7::Init::Main(std::string app_name) {
|
||||||
@ -387,7 +378,7 @@ Result RenderD7::Init::Main(std::string app_name) {
|
|||||||
rd7i_text_buffer = C2D_TextBufNew(4096);
|
rd7i_text_buffer = C2D_TextBufNew(4096);
|
||||||
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
||||||
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
||||||
rd7i_render2 = R2Base::New();
|
R2::Init();
|
||||||
|
|
||||||
rd7i_graphics_on = true;
|
rd7i_graphics_on = true;
|
||||||
rd7i_last_tm = svcGetSystemTick();
|
rd7i_last_tm = svcGetSystemTick();
|
||||||
@ -449,7 +440,7 @@ Result RenderD7::Init::Minimal(std::string app_name) {
|
|||||||
rd7i_text_buffer = C2D_TextBufNew(4096);
|
rd7i_text_buffer = C2D_TextBufNew(4096);
|
||||||
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
rd7i_d2_dimbuf = C2D_TextBufNew(4096);
|
||||||
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
||||||
rd7i_render2 = R2Base::New();
|
R2::Init();
|
||||||
|
|
||||||
rd7i_graphics_on = true;
|
rd7i_graphics_on = true;
|
||||||
if (rd7i_do_splash) PushSplash();
|
if (rd7i_do_splash) PushSplash();
|
||||||
@ -470,7 +461,6 @@ Result RenderD7::Init::Minimal(std::string app_name) {
|
|||||||
Result RenderD7::Init::Reload() {
|
Result RenderD7::Init::Reload() {
|
||||||
rd7i_graphics_on = false;
|
rd7i_graphics_on = false;
|
||||||
C2D_TextBufDelete(rd7i_text_buffer);
|
C2D_TextBufDelete(rd7i_text_buffer);
|
||||||
rd7i_render2 = nullptr; // Delete Render2
|
|
||||||
C2D_Fini();
|
C2D_Fini();
|
||||||
C3D_Fini();
|
C3D_Fini();
|
||||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||||
@ -481,7 +471,7 @@ Result RenderD7::Init::Reload() {
|
|||||||
rd7_bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
|
rd7_bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
|
||||||
rd7i_text_buffer = C2D_TextBufNew(4096);
|
rd7i_text_buffer = C2D_TextBufNew(4096);
|
||||||
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
rd7i_base_font = C2D_FontLoadSystem(CFG_REGION_USA);
|
||||||
rd7i_render2 = R2Base::New();
|
R2::Init();
|
||||||
rd7i_graphics_on = true;
|
rd7i_graphics_on = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -532,16 +522,16 @@ void RenderD7::FrameEnd() {
|
|||||||
RenderD7::ProcessMessages();
|
RenderD7::ProcessMessages();
|
||||||
OvlHandler();
|
OvlHandler();
|
||||||
Npifade();
|
Npifade();
|
||||||
R2()->Process();
|
R2::Process();
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::RSettings::RSettings() {
|
RenderD7::RSettings::RSettings() {
|
||||||
// RenderD7 Settings is designed for
|
// RenderD7 Settings is designed for
|
||||||
// System Font
|
// System Font
|
||||||
R2()->DefaultFont();
|
R2::DefaultFont();
|
||||||
tmp_txt = R2()->GetTextSize();
|
tmp_txt = R2::GetTextSize();
|
||||||
R2()->DefaultTextSize();
|
R2::DefaultTextSize();
|
||||||
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;
|
||||||
@ -551,7 +541,7 @@ RenderD7::RSettings::RSettings() {
|
|||||||
stateftold = rd7i_ftraced;
|
stateftold = rd7i_ftraced;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::RSettings::~RSettings() { R2()->SetTextSize(tmp_txt); }
|
RenderD7::RSettings::~RSettings() { R2::SetTextSize(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);
|
||||||
@ -565,7 +555,7 @@ std::vector<std::string> StrHelper(std::string input) {
|
|||||||
|
|
||||||
void RenderD7::RSettings::Draw(void) const {
|
void RenderD7::RSettings::Draw(void) const {
|
||||||
if (m_state == RSETTINGS) {
|
if (m_state == RSETTINGS) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
if (UI7::BeginMenu("RenderD7 -> Settings")) {
|
if (UI7::BeginMenu("RenderD7 -> Settings")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||||
@ -580,7 +570,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::Label("Kbd test: " + kbd_test);
|
UI7::Label("Kbd test: " + kbd_test);
|
||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
||||||
if (UI7::Button("FTrace")) {
|
if (UI7::Button("FTrace")) {
|
||||||
shared_request[0x00000001] = RFTRACE;
|
shared_request[0x00000001] = RFTRACE;
|
||||||
@ -612,7 +602,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (m_state == RIDB) {
|
} else if (m_state == RIDB) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
if (UI7::BeginMenu("RenderD7 -> Debugger")) {
|
if (UI7::BeginMenu("RenderD7 -> Debugger")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||||
@ -621,7 +611,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
std::string(rd7i_idb_running ? "true" : "false"));
|
std::string(rd7i_idb_running ? "true" : "false"));
|
||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
||||||
if (UI7::Button("Start Server")) {
|
if (UI7::Button("Start Server")) {
|
||||||
RenderD7::IDB::Start();
|
RenderD7::IDB::Start();
|
||||||
@ -639,7 +629,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (m_state == RFTRACE) {
|
} else if (m_state == RFTRACE) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
// Draw Top Screen Into Background DrawList
|
// Draw Top Screen Into Background DrawList
|
||||||
UI7::GetBackgroundList()->AddRectangle(R7Vec2(0, 0), R7Vec2(400, 240),
|
UI7::GetBackgroundList()->AddRectangle(R7Vec2(0, 0), R7Vec2(400, 240),
|
||||||
RD7Color_Background);
|
RD7Color_Background);
|
||||||
@ -711,7 +701,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
|
|
||||||
RenderD7::Ftrace::End("rd7ft", "display_traces");
|
RenderD7::Ftrace::End("rd7ft", "display_traces");
|
||||||
|
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
||||||
auto jt = RenderD7::Ftrace::rd7_traces.begin();
|
auto jt = RenderD7::Ftrace::rd7_traces.begin();
|
||||||
std::advance(jt, ftrace_index);
|
std::advance(jt, ftrace_index);
|
||||||
@ -726,7 +716,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
} else if (m_state == RUI7) {
|
} else if (m_state == RUI7) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
if (UI7::BeginMenu("RenderD7 -> UI7")) {
|
if (UI7::BeginMenu("RenderD7 -> UI7")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||||
@ -750,7 +740,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(),
|
if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(),
|
||||||
UI7MenuFlags_Scrolling)) {
|
UI7MenuFlags_Scrolling)) {
|
||||||
if (UI7::Button("Go back")) {
|
if (UI7::Button("Go back")) {
|
||||||
@ -762,7 +752,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
} else if (m_state == ROVERLAYS) {
|
} else if (m_state == ROVERLAYS) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
if (UI7::BeginMenu("RenderD7 -> Overlays")) {
|
if (UI7::BeginMenu("RenderD7 -> Overlays")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||||
@ -772,7 +762,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
if (UI7::BeginMenu("Press \uE001 to go back!")) {
|
||||||
UI7::Label("Metrik:");
|
UI7::Label("Metrik:");
|
||||||
UI7::Checkbox("Enable Overlay", rd7i_metrikd);
|
UI7::Checkbox("Enable Overlay", rd7i_metrikd);
|
||||||
@ -787,7 +777,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
} else if (m_state == RLOGS) {
|
} else if (m_state == RLOGS) {
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Top);
|
RenderD7::R2::OnScreen(R2Screen_Top);
|
||||||
if (UI7::BeginMenu("RenderD7 -> Logs")) {
|
if (UI7::BeginMenu("RenderD7 -> Logs")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
UI7::Label(RENDERD7VSTRING, RD7TextFlags_AlignRight);
|
||||||
@ -795,7 +785,7 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderD7::R2()->OnScreen(R2Screen_Bottom);
|
RenderD7::R2::OnScreen(R2Screen_Bottom);
|
||||||
if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(),
|
if (UI7::BeginMenu("Press \uE001 to go back!", R7Vec2(),
|
||||||
UI7MenuFlags_Scrolling)) {
|
UI7MenuFlags_Scrolling)) {
|
||||||
for (auto &it : rd7i_logger->Lines()) UI7::Label(it, RD7TextFlags_Wrap);
|
for (auto &it : rd7i_logger->Lines()) UI7::Label(it, RD7TextFlags_Wrap);
|
||||||
|
Loading…
Reference in New Issue
Block a user