mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Add various extra customization options for custom themes. Fixes #40
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "core/math/RgbMixer.h"
|
||||
#include "themes/material/MaterialColorScheme.h"
|
||||
#include "themes/IFontRepository.h"
|
||||
#include "themes/custom/CustomThemeInfo.h"
|
||||
#include "bannerListItemBg0.h"
|
||||
#include "bannerListItemBg1.h"
|
||||
#include "bannerListItemBg2.h"
|
||||
@@ -30,9 +31,10 @@
|
||||
#define LINE_HEIGHT 16
|
||||
#define MAX_LINE_STRING_LENGTH 50
|
||||
|
||||
CustomBannerListItemView::CustomBannerListItemView(const MaterialColorScheme* materialColorScheme,
|
||||
const IFontRepository* fontRepository, u32 texVramOffset, u32 plttVramOffset,
|
||||
u32 selectedTexVramOffset, u32 selectedPlttVramOffset, VBlankTextureLoader* vblankTextureLoader)
|
||||
CustomBannerListItemView::CustomBannerListItemView(const CustomThemeInfo* customThemeInfo,
|
||||
const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository,
|
||||
u32 texVramOffset, u32 plttVramOffset, u32 selectedTexVramOffset, u32 selectedPlttVramOffset,
|
||||
VBlankTextureLoader* vblankTextureLoader)
|
||||
: BannerListItemView(
|
||||
std::make_unique<Label3DView>(LINE_WIDTH, LINE_HEIGHT, MAX_LINE_STRING_LENGTH,
|
||||
fontRepository->GetFont(FontType::Medium10), vblankTextureLoader),
|
||||
@@ -40,6 +42,7 @@ CustomBannerListItemView::CustomBannerListItemView(const MaterialColorScheme* ma
|
||||
fontRepository->GetFont(FontType::Regular10), vblankTextureLoader),
|
||||
std::make_unique<Label3DView>(LINE_WIDTH, LINE_HEIGHT, MAX_LINE_STRING_LENGTH,
|
||||
fontRepository->GetFont(FontType::Regular10), vblankTextureLoader))
|
||||
, _customThemeInfo(customThemeInfo)
|
||||
, _materialColorScheme(materialColorScheme)
|
||||
, _texVramOffset(texVramOffset)
|
||||
, _plttVramOffset(plttVramOffset)
|
||||
@@ -53,8 +56,6 @@ void CustomBannerListItemView::Draw(GraphicsContext& graphicsContext)
|
||||
return;
|
||||
}
|
||||
|
||||
auto backgroundColor = Rgb<8, 8, 8>(200, 200, 200);
|
||||
|
||||
Gx::MtxIdentity();
|
||||
Gx::PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGON_MODE_MODULATE, GX_DISPLAY_MODE_FRONT,
|
||||
false, false, false, GX_DEPTH_FUNC_LESS, false, 31, 0);
|
||||
@@ -82,9 +83,9 @@ void CustomBannerListItemView::Draw(GraphicsContext& graphicsContext)
|
||||
|
||||
graphicsContext.SetPolygonId(1);
|
||||
|
||||
_firstLine->SetForegroundColor(Rgb<8, 8, 8>(30, 30, 30));
|
||||
_secondLine->SetForegroundColor(Rgb<8, 8, 8>(30, 30, 30));
|
||||
_thirdLine->SetForegroundColor(Rgb<8, 8, 8>(30, 30, 30));
|
||||
_firstLine->SetForegroundColor(_customThemeInfo->bannerListTextLine0Info.GetTextColor());
|
||||
_secondLine->SetForegroundColor(_customThemeInfo->bannerListTextLine1Info.GetTextColor());
|
||||
_thirdLine->SetForegroundColor(_customThemeInfo->bannerListTextLine2Info.GetTextColor());
|
||||
|
||||
if (_lines == 1)
|
||||
{
|
||||
@@ -118,6 +119,6 @@ void CustomBannerListItemView::Draw(GraphicsContext& graphicsContext)
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetPosition(6 + _position.x, 6 + _position.y);
|
||||
_icon->Draw(graphicsContext, backgroundColor);
|
||||
_icon->Draw(graphicsContext, _customThemeInfo->bannerListIconInfo.GetBlendColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
|
||||
class MaterialColorScheme;
|
||||
class IFontRepository;
|
||||
class CustomThemeInfo;
|
||||
|
||||
class CustomBannerListItemView : public BannerListItemView
|
||||
{
|
||||
public:
|
||||
CustomBannerListItemView(const MaterialColorScheme* materialColorScheme,
|
||||
CustomBannerListItemView(const CustomThemeInfo* customThemeInfo, const MaterialColorScheme* materialColorScheme,
|
||||
const IFontRepository* fontRepository, u32 texVramOffset, u32 plttVramOffset,
|
||||
u32 selectedTexVramOffset, u32 selectedPlttVramOffset, VBlankTextureLoader* vblankTextureLoader);
|
||||
|
||||
@@ -20,6 +21,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
const CustomThemeInfo* _customThemeInfo;
|
||||
const MaterialColorScheme* _materialColorScheme;
|
||||
u32 _texVramOffset = 0;
|
||||
u32 _plttVramOffset = 0;
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
#include "gui/GraphicsContext.h"
|
||||
#include "gui/IVramManager.h"
|
||||
#include "themes/IFontRepository.h"
|
||||
#include "themes/custom/CustomThemeInfo.h"
|
||||
#include "CustomFileInfoView.h"
|
||||
|
||||
CustomFileInfoView::CustomFileInfoView(const IFontRepository* fontRepository)
|
||||
: _firstLine(176, 16, 50, fontRepository->GetFont(FontType::Medium11))
|
||||
, _secondLine(176, 16, 50, fontRepository->GetFont(FontType::Regular10))
|
||||
, _thirdLine(176, 16, 50, fontRepository->GetFont(FontType::Regular10))
|
||||
, _filenameLabelView(220, 16, 200, fontRepository->GetFont(FontType::Medium7_5))
|
||||
, _backgroundColor(200, 200, 200), _textColor(30, 30, 30)
|
||||
CustomFileInfoView::CustomFileInfoView(const CustomThemeInfo* customThemeInfo, const IFontRepository* fontRepository)
|
||||
: _firstLine(customThemeInfo->topBannerTextLine0Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Medium11))
|
||||
, _secondLine(customThemeInfo->topBannerTextLine1Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Regular10))
|
||||
, _thirdLine(customThemeInfo->topBannerTextLine2Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Regular10))
|
||||
, _filenameLabelView(customThemeInfo->topFileNameTextInfo.GetWidth(), 16, 256, fontRepository->GetFont(FontType::Medium7_5))
|
||||
, _customThemeInfo(customThemeInfo)
|
||||
{
|
||||
AddChildTail(&_firstLine);
|
||||
AddChildTail(&_secondLine);
|
||||
@@ -21,32 +22,32 @@ CustomFileInfoView::CustomFileInfoView(const IFontRepository* fontRepository)
|
||||
void CustomFileInfoView::Update()
|
||||
{
|
||||
BannerView::Update();
|
||||
_firstLine.SetPosition(_position.x + 70, _position.y + 130 - 4);
|
||||
_secondLine.SetPosition(_position.x + 70, _position.y + 145 - 4);
|
||||
_thirdLine.SetPosition(_position.x + 70, _position.y + 159 - 4);
|
||||
_filenameLabelView.SetPosition(_position.x + 18, _position.y + 170);
|
||||
_firstLine.SetPosition(_customThemeInfo->topBannerTextLine0Info.GetPosition());
|
||||
_secondLine.SetPosition(_customThemeInfo->topBannerTextLine1Info.GetPosition());
|
||||
_thirdLine.SetPosition(_customThemeInfo->topBannerTextLine2Info.GetPosition());
|
||||
_filenameLabelView.SetPosition(_customThemeInfo->topFileNameTextInfo.GetPosition());
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetPosition(_position.x + 24, _position.y + 136 - 4);
|
||||
_icon->SetPosition(_customThemeInfo->topIconInfo.GetPosition());
|
||||
_icon->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFileInfoView::Draw(GraphicsContext& graphicsContext)
|
||||
{
|
||||
_firstLine.SetBackgroundColor(_backgroundColor);
|
||||
_firstLine.SetForegroundColor(_textColor);
|
||||
_secondLine.SetBackgroundColor(_backgroundColor);
|
||||
_secondLine.SetForegroundColor(_textColor);
|
||||
_thirdLine.SetBackgroundColor(_backgroundColor);
|
||||
_thirdLine.SetForegroundColor(_textColor);
|
||||
_filenameLabelView.SetBackgroundColor(_backgroundColor);
|
||||
_filenameLabelView.SetForegroundColor(_textColor);
|
||||
_firstLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine0Info.GetBlendColor());
|
||||
_firstLine.SetForegroundColor(_customThemeInfo->topBannerTextLine0Info.GetTextColor());
|
||||
_secondLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine1Info.GetBlendColor());
|
||||
_secondLine.SetForegroundColor(_customThemeInfo->topBannerTextLine1Info.GetTextColor());
|
||||
_thirdLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine2Info.GetBlendColor());
|
||||
_thirdLine.SetForegroundColor(_customThemeInfo->topBannerTextLine2Info.GetTextColor());
|
||||
_filenameLabelView.SetBackgroundColor(_customThemeInfo->topFileNameTextInfo.GetBlendColor());
|
||||
_filenameLabelView.SetForegroundColor(_customThemeInfo->topFileNameTextInfo.GetTextColor());
|
||||
|
||||
BannerView::Draw(graphicsContext);
|
||||
|
||||
if (_icon)
|
||||
{
|
||||
_icon->Draw(graphicsContext, _backgroundColor);
|
||||
_icon->Draw(graphicsContext, _customThemeInfo->topIconInfo.GetBlendColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
class FileIcon;
|
||||
class IFontRepository;
|
||||
class CustomThemeInfo;
|
||||
|
||||
class CustomFileInfoView : public BannerView
|
||||
{
|
||||
public:
|
||||
explicit CustomFileInfoView(const IFontRepository* fontRepository);
|
||||
CustomFileInfoView(const CustomThemeInfo* customThemeInfo, const IFontRepository* fontRepository);
|
||||
|
||||
void Update() override;
|
||||
void Draw(GraphicsContext& graphicsContext) override;
|
||||
@@ -67,6 +68,5 @@ private:
|
||||
Label2DView _secondLine;
|
||||
Label2DView _thirdLine;
|
||||
Label2DView _filenameLabelView;
|
||||
Rgb<8, 8, 8> _backgroundColor;
|
||||
Rgb<8, 8, 8> _textColor;
|
||||
const CustomThemeInfo* _customThemeInfo;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "gui/OamBuilder.h"
|
||||
#include "gui/IVramManager.h"
|
||||
#include "gui/GraphicsContext.h"
|
||||
#include "themes/custom/CustomThemeInfo.h"
|
||||
#include "CustomIconGridItemView.h"
|
||||
|
||||
#define X_OFFSET (-2)
|
||||
@@ -48,6 +49,6 @@ void CustomIconGridItemView::Draw(GraphicsContext& graphicsContext)
|
||||
if (_icon)
|
||||
{
|
||||
_icon->SetPosition(6 + _position.x, 6 + _position.y);
|
||||
_icon->Draw(graphicsContext, Rgb<8, 8, 8>(200, 200, 200));
|
||||
_icon->Draw(graphicsContext, _customThemeInfo->gridIconInfo.GetBlendColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
#include "../../views/IconGridItemView.h"
|
||||
|
||||
class CustomThemeInfo;
|
||||
|
||||
class CustomIconGridItemView : public IconGridItemView
|
||||
{
|
||||
public:
|
||||
CustomIconGridItemView(u32 texVramOffset, u32 plttVramOffset,
|
||||
CustomIconGridItemView(const CustomThemeInfo* customThemeInfo, u32 texVramOffset, u32 plttVramOffset,
|
||||
u32 selectedTexVramOffset, u32 selectedPlttVramOffset)
|
||||
: _texVramOffset(texVramOffset), _plttVramOffset(plttVramOffset)
|
||||
: _customThemeInfo(customThemeInfo), _texVramOffset(texVramOffset), _plttVramOffset(plttVramOffset)
|
||||
, _selectedTexVramOffset(selectedTexVramOffset), _selectedPlttVramOffset(selectedPlttVramOffset) { }
|
||||
|
||||
void Draw(GraphicsContext& graphicsContext) override;
|
||||
@@ -17,8 +19,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
u32 _texVramOffset = 0;
|
||||
u32 _plttVramOffset = 0;
|
||||
u32 _selectedTexVramOffset = 0;
|
||||
u32 _selectedPlttVramOffset = 0;
|
||||
const CustomThemeInfo* _customThemeInfo;
|
||||
u32 _texVramOffset;
|
||||
u32 _plttVramOffset;
|
||||
u32 _selectedTexVramOffset;
|
||||
u32 _selectedPlttVramOffset;
|
||||
};
|
||||
@@ -12,23 +12,24 @@ class MaterialColorScheme;
|
||||
class ITheme;
|
||||
class VramContext;
|
||||
class IFontRepository;
|
||||
class CustomThemeInfo;
|
||||
|
||||
class CustomRomBrowserViewFactory : public IRomBrowserViewFactory
|
||||
{
|
||||
public:
|
||||
CustomRomBrowserViewFactory(const MaterialColorScheme* materialColorScheme,
|
||||
CustomRomBrowserViewFactory(const CustomThemeInfo* customThemeInfo, const MaterialColorScheme* materialColorScheme,
|
||||
const IFontRepository* fontRepository)
|
||||
: _materialColorScheme(materialColorScheme), _fontRepository(fontRepository) { }
|
||||
: _customThemeInfo(customThemeInfo), _materialColorScheme(materialColorScheme), _fontRepository(fontRepository) { }
|
||||
|
||||
IconGridItemView* CreateIconGridItemView() const override
|
||||
{
|
||||
return new CustomIconGridItemView(_gridCellTexVramOffset, _gridCellPlttVramOffset,
|
||||
return new CustomIconGridItemView(_customThemeInfo, _gridCellTexVramOffset, _gridCellPlttVramOffset,
|
||||
_gridCellSelectedTexVramOffset, _gridCellSelectedPlttVramOffset);
|
||||
}
|
||||
|
||||
BannerListItemView* CreateBannerListItemView(VBlankTextureLoader* vblankTextureLoader) const override
|
||||
{
|
||||
return new CustomBannerListItemView(_materialColorScheme, _fontRepository,
|
||||
return new CustomBannerListItemView(_customThemeInfo, _materialColorScheme, _fontRepository,
|
||||
_bannerListCellTexVramOffset, _bannerListCellPlttVramOffset,
|
||||
_bannerListCellSelectedTexVramOffset, _bannerListCellSelectedPlttVramOffset, vblankTextureLoader);
|
||||
}
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
|
||||
std::unique_ptr<BannerView> CreateFileInfoView() const override
|
||||
{
|
||||
return std::make_unique<CustomFileInfoView>(_fontRepository);
|
||||
return std::make_unique<CustomFileInfoView>(_customThemeInfo, _fontRepository);
|
||||
}
|
||||
|
||||
std::unique_ptr<RecyclerViewBase> CreateCoverFlowRecyclerView() const override
|
||||
@@ -77,6 +78,7 @@ private:
|
||||
u32 _bannerListCellSelectedPlttVramOffset;
|
||||
u32 _scrimTexVramOffset;
|
||||
u32 _scrimPlttVramOffset;
|
||||
const CustomThemeInfo* _customThemeInfo;
|
||||
const MaterialColorScheme* _materialColorScheme;
|
||||
const IFontRepository* _fontRepository;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user