mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Add touch input support, add fast scrolling support for coverflow display mode, fix use after free bug in banner list mode
This commit is contained in:
@@ -4,15 +4,14 @@
|
||||
#include "gui/views/View.h"
|
||||
#include "../FileType/FileCover.h"
|
||||
#include "gui/VBlankTextureLoader.h"
|
||||
|
||||
#define COVER_THICKNESS (fix32<12>(0.23).GetRawValue())
|
||||
#include "romBrowser/viewModels/RomBrowserItemViewModel.h"
|
||||
#include "RomBrowserItemInputHandler.h"
|
||||
|
||||
class CoverView : public View
|
||||
{
|
||||
public:
|
||||
explicit CoverView(VBlankTextureLoader* vblankTextureLoader)
|
||||
: _vblankTextureLoader(vblankTextureLoader) { }
|
||||
SHARED_ONLY(CoverView)
|
||||
|
||||
public:
|
||||
~CoverView() override
|
||||
{
|
||||
_vblankTextureLoader->CancelLoad(_textureLoadRequest);
|
||||
@@ -20,8 +19,14 @@ public:
|
||||
|
||||
void InitVram(const VramContext& vramContext) override;
|
||||
|
||||
void Update() override;
|
||||
void Draw(GraphicsContext& graphicsContext) override;
|
||||
|
||||
bool HandleInput(const InputProvider& inputProvider, FocusManager& focusManager) override;
|
||||
void HandlePenDown(const Point& touchPoint, FocusManager& focusManager) override;
|
||||
void HandlePenMove(const Point& touchPoint, FocusManager& focusManager) override;
|
||||
void HandlePenUp(const Point& lastTouchPoint, FocusManager& focusManager) override;
|
||||
|
||||
Rectangle GetBounds() const override
|
||||
{
|
||||
return Rectangle(_position.x - (COVER_WIDTH / 2), _position.y - (COVER_HEIGHT / 2), COVER_WIDTH, COVER_HEIGHT);
|
||||
@@ -41,10 +46,21 @@ public:
|
||||
|
||||
void UploadCoverGraphics();
|
||||
|
||||
RomBrowserItemViewModel& GetViewModel() const
|
||||
{
|
||||
return *_viewModel;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<RomBrowserItemViewModel> _viewModel;
|
||||
VBlankTextureLoader* _vblankTextureLoader;
|
||||
AtomicSharedPtr<FileCover> _cover;
|
||||
VBlankTextureLoadRequest _textureLoadRequest;
|
||||
u32 _texVramOffset = 0;
|
||||
u32 _plttVramOffset = 0;
|
||||
RomBrowserItemInputHandler _inputHandler;
|
||||
|
||||
CoverView(std::unique_ptr<RomBrowserItemViewModel> viewModel, VBlankTextureLoader* vblankTextureLoader)
|
||||
: _viewModel(std::move(viewModel)), _vblankTextureLoader(vblankTextureLoader)
|
||||
, _inputHandler(this, _viewModel.get()) { }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user