mirror of https://github.com/encounter/SDL.git
Fixed Windows accelerometer data units
This commit is contained in:
parent
3d942ccc15
commit
e9c94ac0b3
|
@ -167,9 +167,9 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
|
|||
valueX.vt == VT_R8 && valueY.vt == VT_R8 && valueZ.vt == VT_R8) {
|
||||
float values[3];
|
||||
|
||||
values[0] = (float)valueX.dblVal;
|
||||
values[1] = (float)valueY.dblVal;
|
||||
values[2] = (float)valueZ.dblVal;
|
||||
values[0] = (float)valueX.dblVal * SDL_STANDARD_GRAVITY;
|
||||
values[1] = (float)valueY.dblVal * SDL_STANDARD_GRAVITY;
|
||||
values[2] = (float)valueZ.dblVal * SDL_STANDARD_GRAVITY;
|
||||
SDL_PrivateSensorUpdate(SDL_sensors[i].sensor_opened, values, 3);
|
||||
}
|
||||
break;
|
||||
|
@ -179,11 +179,12 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
|
|||
hrZ = ISensorDataReport_GetSensorValue(pNewData, &SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND, &valueZ);
|
||||
if (SUCCEEDED(hrX) && SUCCEEDED(hrY) && SUCCEEDED(hrZ) &&
|
||||
valueX.vt == VT_R8 && valueY.vt == VT_R8 && valueZ.vt == VT_R8) {
|
||||
const float DEGREES_TO_RADIANS = (float)(M_PI / 180.0f);
|
||||
float values[3];
|
||||
|
||||
values[0] = (float)(valueX.dblVal * (M_PI / 180.0));
|
||||
values[1] = (float)(valueY.dblVal * (M_PI / 180.0));
|
||||
values[2] = (float)(valueZ.dblVal * (M_PI / 180.0));
|
||||
values[0] = (float)valueX.dblVal * DEGREES_TO_RADIANS;
|
||||
values[1] = (float)valueY.dblVal * DEGREES_TO_RADIANS;
|
||||
values[2] = (float)valueZ.dblVal * DEGREES_TO_RADIANS;
|
||||
SDL_PrivateSensorUpdate(SDL_sensors[i].sensor_opened, values, 3);
|
||||
}
|
||||
break;
|
||||
|
@ -302,6 +303,7 @@ static int ConnectSensor(ISensor *sensor)
|
|||
new_sensor = &SDL_sensors[SDL_num_sensors];
|
||||
++SDL_num_sensors;
|
||||
|
||||
SDL_zerop(new_sensor);
|
||||
new_sensor->id = SDL_GetNextSensorInstanceID();
|
||||
new_sensor->sensor = sensor;
|
||||
new_sensor->type = type;
|
||||
|
|
Loading…
Reference in New Issue