mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Add ability to set the position of the top screen cover image in custom themes
This commit is contained in:
@@ -35,6 +35,8 @@ public:
|
||||
virtual FileRecyclerAdapter* CreateCoverFlowRecyclerAdapter(
|
||||
RomBrowserViewModel* viewModel, const IThemeFileIconFactory* themeFileIconFactory,
|
||||
VBlankTextureLoader* vblankTextureLoader) const = 0;
|
||||
|
||||
virtual Point GetTopCoverPosition() const = 0;
|
||||
};
|
||||
|
||||
inline IRomBrowserViewFactory::~IRomBrowserViewFactory() { }
|
||||
|
||||
@@ -65,6 +65,11 @@ public:
|
||||
themeFileIconFactory, this, vblankTextureLoader, &viewModel->GetCoverRepository());
|
||||
}
|
||||
|
||||
Point GetTopCoverPosition() const override
|
||||
{
|
||||
return Point(75, 18);
|
||||
}
|
||||
|
||||
private:
|
||||
const MaterialColorScheme* _materialColorScheme;
|
||||
const IFontRepository* _fontRepository;
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include "romBrowser/views/CoverFlowRecyclerView.h"
|
||||
#include "romBrowser/viewModels/RomBrowserViewModel.h"
|
||||
#include "romBrowser/DisplayMode/CoverFlowFileRecyclerAdapter.h"
|
||||
#include "themes/custom/CustomThemeInfo.h"
|
||||
|
||||
class MaterialColorScheme;
|
||||
class ITheme;
|
||||
class VramContext;
|
||||
class IFontRepository;
|
||||
class CustomThemeInfo;
|
||||
|
||||
class CustomRomBrowserViewFactory : public IRomBrowserViewFactory
|
||||
{
|
||||
@@ -65,6 +65,11 @@ public:
|
||||
themeFileIconFactory, this, vblankTextureLoader, &viewModel->GetCoverRepository());
|
||||
}
|
||||
|
||||
Point GetTopCoverPosition() const override
|
||||
{
|
||||
return _customThemeInfo->topCoverInfo.GetPosition();
|
||||
}
|
||||
|
||||
void LoadResources(const ITheme& theme, const VramContext& mainVramContext);
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,6 +20,7 @@ RomBrowserTopScreenView::RomBrowserTopScreenView(
|
||||
, _themeFileIconFactory(themeFileIconFactory)
|
||||
, _fileInfoView(romBrowserViewFactory->CreateFileInfoView())
|
||||
, _showCover(displayMode->ShowCoverOnTopScreen())
|
||||
, _coverPosition(romBrowserViewFactory->GetTopCoverPosition())
|
||||
{
|
||||
AddChildTail(_fileInfoView.get());
|
||||
}
|
||||
@@ -135,11 +136,11 @@ void RomBrowserTopScreenView::VBlank()
|
||||
REG_BG3PB_SUB = 0;
|
||||
REG_BG3PC_SUB = 0;
|
||||
REG_BG3PD_SUB = -0x100;
|
||||
REG_BG3X_SUB = -75 << 8;
|
||||
REG_BG3Y_SUB = 113 << 8;
|
||||
REG_BG3X_SUB = (-_coverPosition.x) << 8;
|
||||
REG_BG3Y_SUB = (96 + _coverPosition.y - 1) << 8;
|
||||
REG_BG3CNT_SUB = 0x0705;
|
||||
REG_DISPCNT_SUB |= ((1 << 3) | (1 << 5)) << 8;
|
||||
gfx_setSubWindow0(75, 18, 75 + 106, 18 + 96);
|
||||
gfx_setSubWindow0(_coverPosition.x, _coverPosition.y, _coverPosition.x + 106, _coverPosition.y + 96);
|
||||
REG_WININ_SUB = 0x002A;
|
||||
REG_WINOUT_SUB = ~(1 << 3);
|
||||
}
|
||||
|
||||
@@ -36,4 +36,5 @@ private:
|
||||
bool _iconGraphicsUploaded = false;
|
||||
bool _coverGraphicsUploaded = false;
|
||||
bool _showCover;
|
||||
Point _coverPosition;
|
||||
};
|
||||
Reference in New Issue
Block a user