mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 00:56:55 +02:00
Add cheats not found label
This commit is contained in:
@@ -13,24 +13,30 @@
|
|||||||
#include "gui/DescendingStackVramManager.h"
|
#include "gui/DescendingStackVramManager.h"
|
||||||
#include "CheatsBottomSheetView.h"
|
#include "CheatsBottomSheetView.h"
|
||||||
|
|
||||||
#define TITLE_LABEL_X 20
|
#define TITLE_LABEL_X 20
|
||||||
#define TITLE_LABEL_Y 16
|
#define TITLE_LABEL_Y 16
|
||||||
|
|
||||||
#define LIST_X 16
|
#define NO_CHEATS_FOUND_LABEL_X 20
|
||||||
#define LIST_Y 36
|
#define NO_CHEATS_FOUND_LABEL_Y 36
|
||||||
|
|
||||||
|
#define LIST_X 16
|
||||||
|
#define LIST_Y 36
|
||||||
|
|
||||||
CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr<CheatsViewModel> viewModel,
|
CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr<CheatsViewModel> viewModel,
|
||||||
const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository,
|
const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository,
|
||||||
FocusManager* focusManager)
|
FocusManager* focusManager)
|
||||||
: _viewModel(std::move(viewModel))
|
: _viewModel(std::move(viewModel))
|
||||||
, _titleLabel(128, 16, 25, fontRepository->GetFont(FontType::Medium11))
|
, _titleLabel(64, 16, 25, fontRepository->GetFont(FontType::Medium11))
|
||||||
|
, _noCheatsFoundLabel(96, 16, 25, fontRepository->GetFont(FontType::Regular10))
|
||||||
, _cheatListRecycler(std::make_unique<RecyclerView>(LIST_X, LIST_Y, 224, 124, RecyclerView::Mode::VerticalList))
|
, _cheatListRecycler(std::make_unique<RecyclerView>(LIST_X, LIST_Y, 224, 124, RecyclerView::Mode::VerticalList))
|
||||||
, _materialColorScheme(materialColorScheme)
|
, _materialColorScheme(materialColorScheme)
|
||||||
, _fontRepository(fontRepository)
|
, _fontRepository(fontRepository)
|
||||||
, _focusManager(focusManager)
|
, _focusManager(focusManager)
|
||||||
{
|
{
|
||||||
_titleLabel.SetText(u"Cheats");
|
_titleLabel.SetText(u"Cheats");
|
||||||
|
_noCheatsFoundLabel.SetText(u"No cheats found.");
|
||||||
AddChildTail(&_titleLabel);
|
AddChildTail(&_titleLabel);
|
||||||
|
AddChildTail(&_noCheatsFoundLabel);
|
||||||
AddChildTail(_cheatListRecycler.get());
|
AddChildTail(_cheatListRecycler.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +70,7 @@ void CheatsBottomSheetView::InitVram(const VramContext& vramContext)
|
|||||||
void CheatsBottomSheetView::Update()
|
void CheatsBottomSheetView::Update()
|
||||||
{
|
{
|
||||||
_titleLabel.SetPosition(TITLE_LABEL_X, _position.y + TITLE_LABEL_Y);
|
_titleLabel.SetPosition(TITLE_LABEL_X, _position.y + TITLE_LABEL_Y);
|
||||||
|
_noCheatsFoundLabel.SetPosition(NO_CHEATS_FOUND_LABEL_X, _position.y + NO_CHEATS_FOUND_LABEL_Y);
|
||||||
_cheatListRecycler->SetPosition(LIST_X, _position.y + LIST_Y);
|
_cheatListRecycler->SetPosition(LIST_X, _position.y + LIST_Y);
|
||||||
if (_viewModel->GetState() == CheatsViewModel::State::DisplayCheats)
|
if (_viewModel->GetState() == CheatsViewModel::State::DisplayCheats)
|
||||||
{
|
{
|
||||||
@@ -119,6 +126,13 @@ void CheatsBottomSheetView::Draw(GraphicsContext& graphicsContext)
|
|||||||
_titleLabel.SetBackgroundColor(backColor);
|
_titleLabel.SetBackgroundColor(backColor);
|
||||||
_titleLabel.SetForegroundColor(_materialColorScheme->onSurface);
|
_titleLabel.SetForegroundColor(_materialColorScheme->onSurface);
|
||||||
_titleLabel.Draw(graphicsContext);
|
_titleLabel.Draw(graphicsContext);
|
||||||
|
|
||||||
|
if (_viewModel->GetState() == CheatsViewModel::State::NoCheats)
|
||||||
|
{
|
||||||
|
_noCheatsFoundLabel.SetBackgroundColor(backColor);
|
||||||
|
_noCheatsFoundLabel.SetForegroundColor(_materialColorScheme->onSurface);
|
||||||
|
_noCheatsFoundLabel.Draw(graphicsContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
graphicsContext.SetPriority(oldPrio);
|
graphicsContext.SetPriority(oldPrio);
|
||||||
graphicsContext.ResetClipArea();
|
graphicsContext.ResetClipArea();
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::unique_ptr<CheatsViewModel> _viewModel;
|
std::unique_ptr<CheatsViewModel> _viewModel;
|
||||||
Label2DView _titleLabel;
|
Label2DView _titleLabel;
|
||||||
|
Label2DView _noCheatsFoundLabel;
|
||||||
std::unique_ptr<RecyclerView> _cheatListRecycler;
|
std::unique_ptr<RecyclerView> _cheatListRecycler;
|
||||||
CheatsAdapter* _cheatsAdapter = nullptr;
|
CheatsAdapter* _cheatsAdapter = nullptr;
|
||||||
const MaterialColorScheme* _materialColorScheme;
|
const MaterialColorScheme* _materialColorScheme;
|
||||||
|
|||||||
Reference in New Issue
Block a user