Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Mouse warping  (Read 1527 times)

Azatoth

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
    • http://wiki.worldforge.org/wiki/Ember
Mouse warping
« on: April 22, 2006, 02:29:32 PM »

I'm looking into using OIS for Ember, however currently it's missing mouse warping functionality which is critical for Ember.
We currently use this SDL function http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fWarpMouse
Would this be something that could be added to OIS?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Mouse warping
« Reply #1 on: April 22, 2006, 07:10:15 PM »

Do you need this for the OS Hardware mouse? Or the OIS Mouse? Because, each would depend on a idfferent solution.
Logged

Azatoth

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
    • http://wiki.worldforge.org/wiki/Ember
Mouse warping
« Reply #2 on: April 23, 2006, 02:35:01 AM »

Basically, I don't want to use the focus stealing mechanism, where the mouse is "stolen" from the WM and all mouse updates are sent to the application solely. The problem with this is that it brings a lot of problem in the cases where the application crashes or locks up, or when doing debugging, because the mouse will then not be there for the OS. It's cooperative multitasking all over again.

So what I do to "fake" the mouse being stuck in the same place is to warp it back to its original position at every move. This is all related to the OS Hardware mouse as I understand it.
Check out how it works in Ember to see what I mean (run it in windowed mode): http://wiki.worldforge.org/wiki/Ember
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Mouse warping
« Reply #3 on: April 23, 2006, 08:44:32 AM »

This is how the mouse is captured on X11. If you want this on windows. This sounds very Windows Message Pump style. In which case, i would suggest you do not create a mouse/keyboard with OIS, and just use it for JoyStick support and handle WM_ messages yourself.

As, DirectInput is the Win32 backend, and it desn't offer much flexibility in this regrds. Anyway, you can easily break out of having the mouse captured. OIS works with Alt-Tab, and you can destroy the Mouse which would release it at any time.

It could be possible to add this still. However, this is very low priority for me right now, with WGE, and now being more involved with Ogre, I have other things to do first. I suggest you submit a patch to the tracker, and I will see about accepting it.
Logged