mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Avoid having a single frame where the icon was not displayed on the top screen after selecting a different rom
This commit is contained in:
@@ -119,7 +119,6 @@ void MaterialBannerListItemView::Draw(GraphicsContext& graphicsContext)
|
||||
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetObjVramOffset(_iconVramOffset);
|
||||
_icon->SetPosition(6 + _position.x, 6 + _position.y);
|
||||
_icon->Draw(graphicsContext, frontColor);
|
||||
}
|
||||
|
||||
@@ -24,23 +24,26 @@ MaterialFileIcon::MaterialFileIcon(const TCHAR* name, const MaterialColorScheme*
|
||||
_displayName[i] = 0;
|
||||
}
|
||||
|
||||
void MaterialFileIcon::UploadGraphics(vu16* vram)
|
||||
void MaterialFileIcon::UploadGraphics()
|
||||
{
|
||||
dma_ntrCopy32(3, GetIconTiles(), vram, 32 * 32 / 2);
|
||||
if (_vramAddress != nullptr)
|
||||
{
|
||||
dma_ntrCopy32(3, GetIconTiles(), _vramAddress, 32 * 32 / 2);
|
||||
|
||||
auto font = _fontRepository->GetFont(FontType::Medium11);
|
||||
u8 tileBuffer[32 * 16 / 2];
|
||||
memset(tileBuffer, 0, sizeof(tileBuffer));
|
||||
u32 textWidth, textHeight;
|
||||
nft2_measureString(font, _displayName, textWidth, textHeight);
|
||||
nft2_string_render_params_t renderParams;
|
||||
renderParams.x = ((int)32 - (int)textWidth) / 2;
|
||||
renderParams.y = 0;
|
||||
renderParams.width = 32;
|
||||
renderParams.height = 16;
|
||||
renderParams.a5i3 = false;
|
||||
nft2_renderString(font, _displayName, tileBuffer, 32, &renderParams);
|
||||
memcpy((u8*)vram + largeFolderIconTilesLen, tileBuffer, sizeof(tileBuffer));
|
||||
auto font = _fontRepository->GetFont(FontType::Medium11);
|
||||
u8 tileBuffer[32 * 16 / 2];
|
||||
memset(tileBuffer, 0, sizeof(tileBuffer));
|
||||
u32 textWidth, textHeight;
|
||||
nft2_measureString(font, _displayName, textWidth, textHeight);
|
||||
nft2_string_render_params_t renderParams;
|
||||
renderParams.x = ((int)32 - (int)textWidth) / 2;
|
||||
renderParams.y = 0;
|
||||
renderParams.width = 32;
|
||||
renderParams.height = 16;
|
||||
renderParams.a5i3 = false;
|
||||
nft2_renderString(font, _displayName, tileBuffer, 32, &renderParams);
|
||||
memcpy((u8*)_vramAddress + largeFolderIconTilesLen, tileBuffer, sizeof(tileBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialFileIcon::Draw(GraphicsContext& graphicsContext, const Rgb<8, 8, 8>& backgroundColor)
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
MaterialFileIcon(const TCHAR* name, const MaterialColorScheme* materialColorScheme,
|
||||
const IFontRepository* fontRepository);
|
||||
|
||||
void UploadGraphics(vu16* vram) override;
|
||||
void UploadGraphics() override;
|
||||
void Draw(GraphicsContext& graphicsContext, const Rgb<8, 8, 8>& backgroundColor) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -78,7 +78,6 @@ void MaterialFileInfoCardView::Draw(GraphicsContext& graphicsContext)
|
||||
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetObjVramOffset(_iconVramOffset);
|
||||
_icon->Draw(graphicsContext, fgColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ void MaterialIconGridItemView::Draw(GraphicsContext& graphicsContext)
|
||||
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetObjVramOffset(_iconVramOffset);
|
||||
_icon->SetPosition(6 + _position.x, 6 + _position.y);
|
||||
_icon->Draw(graphicsContext, frontColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user