Browse Source

Renamed Joystick:getGUID to Joystick:getProductGUID for greater clarity

Alex Szpakowski 12 years ago
parent
commit
4fcf47a427

+ 1 - 1
src/modules/event/sdl/Event.cpp

@@ -115,7 +115,7 @@ Message *Event::convert(const SDL_Event &e) const
 		if (!love::keyboard::Keyboard::getConstant(key, txt))
 		if (!love::keyboard::Keyboard::getConstant(key, txt))
 			txt = "unknown";
 			txt = "unknown";
 		arg1 = new Variant(txt, strlen(txt));
 		arg1 = new Variant(txt, strlen(txt));
-		arg2 = new Variant(e.key.repeat == SDL_TRUE);
+		arg2 = new Variant(e.key.repeat != 0);
 		msg = new Message("keypressed", arg1, arg2);
 		msg = new Message("keypressed", arg1, arg2);
 		arg1->release();
 		arg1->release();
 		arg2->release();
 		arg2->release();

+ 1 - 1
src/modules/joystick/Joystick.h

@@ -152,7 +152,7 @@ public:
 
 
 	virtual void *getHandle() const = 0;
 	virtual void *getHandle() const = 0;
 
 
-	virtual std::string getGUID() const = 0;
+	virtual std::string getProductGUID() const = 0;
 	virtual int getInstanceID() const = 0;
 	virtual int getInstanceID() const = 0;
 	virtual int getID() const = 0;
 	virtual int getID() const = 0;
 
 

+ 4 - 4
src/modules/joystick/JoystickModule.h

@@ -72,18 +72,18 @@ public:
 
 
 	/**
 	/**
 	 * Sets the virtual Gamepad mapping for a joystick input value for all
 	 * Sets the virtual Gamepad mapping for a joystick input value for all
-	 * joystick devices with the specified joystick GUID.
+	 * joystick devices with the specified joystick product GUID.
 	 * If any joysticks with the specified GUID are connected, they will be
 	 * If any joysticks with the specified GUID are connected, they will be
 	 * added as Gamepads if they aren't already, otherwise their Gamepad mapping
 	 * added as Gamepads if they aren't already, otherwise their Gamepad mapping
 	 * will be updated.
 	 * will be updated.
 	 **/
 	 **/
-	virtual bool setGamepadMapping(const std::string &guid, Joystick::GamepadInput gpinput, Joystick::JoystickInput joyinput) = 0;
+	virtual bool setGamepadMapping(const std::string &pguid, Joystick::GamepadInput gpinput, Joystick::JoystickInput joyinput) = 0;
 
 
 	/**
 	/**
 	 * Gets the joystick input value the gamepad input value is bound to for the
 	 * Gets the joystick input value the gamepad input value is bound to for the
-	 * specified joystick GUID.
+	 * specified joystick product GUID.
 	 **/
 	 **/
-	virtual Joystick::JoystickInput getGamepadMapping(const std::string &guid, Joystick::GamepadInput gpinput) = 0;
+	virtual Joystick::JoystickInput getGamepadMapping(const std::string &pguid, Joystick::GamepadInput gpinput) = 0;
 
 
 }; // JoystickModule
 }; // JoystickModule
 
 

+ 3 - 3
src/modules/joystick/sdl/Joystick.cpp

@@ -65,7 +65,7 @@ bool Joystick::open(int deviceindex)
 		SDL_JoystickGUID sdlguid = SDL_JoystickGetGUID(joyhandle);
 		SDL_JoystickGUID sdlguid = SDL_JoystickGetGUID(joyhandle);
 		SDL_JoystickGetGUIDString(sdlguid, cstr, (int) sizeof(cstr));
 		SDL_JoystickGetGUIDString(sdlguid, cstr, (int) sizeof(cstr));
 
 
-		guid = std::string(cstr);
+		pguid = std::string(cstr);
 
 
 		// See if SDL thinks this is a Game Controller.
 		// See if SDL thinks this is a Game Controller.
 		openGamepad(deviceindex);
 		openGamepad(deviceindex);
