source/code/gamecontroller.cpp
browsing at commit = 826cf1768f8e6e369cf64447c99e1903d43a8695
/*
===========================================================================
blockattack - Block Attack - Rise of the Blocks
Copyright (C) 2005-2016 Poul Sander
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Source information and contacts persons can be found at
http://www.blockattack.net
===========================================================================
*/
#include "gamecontroller.h"
#include "SDL_gamecontroller.h"
#include <iostream>
void InitGameControllers() {
std::cout << "Number of Game controllers: " << SDL_NumJoysticks() << std::endl;
SDL_GameController *controller = nullptr;
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
if (SDL_IsGameController(i)) {
controller = SDL_GameControllerOpen(i);
std::cout << "Supported game controller detected: " << SDL_GameControllerName(controller) << std::endl;
}
}
}