SFML community forums

Help => Window => Topic started by: Arjan B on June 12, 2010, 11:48:41 am

Title: Detect the mouse leaving the window
Post by: Arjan B on June 12, 2010, 11:48:41 am
I am making a puzzle game in which you drag stones with your mouse.
After letting several users test-play the game, I've noticed they all have this urge to click a stone, just sweep the mouse in the direction they want it to move and then release the button.
While doing this, very often the mouse moves outside of the window and the button is released there. This gets to the point where it ruins the gameplay and players get agitated.

When I googled on this problem I came upon this thread:
http://www.sfml-dev.org/forum/viewtopic.php?t=2597&sid=4b204b044470280bf28e8856ae1b34e5

Is there really no way I could check for the mouse to leave the window? Or does anyone have a different solution to my problem?

Thank you in advance,
Arjan
Title: Detect the mouse leaving the window
Post by: Laurent on June 12, 2010, 01:18:39 pm
So, do you want to detect mouse leaving the window, or button released outside the window?
Title: Detect the mouse leaving the window
Post by: Arjan B on June 12, 2010, 01:58:48 pm
Any one of those would do ^^.
Title: Detect the mouse leaving the window
Post by: Laurent on June 12, 2010, 09:45:34 pm
This is something that I'll probably think about for SFML 2.
Title: Detect the mouse leaving the window
Post by: Arjan B on June 13, 2010, 03:30:58 am
Quote from: "Laurent"
This is something that I'll probably think about for SFML 2.


That's nice ^^.

For now, I'll make the game deselect a block as soon as it collides with the puzzle's border (not really fair, because they might accidentally hit the border when not wanting to place the block near it, but it's a fix for now).

Thank you for your help!
Title: Detect the mouse leaving the window
Post by: Walker on June 14, 2010, 07:23:31 am
You could do basically what you said in your last post :) lol

You could lock the mouse inside the window - this can be a little disconcerting when you don't expect it though, but if you have a menu or something on Esc button then you could just release it then.

Make your game fullscreen?
Title: Detect the mouse leaving the window
Post by: Arjan B on June 14, 2010, 05:43:11 pm
Well, this game would mostly be played while doing something else at the same time. Like when you're chatting but in between conversation you play some puzzles.

So only allowing full-screen or locking the mouse to the window would annoy players a lot, I think ^^.