@@ -237,10 +237,10 @@ void *Joystick::getHandle() const
 	return joyhandle;
 	return joyhandle;
 }
 }
 
 
-std::string Joystick::getGUID() const
+std::string Joystick::getProductGUID() const
 {
 {
 	// SDL2's GUIDs identify *classes* of devices, instead of unique devices.
 	// SDL2's GUIDs identify *classes* of devices, instead of unique devices.
-	return guid;
+	return pguid;
 }
 }
 
 
 int Joystick::getInstanceID() const
 int Joystick::getInstanceID() const

+ 2 - 2
src/modules/joystick/sdl/Joystick.h

@@ -70,7 +70,7 @@ public:
 
 
 	void *getHandle() const;
 	void *getHandle() const;
 
 
-	std::string getGUID() const;
+	std::string getProductGUID() const;
 	int getInstanceID() const;
 	int getInstanceID() const;
 	int getID() const;
 	int getID() const;
 
 
@@ -91,7 +91,7 @@ private:
 	SDL_GameController *controller;
 	SDL_GameController *controller;
 
 
 	SDL_JoystickID instanceid;
 	SDL_JoystickID instanceid;
-	std::string guid;
+	std::string pguid;
 	int id;
 	int id;
 
 
 	std::string name;
 	std::string name;

+ 5 - 5
src/modules/joystick/sdl/JoystickModule.cpp

@@ -109,14 +109,14 @@ love::joystick::Joystick *JoystickModule::addJoystick(int deviceindex)
 	if (deviceindex < 0 || deviceindex >= SDL_NumJoysticks())
 	if (deviceindex < 0 || deviceindex >= SDL_NumJoysticks())
 		return 0;
 		return 0;
 
 
