Issues

love.mouse.getRelativePosition

I'm working on a project that I would like to use FPS-style controls, i.e. continuous mouse movement in any direction. The traditional solution to this in SDL is to grab input and hide the cursor (respectively setGrab and setVisible in LOVE) - but LOVE doesn't have a way to get relative mouse motion, and the (invisible) cursor stops when it reaches the edge of the window, so taking deltas is out of the question as well.

Mouse motion events have already been ruled out I see, but it would be nice to at least have a "getRelativePosition" function, with the caveat that it should only be called once per frame.

This is personally a "blocker" issue for me right now, but I realize in the grand scheme of things it's pretty minor...

Comments (5)

I don't have anything regarding the issue itself, but if you consider this a blocker, I can suggest a workaround. The mouse movement still only goes to the window edge and if you expect large movements it probably will feel weird to the player.

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.