mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Added love.touch.getPressure(touchid). Not useful on most touch-capable devices, but I do expect Apple's Force Touch to make it into iPhones in the near future.
This commit is contained in:
@@ -51,6 +51,15 @@ void Touch::getPosition(int64 id, double &x, double &y) const
|
||||
y = it->second.y;
|
||||
}
|
||||
|
||||
double Touch::getPressure(int64 id) const
|
||||
{
|
||||
const auto it = touches.find(id);
|
||||
if (it == touches.end())
|
||||
throw love::Exception("Invalid active touch ID: %d", id);
|
||||
|
||||
return it->second.pressure;
|
||||
}
|
||||
|
||||
const char *Touch::getName() const
|
||||
{
|
||||
return "love.touch.sdl";
|
||||
|
||||
@@ -43,11 +43,12 @@ public:
|
||||
|
||||
virtual ~Touch() {}
|
||||
|
||||
virtual std::vector<int64> getIDs() const;
|
||||
virtual void getPosition(int64 id, double &x, double &y) const;
|
||||
std::vector<int64> getIDs() const override;
|
||||
void getPosition(int64 id, double &x, double &y) const override;
|
||||
double getPressure(int64 id) const override;
|
||||
|
||||
// Implements Module.
|
||||
virtual const char *getName() const;
|
||||
const char *getName() const override;
|
||||
|
||||
// SDL has functions to query the state of touch presses, but unfortunately
|
||||
// they are updated on a different thread in some backends, which causes
|
||||
|
||||
Reference in New Issue
Block a user