Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Hardware Position of mouse?  (Read 2394 times)

0 Members and 1 Guest are viewing this topic.

scyth3s

  • Newbie
  • *
  • Posts: 20
    • View Profile
Hardware Position of mouse?
« on: January 27, 2015, 05:01:59 am »
Is it possible in SFML a position for the mouse that does not correspond to the position of a window or the desktop itself? For instance, in any 3D game where mouse controls camera, I need to be able to find out movement of the mouse event if it would go beyond the edge of the screen.  I didn't see anything like this in the documentation, but I've also been known to miss things now and again when perusing through.
"My church is not full of..."

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Hardware Position of mouse?
« Reply #1 on: January 27, 2015, 08:36:33 am »
It sounds like you're asking for the ability to "capture" the mouse.  Some work has been done on this feature (https://github.com/SFML/SFML/pull/614) but I don't think it's been finished yet.  You can try building that branch yourself if you need this feature.

Hapax

  • Hero Member
  • *****
  • Posts: 3349
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Hardware Position of mouse?
« Reply #2 on: January 27, 2015, 07:27:58 pm »
There was something posted in this forum that would work as a work-around in similar situations.
The idea is to lock the mouse cursor (constantly set its position each cycle) but take note of its delta before resetting the position. Then, just use the delta in your code (or store an accumulation).

It's probably best to hide the cursor if you use this method.
Also, you will need to make sure you cover the fact that you can't move the mouse so no interactions with other windows or closing/exiting with the mouse, for example.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

scyth3s

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Hardware Position of mouse?
« Reply #3 on: January 28, 2015, 02:46:45 pm »
I like that idea... So simple. Just "unlock" the mouse as soon as the user reaches a menu screen or any situation where mouse use is required. Thank you!
"My church is not full of..."

 

anything