Add cheats not found label

This commit is contained in:
Gericom
2026-03-01 13:43:31 +01:00
parent 7f35d524ae
commit a9425eea7c
2 changed files with 20 additions and 5 deletions

View File

@@ -16,6 +16,9 @@
#define TITLE_LABEL_X 20 #define TITLE_LABEL_X 20
#define TITLE_LABEL_Y 16 #define TITLE_LABEL_Y 16
#define NO_CHEATS_FOUND_LABEL_X 20
#define NO_CHEATS_FOUND_LABEL_Y 36
#define LIST_X 16 #define LIST_X 16
#define LIST_Y 36 #define LIST_Y 36
@@ -23,14 +26,17 @@ CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr<CheatsViewModel> vi
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();

View File

@@ -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;