Sensor in Joystick.

This commit is contained in:
Miku AuahDark
2022-12-05 23:09:50 +08:00
parent bdbd4a9a58
commit 0442128006
6 changed files with 191 additions and 0 deletions
+13
View File
@@ -156,6 +156,19 @@ Sensor::SensorType Sensor::convert(SDL_SensorType type)
}
}
SDL_SensorType Sensor::convert(Sensor::SensorType type)
{
switch (type)
{
case SENSOR_ACCELEROMETER:
return SDL_SENSOR_ACCEL;
case SENSOR_GYROSCOPE:
return SDL_SENSOR_GYRO;
default:
return SDL_SENSOR_UNKNOWN;
}
}
}
}
}
+1
View File
@@ -54,6 +54,7 @@ public:
const char *getSensorName(SensorType type) override;
static SensorType convert(SDL_SensorType type);
static SDL_SensorType convert(SensorType type);
private:
std::map<SensorType, SDL_Sensor*> sensors;