mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Load controller db from file
This commit is contained in:
parent
d528160684
commit
dae8035314
1 changed files with 8 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue