mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
Add love.sensor.getName(sensorType)
This commit is contained in:
@@ -124,6 +124,19 @@ std::vector<void*> Sensor::getHandles()
|
||||
return nativeSensor;
|
||||
}
|
||||
|
||||
const char *Sensor::getSensorName(SensorType type)
|
||||
{
|
||||
if (sensors[type] == nullptr)
|
||||
{
|
||||
const char *name = nullptr;
|
||||
getConstant(type, name);
|
||||
|
||||
throw love::Exception("\"%s\" sensor is not enabled", name);
|
||||
}
|
||||
|
||||
return SDL_SensorGetName(sensors[type]);
|
||||
}
|
||||
|
||||
Sensor::SensorType Sensor::convert(SDL_SensorType type)
|
||||
{
|
||||
switch (type)
|
||||
|
||||
Reference in New Issue
Block a user