Formatting
UI7 Docs/Sizing
R2::GetCurrentScreenSize
Hardware Fix BatteryPercent/AddGetWifiLevel
This commit is contained in:
tobid7 2024-06-16 22:28:16 +02:00
parent ec8743417d
commit 56fd24ed80
13 changed files with 87 additions and 55 deletions

View File

@ -18,12 +18,10 @@ def fmt_dir(path):
print('Formatting...') print('Formatting...')
fmt_dir('source') fmt_dir('source')
fmt_dir('source/music')
fmt_dir('include') fmt_dir('include')
fmt_dir('include/renderd7') fmt_dir('include/renderd7')
fmt_dir('include/renderd7/music')
# Format LE and TF as well # Format LE and TF as well
fmt_dir('rd7tf/source') fmt_dir('rd7tf/source')
fmt_dir('rd7le/source') #fmt_dir('rd7le/source')
print('Done') print('Done')

View File

@ -29,13 +29,16 @@ bool IsHeadphones();
/// @return true if System gets Charged /// @return true if System gets Charged
bool IsCharging(); bool IsCharging();
/// @brief Check the Battery Percentage /// @brief Check the Battery Percentage
/// @return Persentage as float /// @return Persentage as int
float GetBatteryPercentage(); int GetBatteryPercentage();
/// @brief Get current State of 3d Slider /// @brief Get current State of 3d Slider
/// @return current 3dslider poition /// @return current 3dslider poition
float Get3dSliderLevel(); float Get3dSliderLevel();
/// @brief Get Current state of Sound Slider /// @brief Get Current state of Sound Slider
/// @return current SoundSlider state /// @return current SoundSlider state
float GetSoundSliderLevel(); float GetSoundSliderLevel();
/// @brief Get Current Wifi Level
/// @return current wifi level
int GetWifiLevel();
} // namespace Hardware } // namespace Hardware
} // namespace RenderD7 } // namespace RenderD7

View File

