Skip to content

Commit

Permalink
[sdl] Support for older SDL versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 7, 2024
1 parent e26bd59 commit 504dd19
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ossia/protocols/joystick/game_controller_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,15 @@ void game_controller_protocol::set_device(ossia::net::device_base& dev)
}
}

for(int i = SDL_SENSOR_UNKNOWN; i <= SDL_SENSOR_GYRO_R; i++)
const int max_sensor =
#if SDL_VERSION_ATLEAST(2, 26, 0)
SDL_SENSOR_GYRO_R
#else
SDL_SENSOR_GYRO
#endif
;

for(int i = SDL_SENSOR_UNKNOWN; i <= max_sensor; i++)
{
if(SDL_GameControllerHasSensor(m_joystick, static_cast<SDL_SensorType>(i))
== SDL_TRUE)
Expand Down

0 comments on commit 504dd19

Please sign in to comment.