Replaced Joystick:saveGamepadMapping with love.joystick.saveGamepadMappings, which saves all gamepad mappings from both recently-used joysticks and recently-modified mappings. saveGamepadMappings returns a string of newline-separated mappings and takes an optional filename argument which writes it to a file.

This commit is contained in:
Alex Szpakowski
2014-06-05 00:25:34 -03:00
parent 10e0d4b900
commit ddb9997ead
6 changed files with 60 additions and 45 deletions
+6 -1
View File
@@ -28,6 +28,7 @@
#include <string>
#include <vector>
#include <list>
#include <map>
namespace love
{
@@ -57,7 +58,7 @@ public:
bool setGamepadMapping(const std::string &guid, Joystick::GamepadInput gpinput, Joystick::JoystickInput joyinput);
Joystick::JoystickInput getGamepadMapping(const std::string &guid, Joystick::GamepadInput gpinput);
void loadGamepadMappings(const std::string &mappings);
std::string saveGamepadMapping(const std::string &pguid);
std::string saveGamepadMappings();
private:
@@ -76,6 +77,10 @@ private:
// Persistent list of all Joysticks which have been connected at some point.
std::list<Joystick *> joysticks;
// Persistent map indicating GUIDs for Gamepads which have been connected or
// modified at some point.
std::map<std::string, bool> recentGamepadGUIDs;
}; // JoystickModule
} // sdl