mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-21 15:48:51 -05:00
Load controller db from file
This commit is contained in:
parent
d528160684
commit
dae8035314
@ -39,6 +39,14 @@ extern "C" {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
const char* controllerDb = "gamecontrollerdb.txt";
|
||||
int mappingsAdded = SDL_GameControllerAddMappingsFromFile(controllerDb);
|
||||
if (mappingsAdded >= 0) {
|
||||
SPDLOG_INFO("Added SDL game controllers from \"{}\" ({})", controllerDb, mappingsAdded);
|
||||
} else {
|
||||
SPDLOG_ERROR("Failed add SDL game controller mappings from \"{}\" ({})", controllerDb, SDL_GetError());
|
||||
}
|
||||
|
||||
// TODO: This for loop is debug. Burn it with fire.
|
||||
for (size_t i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
|
Loading…
Reference in New Issue
Block a user