Added new event callback love.mousemoved(x, y, xrel, yrel), where xrel and yrel are the amount of pixels moved since the last event. Added love.mouse.setRelative(bool relative) and love.mouse.isRelative. Resolves issue #470.

Enabling relative mouse mode will hide the cursor and let the system generate relative mouse move events while preventing the mouse from getting stuck at the edges of the screen (i.e. you can keep moving the mouse in one direction forever and the relative movement events will be generated accordingly.)

The reported absolute mouse position is not updated while relative mode is enabled, even while relative movement events are generated.
This commit is contained in:
Alex Szpakowski
2015-01-15 20:22:57 -04:00
parent dff496bdb5
commit b4f2a9417a
8 changed files with 75 additions and 11 deletions
+8
View File
@@ -285,6 +285,14 @@ const unsigned char boot_lua[] =
0x2e, 0x74, 0x65, 0x78, 0x74, 0x65, 0x64, 0x69, 0x74, 0x28, 0x74, 0x2c, 0x73, 0x2c, 0x6c, 0x29, 0x20, 0x65,
0x6e, 0x64, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a,
0x09, 0x09, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x78, 0x72, 0x65, 0x6c, 0x2c, 0x79, 0x72,
0x65, 0x6c, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x6d, 0x6f,
0x76, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f,
0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x28, 0x78, 0x2c, 0x79, 0x2c,
0x78, 0x72, 0x65, 0x6c, 0x2c, 0x79, 0x72, 0x65, 0x6c, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a,
0x09, 0x09, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x70, 0x72,