@ -30,6 +30,8 @@ namespace RenderD7 {
class Image { class Image {
public: public:
Image() = default; Image() = default;
Image(C2D_Image img) { this->img = img; }
Image(const std::string& path) { this->Load(path); }
~Image() = default; ~Image() = default;
RD7_SMART_CTOR(Image) RD7_SMART_CTOR(Image)
void Load(const std::string& path); void Load(const std::string& path);

View File

@ -80,7 +80,7 @@ class R2Base {
void SetTextSize(float szs); void SetTextSize(float szs);
void DefaultTextSize(); void DefaultTextSize();
float GetTextSize(); float GetTextSize();
R7Vec2 GetCurrentScreenSize();
// Processing // Processing
void Process(); void Process();
R7Vec2 GetTextDimensions(const std::string& text); R7Vec2 GetTextDimensions(const std::string& text);

View File

@ -31,6 +31,7 @@ class Sheet {
public: public:
/// @brief Constructor /// @brief Constructor
Sheet() = default; Sheet() = default;
Sheet(const std::string& path) { this->Load(path); }
/// @brief Deconstructor /// @brief Deconstructor
~Sheet() { ~Sheet() {
if (spritesheet) Free(); if (spritesheet) Free();
@ -42,7 +43,7 @@ class Sheet {
Result Load(const std::string& path); Result Load(const std::string& path);
/// @brief Unload the Sheet /// @brief Unload the Sheet
void Free(); void Free();
Image::Ref GetImage(int idx); C2D_Image GetImage(int idx);
C2D_SpriteSheet Get() { return this->spritesheet; } C2D_SpriteSheet Get() { return this->spritesheet; }
private: private:

View File

@ -103,11 +103,11 @@ void RestoreCursor();
void SameLine(); void SameLine();
float GetScrollingOffset(); float GetScrollingOffset();
namespace Menu { namespace Menu {
// All of them return the Main BG DrawList if Menu is null // All of them return the Main BG DrawList if Menu is null
UI7DrawList::Ref GetBackgroundList(); UI7DrawList::Ref GetBackgroundList();
UI7DrawList::Ref GetList(); UI7DrawList::Ref GetList();
UI7DrawList::Ref GetForegroundList(); UI7DrawList::Ref GetForegroundList();
} } // namespace Menu
// DrawLists // DrawLists
UI7DrawList::Ref GetForegroundList(); UI7DrawList::Ref GetForegroundList();
UI7DrawList::Ref GetBackgroundList(); UI7DrawList::Ref GetBackgroundList();

View File

@ -48,10 +48,10 @@ bool RenderD7::Hardware::IsCharging() {
return (var == 0x01 ? true : false); return (var == 0x01 ? true : false);
} }
float RenderD7::Hardware::GetBatteryPercentage() { int RenderD7::Hardware::GetBatteryPercentage() {
uint8_t percentLevel; uint8_t percentLevel = 0;
PTMU_GetBatteryLevel(&percentLevel); MCUHWC_GetBatteryLevel(&percentLevel);
return (float)percentLevel / 100; return percentLevel;
} }
float RenderD7::Hardware::Get3dSliderLevel() { return osGet3DSliderState(); } float RenderD7::Hardware::Get3dSliderLevel() { return osGet3DSliderState(); }
@ -61,3 +61,5 @@ float RenderD7::Hardware::GetSoundSliderLevel() {
MCUHWC_GetSoundSliderLevel(&percentLevel); MCUHWC_GetSoundSliderLevel(&percentLevel);
return (float)percentLevel / 100; return (float)percentLevel / 100;
} }
int RenderD7::Hardware::GetWifiLevel() { return osGetWifiStrength(); }

View File

@ -137,8 +137,8 @@ void Image::Load(const std::string &path) {
stbi_image_free(image); stbi_image_free(image);
} }
// Create C2D_Image // Create C2D_Image
C3D_Tex* tex = new C3D_Tex; C3D_Tex *tex = new C3D_Tex;
Tex3DS_SubTexture* subtex = new Tex3DS_SubTexture; Tex3DS_SubTexture *subtex = new Tex3DS_SubTexture;
__rd7i_maketex__(tex, subtex, wimg, w, h); __rd7i_maketex__(tex, subtex, wimg, w, h);
_rd7i_logger()->Write(RenderD7::FormatString("Created Texture (%d, %d)", _rd7i_logger()->Write(RenderD7::FormatString("Created Texture (%d, %d)",
tex->width, tex->height)); tex->width, tex->height));
@ -149,8 +149,8 @@ void Image::From_NIMG(const nimg &image) {
// Make sure to cleanup // Make sure to cleanup
Delete(); Delete();
if (image.width > 1024 || image.height > 1024) return; if (image.width > 1024 || image.height > 1024) return;
C3D_Tex* tex = new C3D_Tex; C3D_Tex *tex = new C3D_Tex;
Tex3DS_SubTexture* subtex = new Tex3DS_SubTexture; Tex3DS_SubTexture *subtex = new Tex3DS_SubTexture;
std::vector<unsigned char> mdpb = image.pixel_buffer; std::vector<unsigned char> mdpb = image.pixel_buffer;
__rd7i_maketex__(tex, subtex, mdpb, image.width, image.height); __rd7i_maketex__(tex, subtex, mdpb, image.width, image.height);
img = {tex, subtex}; img = {tex, subtex};

View File

@ -57,7 +57,7 @@ std::vector<Key> keyboard_layout_num{
{"0", R7Vec2(5, 213), R7Vec2(74, 24), 0}, {"0", R7Vec2(5, 213), R7Vec2(74, 24), 0},
{".", R7Vec2(81, 213), R7Vec2(36, 24), 0}, {".", R7Vec2(81, 213), R7Vec2(36, 24), 0},
// additional actions // additional actions
{"bksp", R7Vec2(119, 135), R7Vec2(74, 24), 2}, {"<---", R7Vec2(119, 135), R7Vec2(74, 24), 2},
//{"", R7Vec2(119, 161), R7Vec2(74, 24), 0}, //{"", R7Vec2(119, 161), R7Vec2(74, 24), 0},
{"Confirm", R7Vec2(119, 187), R7Vec2(74, 24), 5}, {"Confirm", R7Vec2(119, 187), R7Vec2(74, 24), 5},
{"Cancel", R7Vec2(119, 213), R7Vec2(74, 24), 4}, {"Cancel", R7Vec2(119, 213), R7Vec2(74, 24), 4},
@ -78,7 +78,7 @@ std::vector<Key> keyboard_layout = {
{"0", R7Vec2(205, 137), R7Vec2(18, 18), 0}, {"0", R7Vec2(205, 137), R7Vec2(18, 18), 0},
{"-", R7Vec2(225, 137), R7Vec2(18, 18), 0}, {"-", R7Vec2(225, 137), R7Vec2(18, 18), 0},
{"=", R7Vec2(245, 137), R7Vec2(18, 18), 0}, {"=", R7Vec2(245, 137), R7Vec2(18, 18), 0},
{"Bksp", R7Vec2(265, 137), R7Vec2(50, 18), 2}, {"<---", R7Vec2(265, 137), R7Vec2(50, 18), 2},
// 2nd row // 2nd row
{"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6}, {"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6},
{"q", R7Vec2(47, 157), R7Vec2(18, 18), 0}, {"q", R7Vec2(47, 157), R7Vec2(18, 18), 0},
@ -148,7 +148,7 @@ std::vector<Key> keyboard_layout_caps = {
{"0", R7Vec2(205, 137), R7Vec2(18, 18), 0}, {"0", R7Vec2(205, 137), R7Vec2(18, 18), 0},
{"-", R7Vec2(225, 137), R7Vec2(18, 18), 0}, {"-", R7Vec2(225, 137), R7Vec2(18, 18), 0},
{"=", R7Vec2(245, 137), R7Vec2(18, 18), 0}, {"=", R7Vec2(245, 137), R7Vec2(18, 18), 0},
{"Bksp", R7Vec2(265, 137), R7Vec2(50, 18), 2}, {"<---", R7Vec2(265, 137), R7Vec2(50, 18), 2},
// 2nd row // 2nd row
{"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6}, {"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6},
{"Q", R7Vec2(47, 157), R7Vec2(18, 18), 0}, {"Q", R7Vec2(47, 157), R7Vec2(18, 18), 0},
@ -218,7 +218,7 @@ std::vector<Key> keyboard_layout_shift = {
{")", R7Vec2(205, 137), R7Vec2(18, 18), 0}, {")", R7Vec2(205, 137), R7Vec2(18, 18), 0},
{"_", R7Vec2(225, 137), R7Vec2(18, 18), 0}, {"_", R7Vec2(225, 137), R7Vec2(18, 18), 0},
{"+", R7Vec2(245, 137), R7Vec2(18, 18), 0}, {"+", R7Vec2(245, 137), R7Vec2(18, 18), 0},
{"Bksp", R7Vec2(265, 137), R7Vec2(50, 18), 2}, {"<---", R7Vec2(265, 137), R7Vec2(50, 18), 2},
// 2nd row // 2nd row
{"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6}, {"Tab", R7Vec2(5, 157), R7Vec2(40, 18), 6},
{"Q", R7Vec2(47, 157), R7Vec2(18, 18), 0}, {"Q", R7Vec2(47, 157), R7Vec2(18, 18), 0},

View File

@ -79,6 +79,10 @@ std::string R2Base::WrapText(const std ::string& in, int maxlen) {
return out; return out;
} }
R7Vec2 R2Base::GetCurrentScreenSize() {
return R7Vec2(this->current_screen == R2Screen_Bottom ? 320 : 400, 240);
}
// Main Processing of Draw Calls // Main Processing of Draw Calls
void R2Base::Process() { void R2Base::Process() {
for (auto& it : this->commands) { for (auto& it : this->commands) {
@ -90,16 +94,16 @@ void R2Base::Process() {
if (it->type == 1) { if (it->type == 1) {
// Rect // Rect
if (it->lined) { if (it->lined) {
C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pos.x + it->pszs.x, it->pos.y, C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pos.x + it->pszs.x,
it->clr, 1.f, 0.5f); it->pos.y, it->clr, 1.f, 0.5f);
C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pos.x, it->pos.y + it->pszs.y, C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pos.x,
it->clr, 1.f, 0.5f); it->pos.y + it->pszs.y, it->clr, 1.f, 0.5f);
C2D_DrawLine(it->pos.x + it->pszs.x, it->pos.y, it->clr, C2D_DrawLine(it->pos.x + it->pszs.x, it->pos.y, it->clr,
it->pos.x + it->pszs.x, it->pos.y + it->pszs.y, it->clr, 1.f, it->pos.x + it->pszs.x, it->pos.y + it->pszs.y, it->clr,
0.5f); 1.f, 0.5f);
C2D_DrawLine(it->pos.x, it->pos.y + it->pszs.y, it->clr, C2D_DrawLine(it->pos.x, it->pos.y + it->pszs.y, it->clr,
it->pos.x + it->pszs.x, it->pos.y + it->pszs.y, it->clr, 1.f, it->pos.x + it->pszs.x, it->pos.y + it->pszs.y, it->clr,
0.5f); 1.f, 0.5f);
} else { } else {
C2D_DrawRectSolid(it->pos.x, it->pos.y, 0.5, it->pszs.x, it->pszs.y, C2D_DrawRectSolid(it->pos.x, it->pos.y, 0.5, it->pszs.x, it->pszs.y,
it->clr); it->clr);
@ -107,12 +111,12 @@ void R2Base::Process() {
} else if (it->type == 2) { } else if (it->type == 2) {
// Triangle // Triangle
if (it->lined) { if (it->lined) {
C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pszs.x, it->pszs.y, it->clr, C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->pszs.x, it->pszs.y,
it->clr, 1, 0.5f);
C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->ap.x, it->ap.y, it->clr,
1, 0.5f); 1, 0.5f);
C2D_DrawLine(it->pos.x, it->pos.y, it->clr, it->ap.x, it->ap.y, it->clr, 1, C2D_DrawLine(it->pszs.x, it->pszs.y, it->clr, it->ap.x, it->ap.y,
0.5f); it->clr, 1, 0.5f);
C2D_DrawLine(it->pszs.x, it->pszs.y, it->clr, it->ap.x, it->ap.y, it->clr, 1,
0.5f);
} else { } else {
C2D_DrawTriangle(it->pos.x, it->pos.y, it->clr, it->pszs.x, it->pszs.y, C2D_DrawTriangle(it->pos.x, it->pos.y, it->clr, it->pszs.x, it->pszs.y,
it->clr, it->ap.x, it->ap.y, it->clr, 0.5); it->clr, it->ap.x, it->ap.y, it->clr, 0.5);

View File

@ -34,9 +34,7 @@ void RenderD7::Sheet::Free() {
this->spritesheet = nullptr; this->spritesheet = nullptr;
} }
RenderD7::Image::Ref RenderD7::Sheet::GetImage(int idx) { C2D_Image RenderD7::Sheet::GetImage(int idx) {
if (!this->spritesheet) return nullptr; if (!this->spritesheet) return {nullptr, nullptr};
Image::Ref img = Image::New(); return C2D_SpriteSheetGetImage(this->spritesheet, idx);
img->GetRef() = C2D_SpriteSheetGetImage(this->spritesheet, idx);
return img;
} }

View File

@ -179,6 +179,7 @@ class DrawCmd {
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;
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();
@ -324,6 +325,7 @@ void UI7DrawList::AddDebugCall(std::shared_ptr<DrawCmd> cmd) {
dcmd->text = cmd->text; dcmd->text = cmd->text;
dcmd->text_box = cmd->text_box; dcmd->text_box = cmd->text_box;
dcmd->text_flags = cmd->text_flags; dcmd->text_flags = cmd->text_flags;
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);
@ -351,9 +353,11 @@ struct UI7Menu {
UI7DrawList::Ref main; UI7DrawList::Ref main;
UI7DrawList::Ref front; UI7DrawList::Ref front;
R7Vec2 ms; // Max Size R7Vec2 ms; // Max Size
R7Vec2 msr; // Max Size Real (Slider) R7Vec2 msr; // Max Size Real (Slider)
R7Vec2 mdp; // Mouse/Touch Initial pos R7Vec2 mdp; // Mouse/Touch Initial pos
R7Vec2 bslp; // Before SameLine Pos
R7Vec2 lszs; // Last Size
// For Smart Pointer // For Smart Pointer
RD7_SMART_CTOR(UI7Menu) RD7_SMART_CTOR(UI7Menu)
}; };
@ -426,13 +430,22 @@ void UI7CtxEndMenu() {
ui7_ctx->cm->show_scroolbar = (ui7_ctx->cm->ms.y < 235 ? false : true); ui7_ctx->cm->show_scroolbar = (ui7_ctx->cm->ms.y < 235 ? false : true);
if (ui7_ctx->cm->show_scroolbar) { if (ui7_ctx->cm->show_scroolbar) {
int sw = (RenderD7::R2()->GetCurrentScreen() ? 400 : 320); // Screen Width
int sw = RenderD7::R2()->GetCurrentScreenSize().x;
// Top Start Pos
int tsp = 5 + ui7_ctx->cm->tbh; int tsp = 5 + ui7_ctx->cm->tbh;
// Slider Width
int slider_w = 4;
// Height of Slider
int szs = 240 - tsp - 5; int szs = 240 - tsp - 5;
// Lowest Height of Slider Obj
int lszs = 20; // Lowest Slider size int lszs = 20; // Lowest Slider size
// Calculate Slider Height
float slider_h = (szs - 4) * (static_cast<float>(szs - 4) / float slider_h = (szs - 4) * (static_cast<float>(szs - 4) /
static_cast<float>(ui7_ctx->cm->msr.y)); static_cast<float>(ui7_ctx->cm->msr.y));
// Create Real Slider Height
int slider_rh = d7min(d7max(slider_h, (float)lszs), (float)(szs - 4)); int slider_rh = d7min(d7max(slider_h, (float)lszs), (float)(szs - 4));
// Calculate Slider Position
int slider_pos = d7min( int slider_pos = d7min(
static_cast<float>(tsp + szs - slider_rh - 4), static_cast<float>(tsp + szs - slider_rh - 4),
d7max(static_cast<float>(tsp), d7max(static_cast<float>(tsp),
@ -441,7 +454,7 @@ void UI7CtxEndMenu() {
(szs) * (szs) *
(static_cast<float>(ui7_ctx->cm->scrolling_offset) / (static_cast<float>(ui7_ctx->cm->scrolling_offset) /
static_cast<float>(ui7_ctx->cm->msr.y))))); static_cast<float>(ui7_ctx->cm->msr.y)))));
int slider_w = 4; // Render Slider
ui7_ctx->cm->front->AddRectangle( ui7_ctx->cm->front->AddRectangle(
R7Vec2(sw - 12, tsp), R7Vec2(slider_w * 2, szs), RD7Color_List0); R7Vec2(sw - 12, tsp), R7Vec2(slider_w * 2, szs), RD7Color_List0);
ui7_ctx->cm->front->AddRectangle(R7Vec2(sw - 10, slider_pos + 2), ui7_ctx->cm->front->AddRectangle(R7Vec2(sw - 10, slider_pos + 2),
@ -457,9 +470,15 @@ void UI7CtxEndMenu() {
void UI7CtxCursorMove(R7Vec2 size) { void UI7CtxCursorMove(R7Vec2 size) {
if (!UI7CtxValidate()) return; if (!UI7CtxValidate()) return;
if (!UI7CtxInMenu()) return; if (!UI7CtxInMenu()) return;
ui7_ctx->cm->lszs = size;
ui7_ctx->cm->slc = ui7_ctx->cm->cursor + R7Vec2(size.x + 5, 0); ui7_ctx->cm->slc = ui7_ctx->cm->cursor + R7Vec2(size.x + 5, 0);
ui7_ctx->cm->cursor.x = 5; ui7_ctx->cm->cursor.x = 5;
ui7_ctx->cm->cursor += R7Vec2(0, size.y + 5); if (ui7_ctx->cm->bslp.y) {
ui7_ctx->cm->cursor += R7Vec2(0, ui7_ctx->cm->bslp.y + 5);
ui7_ctx->cm->bslp = R7Vec2();
} else {
ui7_ctx->cm->cursor += R7Vec2(0, size.y + 5);
}
ui7_ctx->cm->ms = R7Vec2(ui7_ctx->cm->slc.x, ui7_ctx->cm->cursor.y); ui7_ctx->cm->ms = R7Vec2(ui7_ctx->cm->slc.x, ui7_ctx->cm->cursor.y);
// TODO: Correct that calculation // TODO: Correct that calculation
ui7_ctx->cm->msr = R7Vec2(ui7_ctx->cm->slc.x, ui7_ctx->cm->slc.y - 10); ui7_ctx->cm->msr = R7Vec2(ui7_ctx->cm->slc.x, ui7_ctx->cm->slc.y - 10);
@ -637,8 +656,8 @@ void Label(const std::string &label, RD7TextFlags flags) {
void Progressbar(float value) { void Progressbar(float value) {
if (!UI7CtxValidate()) return; if (!UI7CtxValidate()) return;
R7Vec2 pos = GetCursorPos(); R7Vec2 pos = GetCursorPos();
R7Vec2 size = R7Vec2( R7Vec2 size =
(RenderD7::R2()->GetCurrentScreen() ? 400 : 320) - (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;
UI7CtxCursorMove(size); UI7CtxCursorMove(size);
@ -688,7 +707,7 @@ void BrowserList(const std::vector<std::string> &entrys, int &selection,
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()->GetCurrentScreen() ? 400 : 320) - (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);
UI7CtxCursorMove(size); UI7CtxCursorMove(size);
ui7_ctx->cm->ctrl->AddObj(); ui7_ctx->cm->ctrl->AddObj();
@ -1146,6 +1165,7 @@ void SameLine() {
if (!UI7CtxValidate()) return; if (!UI7CtxValidate()) return;
if (!UI7CtxInMenu()) return; if (!UI7CtxInMenu()) return;
ui7_ctx->cm->ctrl->NewRow(); ui7_ctx->cm->ctrl->NewRow();
ui7_ctx->cm->bslp = ui7_ctx->cm->lszs;
ui7_ctx->cm->cursor = ui7_ctx->cm->slc; ui7_ctx->cm->cursor = ui7_ctx->cm->slc;
} }
@ -1184,19 +1204,19 @@ UI7DrawList::Ref GetBackgroundList() {
UI7DrawList::Ref Menu::GetBackgroundList() { UI7DrawList::Ref Menu::GetBackgroundList() {
if (!UI7CtxValidate()) return nullptr; if (!UI7CtxValidate()) return nullptr;
if(!UI7CtxInMenu()) return ui7_ctx->bdl; if (!UI7CtxInMenu()) return ui7_ctx->bdl;
return ui7_ctx->cm->background; return ui7_ctx->cm->background;
} }
UI7DrawList::Ref Menu::GetList() { UI7DrawList::Ref Menu::GetList() {
if (!UI7CtxValidate()) return nullptr; if (!UI7CtxValidate()) return nullptr;
if(!UI7CtxInMenu()) return ui7_ctx->bdl; if (!UI7CtxInMenu()) return ui7_ctx->bdl;
return ui7_ctx->cm->main; return ui7_ctx->cm->main;
} }
UI7DrawList::Ref Menu::GetForegroundList() { UI7DrawList::Ref Menu::GetForegroundList() {
if (!UI7CtxValidate()) return nullptr; if (!UI7CtxValidate()) return nullptr;
if(!UI7CtxInMenu()) return ui7_ctx->bdl; if (!UI7CtxInMenu()) return ui7_ctx->bdl;
return ui7_ctx->cm->front; return ui7_ctx->cm->front;
} }
} // namespace UI7 } // namespace UI7

View File

@ -387,6 +387,8 @@ Result RenderD7::Init::Main(std::string app_name) {
rd7i_is_am_init = true; rd7i_is_am_init = true;
} }
Hardware::Initialisize();
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
atexit(C3D_Fini); atexit(C3D_Fini);
C2D_Init((size_t)rd7_max_objects); C2D_Init((size_t)rd7_max_objects);
@ -442,6 +444,8 @@ Result RenderD7::Init::Minimal(std::string app_name) {
rd7i_is_am_init = true; rd7i_is_am_init = true;
} }
Hardware::Initialisize();
osSetSpeedupEnable(true); osSetSpeedupEnable(true);
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
atexit(C3D_Fini); atexit(C3D_Fini);