mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 17:16:57 +02:00
Further work on support for cheats
Cheats can now be enabled/disabled and games can be launched with cheats
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "gui/views/ViewContainer.h"
|
||||
#include "gui/views/Label2DView.h"
|
||||
#include "cheats/CheatCategory.h"
|
||||
#include "cheats/Cheat.h"
|
||||
|
||||
class MaterialColorScheme;
|
||||
class IFontRepository;
|
||||
@@ -8,14 +10,22 @@ class IFontRepository;
|
||||
class CheatListItemView : public ViewContainer
|
||||
{
|
||||
public:
|
||||
CheatListItemView(const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository);
|
||||
struct VramOffsets
|
||||
{
|
||||
u32 folderIconVramOffset = 0;
|
||||
u32 checkboxUncheckedIconVramOffset = 0;
|
||||
u32 checkboxCheckedIconVramOffset = 0;
|
||||
u32 cheatSelectorVramOffset = 0;
|
||||
};
|
||||
|
||||
CheatListItemView(const VramOffsets& vramOffsets, const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository);
|
||||
|
||||
void Update() override;
|
||||
void Draw(GraphicsContext& graphicsContext) override;
|
||||
|
||||
Rectangle GetBounds() const override
|
||||
{
|
||||
return Rectangle(_position.x, _position.y, 256, 24);
|
||||
return Rectangle(_position.x, _position.y, 224, 24);
|
||||
}
|
||||
|
||||
void SetName(const char* name)
|
||||
@@ -23,13 +33,23 @@ public:
|
||||
_nameLabel.SetText(name);
|
||||
}
|
||||
|
||||
void SetIcon(u32 iconVramOffset)
|
||||
void SetCategory(const CheatCategory* cheatCategory)
|
||||
{
|
||||
_iconVramOffset = iconVramOffset;
|
||||
_cheat = nullptr;
|
||||
_nameLabel.SetText(cheatCategory->GetName());
|
||||
_iconVramOffset = _vramOffsets.folderIconVramOffset;
|
||||
}
|
||||
|
||||
void SetCheat(const Cheat* cheat)
|
||||
{
|
||||
_cheat = cheat;
|
||||
_nameLabel.SetText(_cheat->GetName());
|
||||
}
|
||||
|
||||
private:
|
||||
Label2DView _nameLabel;
|
||||
u32 _iconVramOffset = 0;
|
||||
VramOffsets _vramOffsets;
|
||||
const MaterialColorScheme* _materialColorScheme;
|
||||
u32 _iconVramOffset = 0;
|
||||
const Cheat* _cheat = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user