Browse Source

Fixed the default error handler to disable relative mouse mode.

Alex Szpakowski 10 years ago
parent
commit
71116807e3
3 changed files with 11 additions and 7 deletions
  1. 3 2
      src/modules/graphics/opengl/Font.cpp
  2. 1 0
      src/scripts/boot.lua
  3. 7 5
      src/scripts/boot.lua.h

+ 3 - 2
src/modules/graphics/opengl/Font.cpp

@@ -693,7 +693,8 @@ void Font::getWrap(const std::string &text, float wrap, std::vector<std::string>
 		// Put words back together until a wrap occurs.
 		// Put words back together until a wrap occurs.
 		for (const std::string &word : words)
 		for (const std::string &word : words)
 		{
 		{
-			width += getWidth(word);
+			float wordwidth = (float) getWidth(word);
+			width += wordwidth;
 
 
 			// On wordwrap, push line to line buffer and clear string builder.
 			// On wordwrap, push line to line buffer and clear string builder.
 			if (width > wrap && oldwidth > 0)
 			if (width > wrap && oldwidth > 0)
@@ -704,7 +705,7 @@ void Font::getWrap(const std::string &text, float wrap, std::vector<std::string>
 				std::string tmp = string_builder.str();
 				std::string tmp = string_builder.str();
 				lines.push_back(tmp.substr(0,tmp.size()-1));
 				lines.push_back(tmp.substr(0,tmp.size()-1));
 				string_builder.str("");
 				string_builder.str("");
-				width = static_cast<float>(getWidth(word));
+				width = wordwidth;
 				realw -= (int) width;
 				realw -= (int) width;
 
 
 				if (linewidths)
 				if (linewidths)

+ 1 - 0
src/scripts/boot.lua

@@ -581,6 +581,7 @@ function love.errhand(msg)
 	if love.mouse then
 	if love.mouse then
 		love.mouse.setVisible(true)
 		love.mouse.setVisible(true)
 		love.mouse.setGrabbed(false)
 		love.mouse.setGrabbed(false)
+		love.mouse.setRelativeMode(false)
 	end
 	end
 	if love.joystick then
 	if love.joystick then
 		-- Stop all joystick vibrations.
 		-- Stop all joystick vibrations.

+ 7 - 5
src/scripts/boot.lua.h

@@ -821,11 +821,11 @@ const unsigned char boot_lua[] =
 	0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x27, 0x25, 0x73, 0x27, 0x20, 0x6f, 0x66, 0x20, 0x4c, 0x4f, 0x56, 
 	0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x27, 0x25, 0x73, 0x27, 0x20, 0x6f, 0x66, 0x20, 0x4c, 0x4f, 0x56, 
 	0x45, 0x2e, 0x5c, 0x6e, 0x22, 0x2e, 0x2e, 0x0a,
 	0x45, 0x2e, 0x5c, 0x6e, 0x22, 0x2e, 0x2e, 0x0a,
 	0x09, 0x09, 0x09, 0x09, 0x22, 0x49, 0x74, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 
 	0x09, 0x09, 0x09, 0x09, 0x22, 0x49, 0x74, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 
-	0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 
-	0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 
-	0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x25, 0x73, 0x29, 0x2e, 0x22, 0x29, 0x3a, 0x66, 0x6f, 
-	0x72, 0x6d, 0x61, 0x74, 0x28, 0x63, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x6c, 0x6f, 
-	0x76, 0x65, 0x2e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x29, 0x0a,
+	0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 
+	0x68, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 
+	0x20, 0x28, 0x25, 0x73, 0x29, 0x2e, 0x22, 0x29, 0x3a, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x28, 0x63, 0x2e, 
+	0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x76, 0x65, 0x72, 
+	0x73, 0x69, 0x6f, 0x6e, 0x29, 0x0a,
 	0x09, 0x09, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x0a,
 	0x09, 0x09, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x28, 0x6d, 0x73, 0x67, 0x29, 0x0a,
 	0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 
 	0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 
 	0x74, 0x68, 0x65, 0x6e, 0x0a,
 	0x74, 0x68, 0x65, 0x6e, 0x0a,
@@ -1058,6 +1058,8 @@ const unsigned char boot_lua[] =
 	0x73, 0x69, 0x62, 0x6c, 0x65, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x0a,
 	0x73, 0x69, 0x62, 0x6c, 0x65, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x0a,
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x47, 0x72, 
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x47, 0x72, 
 	0x61, 0x62, 0x62, 0x65, 0x64, 0x28, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x29, 0x0a,
 	0x61, 0x62, 0x62, 0x65, 0x64, 0x28, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x29, 0x0a,
+	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x52, 0x65, 
+	0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x29, 0x0a,
 	0x09, 0x65, 0x6e, 0x64, 0x0a,
 	0x09, 0x65, 0x6e, 0x64, 0x0a,
 	0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x20, 
 	0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x20, 
 	0x74, 0x68, 0x65, 0x6e, 0x0a,
 	0x74, 0x68, 0x65, 0x6e, 0x0a,