Multiple joystick support. Createcollections argument creates menu.txt instead of menu.xml

This commit is contained in:
Don Honerbrink 2015-08-03 09:35:14 -05:00
parent fe214664a5
commit 1f18d41509
3 changed files with 11 additions and 15 deletions

View File

@ -133,21 +133,10 @@ bool CollectionInfoBuilder::createCollectionDirectory(std::string name)
settingsFile << "#media.video = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "video") << std::endl;
settingsFile.close();
filename = Utils::combinePath(collectionPath, "menu.xml");
filename = Utils::combinePath(collectionPath, "menu.txt");
std::cout << "Creating file \"" << filename << "\"" << std::endl;
std::ofstream menuFile;
menuFile.open(filename.c_str());
menuFile << "<menu>" << std::endl;
menuFile << std::endl;
menuFile << "<!-- uncomment this line and edit the example below to have a submenu" << std::endl;
menuFile << std::endl;
menuFile << " <item collection=\"Some collection name\"/>" << std::endl;
menuFile << " <item collection=\"Arcade\"/>" << std::endl;
menuFile << std::endl;
menuFile << "uncomment this line and edit the example above to have a submenu -->" << std::endl;
menuFile << std::endl;
menuFile << "</menu>" << std::endl;
menuFile.close();
return true;

View File

@ -26,7 +26,6 @@
UserInput::UserInput(Configuration &c)
: config_(c)
, joystick_(NULL)
{
for(unsigned int i = 0; i < KeyCodeMax; ++i)
{
@ -37,6 +36,13 @@ UserInput::UserInput(Configuration &c)
UserInput::~UserInput()
{
for(std::vector<SDL_Joystick *>::iterator it = joysticks_.begin(); it != joysticks_.end(); it++)
{
if(*it)
{
SDL_JoystickClose(*it);
}
}
}
bool UserInput::initialize()

View File

@ -14,10 +14,11 @@
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <map>
#include <SDL2/SDL.h>
#include <SDL2/SDL_joystick.h>
#include <map>
#include <string>
#include <vector>
class Configuration;
class InputHandler;
@ -54,7 +55,7 @@ public:
private:
bool MapKey(std::string keyDescription, KeyCode_E key);
Configuration &config_;
SDL_Joystick *joystick_;
std::vector<SDL_Joystick *> joysticks_;
InputHandler *keyHandlers_[KeyCodeMax];
bool lastKeyState_[KeyCodeMax];