-	std::string guidstr = getDeviceGUID(deviceindex);
+	std::string guidstr = getDeviceProductGUID(deviceindex);
 
 
 	joystick::Joystick *joystick = 0;
 	joystick::Joystick *joystick = 0;
 
 
 	for (size_t i = 0; i < joysticks.size(); i++)
 	for (size_t i = 0; i < joysticks.size(); i++)
 	{
 	{
 		// Try to re-use a disconnected Joystick with the same GUID.
 		// Try to re-use a disconnected Joystick with the same GUID.
-		if (!joysticks[i]->isConnected() && joysticks[i]->getGUID() == guidstr)
+		if (!joysticks[i]->isConnected() && joysticks[i]->getProductGUID() == guidstr)
 		{
 		{
 			joystick = joysticks[i];
 			joystick = joysticks[i];
 			joystick->open(deviceindex);
 			joystick->open(deviceindex);
@@ -398,13 +398,13 @@ void JoystickModule::checkGamepads(const std::string &guid) const
 		if (!SDL_IsGameController(d_index))
 		if (!SDL_IsGameController(d_index))
 			continue;
 			continue;
 
 
-		if (guid.compare(getDeviceGUID(d_index)) != 0)
+		if (guid.compare(getDeviceProductGUID(d_index)) != 0)
 			continue;
 			continue;
 
 
 		std::vector<love::joystick::Joystick *>::const_iterator it;
 		std::vector<love::joystick::Joystick *>::const_iterator it;
 		for (it = activeSticks.begin(); it != activeSticks.end(); ++it)
 		for (it = activeSticks.begin(); it != activeSticks.end(); ++it)
 		{
 		{
-			if ((*it)->isGamepad() || guid.compare((*it)->getGUID()) != 0)
+			if ((*it)->isGamepad() || guid.compare((*it)->getProductGUID()) != 0)
 				continue;
 				continue;
 
 
 			// Big hack time: open the index as a game controller and compare
 			// Big hack time: open the index as a game controller and compare
@@ -422,7 +422,7 @@ void JoystickModule::checkGamepads(const std::string &guid) const
 	}
 	}
 }
 }
 
 
-std::string JoystickModule::getDeviceGUID(int deviceindex) const
+std::string JoystickModule::getDeviceProductGUID(int deviceindex) const
 {
 {
 	if (deviceindex < 0 || deviceindex >= SDL_NumJoysticks())
 	if (deviceindex < 0 || deviceindex >= SDL_NumJoysticks())
 		return std::string("");
 		return std::string("");

+ 1 - 1
src/modules/joystick/sdl/JoystickModule.h

@@ -63,7 +63,7 @@ private:
 	void checkGamepads(const std::string &guid) const;
 	void checkGamepads(const std::string &guid) const;
 
 
 	// SDL2's GUIDs identify *classes* of devices, instead of unique devices.
 	// SDL2's GUIDs identify *classes* of devices, instead of unique devices.
-	std::string getDeviceGUID(int deviceindex) const;
+	std::string getDeviceProductGUID(int deviceindex) const;
 
 
 	// Lists of currently connected Joysticks.
 	// Lists of currently connected Joysticks.
 	std::vector<Joystick *> activeSticks;
 	std::vector<Joystick *> activeSticks;

+ 3 - 3
src/modules/joystick/sdl/wrap_Joystick.cpp

@@ -57,10 +57,10 @@ int w_Joystick_getID(lua_State *L)
 	return 1;
 	return 1;
 }
 }
 
 
-int w_Joystick_getGUID(lua_State *L)
+int w_Joystick_getProductGUID(lua_State *L)
 {
 {
 	Joystick *j = luax_checkjoystick(L, 1);
 	Joystick *j = luax_checkjoystick(L, 1);
-	luax_pushstring(L, j->getGUID());
+	luax_pushstring(L, j->getProductGUID());
 	return 1;
 	return 1;
 }
 }
 
 
@@ -183,7 +183,7 @@ static const luaL_Reg functions[] =
 	{ "isConnected", w_Joystick_isConnected },
 	{ "isConnected", w_Joystick_isConnected },
 	{ "getName", w_Joystick_getName },
 	{ "getName", w_Joystick_getName },
 	{ "getID", w_Joystick_getID },
 	{ "getID", w_Joystick_getID },
-	{ "getGUID", w_Joystick_getGUID },
+	{ "getProductGUID", w_Joystick_getProductGUID },
 	{ "getAxisCount", w_Joystick_getAxisCount },
 	{ "getAxisCount", w_Joystick_getAxisCount },
 	{ "getButtonCount", w_Joystick_getButtonCount },
 	{ "getButtonCount", w_Joystick_getButtonCount },
 	{ "getHatCount", w_Joystick_getHatCount },
 	{ "getHatCount", w_Joystick_getHatCount },

+ 1 - 1
src/modules/joystick/sdl/wrap_Joystick.h

@@ -37,7 +37,7 @@ Joystick *luax_checkjoystick(lua_State *L, int idx);
 int w_Joystick_isConnected(lua_State *L);
 int w_Joystick_isConnected(lua_State *L);
 int w_Joystick_getName(lua_State *L);
 int w_Joystick_getName(lua_State *L);
 int w_Joystick_getID(lua_State *L);
 int w_Joystick_getID(lua_State *L);
-int w_Joystick_getGUID(lua_State *L);
+int w_Joystick_getProductGUID(lua_State *L);
 int w_Joystick_getAxisCount(lua_State *L);
 int w_Joystick_getAxisCount(lua_State *L);
 int w_Joystick_getButtonCount(lua_State *L);
 int w_Joystick_getButtonCount(lua_State *L);
 int w_Joystick_getHatCount(lua_State *L);
 int w_Joystick_getHatCount(lua_State *L);

+ 1 - 1
src/modules/joystick/sdl/wrap_JoystickModule.cpp

@@ -130,7 +130,7 @@ int w_getGamepadMapping(lua_State *L)
 	else
 	else
 	{
 	{
 		love::joystick::Joystick *stick = luax_checkjoystick(L, 1);
 		love::joystick::Joystick *stick = luax_checkjoystick(L, 1);
-		guid = stick->getGUID();
+		guid = stick->getProductGUID();
 	}
 	}
 
 
 	const char *gpbindstr = luaL_checkstring(L, 2);
 	const char *gpbindstr = luaL_checkstring(L, 2);