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

Author Topic: Mouse capture/grab  (Read 56738 times)

0 Members and 2 Guests are viewing this topic.

kattle87

  • Newbie
  • *
  • Posts: 6
    • View Profile
Mouse capture/grab
« Reply #45 on: April 02, 2011, 01:00:02 pm »
What we could do is having the "mouse deltas" as a readly-available feature, giving the user float values calculated by sfml using velocity or position means. This way, one would have not to do anything but calling a function for getting "precise" and not-stuttering movements :P

cmc5788

  • Newbie
  • *
  • Posts: 11
    • View Profile
Mouse capture/grab
« Reply #46 on: April 02, 2011, 08:09:30 pm »
Quote from: "kattle87"
What we could do is having the "mouse deltas" as a readly-available feature, giving the user float values calculated by sfml using velocity or position means. This way, one would have not to do anything but calling a function for getting "precise" and not-stuttering movements :P


This would simplify things a little bit.  However, for real mouse look you'll still need to reset the cursor every frame to make sure that it doesn't leave the window or get stuck on its edges.  You can't have any deltas if your mouse isn't moving ;)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Mouse capture/grab
« Reply #47 on: May 15, 2011, 05:28:13 pm »
Don't mean to resurrect a dead topic but what is the verdict on this? Will you implement some way to get the mouse movement delta instead of getting the position? I know using DirectInput(I know outdated but it works) you get the actual movement of the mouse and not the position of the mouse. So even if the mouse get's stuck on an edge it will still give us the movement of the mouse. I think this is the hardware movement of the actual mouse.

The whole thing with "Moving the mouse back to the center" doesn't work for me as when I do that a new message is sent by windows with the new position and the relative value calculated will be the inverse of what I've just moved. If I don't reset the mouse cursor everything works as intended. Except that the mouse get's stuck on the edge.

NOTE: I've managed to get it to work though in a very awkward way.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Wiz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Mouse capture/grab
« Reply #48 on: August 02, 2011, 04:19:18 pm »
There clearly is a need for real mouse input, with no clamp to borders hack.
DirectInput on Windows would be the perfect solution and on Linux there is evdev. That's what evQuake uses.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Mouse capture/grab
« Reply #49 on: August 02, 2011, 04:37:51 pm »
Yes, raw input looks like an important feature (not only for mouse, for keyboard too).
Laurent Gomila - SFML developer

Tuffywub

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Mouse capture/grab
« Reply #50 on: March 26, 2013, 06:43:38 am »
I know this is an old topic, but I was wondering if implementing cursor grabbing was still on the todo list. I love SFML, it's an awesome library, but I think that having a good and easy way of trapping the cursor and getting relative input would be great.
I know you can do it by moving the mouse to the center of the window on move events, and then ignoring events where the mouse is moved to the center. But it would be much nicer if the library had a way of doing that for you with window.relativeCursorMode(true) or something.
Sorry again for reviving an ancient topic, but this is a very important feature, especially for fps/3D games. Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Mouse capture/grab
« Reply #51 on: March 26, 2013, 07:41:40 am »
If it's in the task tracker, then don't worry it will be implemented one day. If it's not, then feel free to add a task containing all the important points that were discussed here.
Laurent Gomila - SFML developer

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Mouse capture/grab
« Reply #52 on: May 21, 2013, 09:14:48 pm »
If it's in the task tracker, then don't worry it will be implemented one day. If it's not, then feel free to add a task containing all the important points that were discussed here.

I couldn't find a ticket for mouse capturing/grabbing, so I created one: https://github.com/SFML/SFML/issues/394

Edit: I also created a second ticket for the raw mouse movement: https://github.com/SFML/SFML/issues/395

Edit 2: Closed issue #395 because it was a duplicate to https://github.com/SFML/SFML/issues/304
« Last Edit: May 22, 2013, 07:15:11 am by Robert42 »

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Mouse capture/grab
« Reply #53 on: June 04, 2013, 06:51:25 pm »
A small update:

MarioLiebisch has created a pull request and has implemented the cursor capturing for Windwos and X11.

However, Mac Support still has to be implemented.

jeremy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mouse capture/grab
« Reply #54 on: November 20, 2013, 10:51:28 am »
I noticed the implementation uses a number of X methods to grab and ungrab the input.

Why doesn't SFML use evdev to capture input to give users more flexibility with this sort of thing? This is how SDL implements it so it can capture the pointer in addition to providing raw mouse input to the developer.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Mouse capture/grab
« Reply #55 on: November 24, 2013, 09:11:50 pm »
Feel free to rewrite/extend and use the existing code as a base. :) To be honest, my platform dependent knowledge for Unix is almost zero, so I just built on whatever has been there already. Although my patch will need some reworking anyway, considering there have been other patches for this part of the code fixing other things.

jeremy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mouse capture/grab
« Reply #56 on: November 28, 2013, 08:59:21 am »
Hey Mario,

Thanks a million for the initial patch. I'd really like to get this in.

Basically, I think the initial approach is not a bad one and I think my suggestion is not strictly necessary. I was just considering a possible overhaul of the input system later on to be a bit lower level so the user has more control if desired. Looking into it recently, I think it'd be a significant change so it's worth discussing before any implementation is done.

CouteauBleu

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Mouse capture/grab
« Reply #57 on: January 20, 2018, 05:36:01 pm »
It's been a while since this topic has been posted (I think this topic was created prior to the SFML 2 update)... what happened to this feature?

I can't find it in the documentation. Is cursor grabbing no longer maintained?

I can't find window.SetCursorPosition either. EDIT: Nevermind, I think it's in sf::Mouse now.
Les pouces opposables: meilleure invention depuis les endosquelettes.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Mouse capture/grab
« Reply #58 on: January 20, 2018, 06:45:16 pm »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

CouteauBleu

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Mouse capture/grab
« Reply #59 on: January 20, 2018, 06:59:53 pm »
Oh, I was browsing an outdated documentation. Whoopsie :(

I don't have any excuse, there's even a red "this page refers to an old version of SFML" disclaimer (maybe a little small).

Thanks for the help!
« Last Edit: January 20, 2018, 09:17:20 pm by CouteauBleu »
Les pouces opposables: meilleure invention depuis les endosquelettes.

 

anything