Feature #972

Do not reset mouse position to implement FreeLook

Added by rti about 8 years ago. Updated about 8 years ago.

Status:Closed Start date:06/09/2010
Priority:Normal Due date:
Assignee:rti % Done:

100%

Category:NeL: General
Target version:Version 0.8.0

Description

Resetting the mouse position to 0.5 / 0.5 is not a clean way to prevent reaching window / desktop borders.

On Windows, there are raw events provided by direct input.
A similar thing should be possible on X11 using setCapture(), on Mac using CGGetLastMouseDelta(CGMouseDelta* deltaX, CGMouseDelta* deltaY).


Related issues

related to Ryzom - Feature #947: NeL/Ryzom: Run natively on Mac OS X using Cocoa Closed 05/29/2010

History

#1 Updated by rti about 8 years ago

  • Assignee set to rti
  • % Done changed from 0 to 10

The cleanest way would be to implement IMouseDevice for X11 and Cocoa.
But this is not the aim here :) ... just make the unix event emitter and the cocoa event emitter fire CGDMouseMove events.

#2 Updated by rti about 8 years ago

Ok. I made some good progress here. But I really had to make some deep changes to archive that.

The big problem is, that only the Direct Input Mouse implementation emits CGDMouseMove. The normal event emitters don't do.
On Mac and Linux, there are no mouse device implementations, only the event emitters. The behavior can be emulated if the event emitters create CGDMouseMove events with the movement delta, instead of CEventMouseMove. This has to be enabled and disabled. On windows, the mouse device gets a call to switch to raw mode, so on Mac and Linux the event emitters need a method to enable a raw mode emulation.

What I had to change:

The event emitter got a new function emulateMouseRawMode(bool). Ok, that was easy.
But the switching to raw mode it done by the client, which only uses the u_driver interface. So this one needs this function as well. The driver interface is implemented by driveruser, so this one - as well - needs that function.

What do you think? Is that ok?

#3 Updated by rti about 8 years ago

Ok. I implemented it like mentioned above.
On X11 there is still the pulling back to 0.5, 0.5 (which seems to be common practice)... But now it is handled by the unix_event_emitter and not by the client... This way, several #ifdef PLATFORM's disappeared from the client code. On Mac OS, the delta provided by the mouse event is used.

#4 Updated by rti about 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 10 to 100

Applied in changeset r324.

#5 Updated by rti about 8 years ago

  • Target version set to Version 0.8.0

#6 Updated by kervala about 8 years ago

Applied in changeset r330.

#7 Updated by kervala about 8 years ago

Applied in changeset r331.

#8 Updated by rti about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF