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:
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "core/math/Point.h"
|
||||
#include "InputKey.h"
|
||||
|
||||
class InputProvider
|
||||
@@ -14,6 +14,23 @@ public:
|
||||
/// @return \c true if any of the keys in the \p mask is being held, or \c false otherwise.
|
||||
bool Current(InputKey mask) const { return static_cast<bool>(_currentKeys & mask); }
|
||||
|
||||
/// @brief Returns the current touch point if the screen is being touched.
|
||||
/// @param touchPoint The current touch point if the screen is being touched.
|
||||
/// @return \c true if the screen is being touched, or \c false otherwise.
|
||||
bool GetCurrentTouchPoint(Point& touchPoint)
|
||||
{
|
||||
if (Current(InputKey::Touch))
|
||||
{
|
||||
touchPoint = _currentTouchPoint;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
touchPoint = Point(0, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Returns a bitmask of the keys that went from unpressed to pressed in the latest update.
|
||||
/// @return A bitmask of the keys that went from unpressed to pressed in the latest update.
|
||||
InputKey GetTriggeredKeys() const
|
||||
@@ -46,13 +63,16 @@ public:
|
||||
_currentKeys = InputKey::None;
|
||||
_triggeredKeys = InputKey::None;
|
||||
_releasedKeys = InputKey::None;
|
||||
_currentTouchPoint = Point(0, 0);
|
||||
}
|
||||
|
||||
protected:
|
||||
InputKey _currentKeys;
|
||||
InputKey _triggeredKeys;
|
||||
InputKey _releasedKeys;
|
||||
Point _currentTouchPoint;
|
||||
|
||||
InputProvider()
|
||||
: _currentKeys(InputKey::None), _triggeredKeys(InputKey::None), _releasedKeys(InputKey::None) { }
|
||||
: _currentKeys(InputKey::None), _triggeredKeys(InputKey::None), _releasedKeys(InputKey::None)
|
||||
, _currentTouchPoint(0, 0) { }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user