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

Author Topic: 2 mouse event questions  (Read 6497 times)

0 Members and 1 Guest are viewing this topic.

seb.dd

  • Newbie
  • *
  • Posts: 12
    • View Profile
2 mouse event questions
« on: October 15, 2009, 04:45:57 pm »
hello everyone! after getting a lot of help from reading the forum i finally registered :)

first i must admit how i love the framework!

i've been looking for such a thing for a long time, did a lot of comparing,
messed around with sdl and even started writing my own cross platform
library before discovering this rising star. it's exactly what i never hoped to find.


what i like to know:

1)  the mouse move event holds the absolute mouse position wich i'm not
interested in when processing a move event. i could read absolute values
from sf::Input as well. to get delta values i have to save the old position
each frame and manually compute the difference. so in the end the move
event makes no sense to me at all. is there an easier way to get relative
movement values when processing a mouse move event or will this be
fixed in future releases?

2) when scrolling in some application like firefox my mouse wheel works
fine: each "wheel click" moves the page a little. when "scrolling" on my
sfml window it takes around 10 "wheel clicks" in the same direction to
finally fire a mouse wheel event which might be exhausting for the user ;)
(setup: osx / sfml 1.5 / windowed mode) any ideas?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
2 mouse event questions
« Reply #1 on: October 15, 2009, 05:36:06 pm »
1) The delta is not provided directly as it can be calculated very easily. I don't understand what your problem is with that.

2) Ah, is it because the Mac OS X mouse doesn't have "ticks" on its wheel? I remember Ceylo (the Mac OS X maintainer) telling me something about that. You'll have to see with him, I can't tell you more about this issue.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
2 mouse event questions
« Reply #2 on: October 15, 2009, 08:10:07 pm »
2) Yep indeed... with Mac OS X the mouse wheel delta I get is a floating value, not an integer, and I can't really make one mouse move for each "tick" because this floating value seems to depend on the user's sensibility settings (for example I was getting 0.13 with one slow movement). What I did is adding this value to a saved float variable and then make a mouse wheel event when it reaches 1.0. It looked fined to me and I easily got mouse wheel events but it may be because of my settings.

Do you move your wheel really slowly, are the results satisfying if you move it quicker ? One solution I'm thinking of is waiting for reaching 0.5 instead of 1.0 to throw a mouse wheel event.
Want to play movies in your SFML application? Check out sfeMovie!

seb.dd

  • Newbie
  • *
  • Posts: 12
    • View Profile
2 mouse event questions
« Reply #3 on: October 16, 2009, 04:21:40 am »
thanks for quick responses!

never used an apple mouse. a common mouse like mine lets you feel the
wheel ticks. and as a user i expect one tick to have some effect.
with faster movement sfml seems to fire more events per tick but slow
movement (in this case camera movement) feels tenacious. i'm working
at the latest imac with a standard logitech mouse and standard configurations.
in my case 0.5 would mean one event every 5 slow ticks.

just an idea: let's handle it similar to framerate independent animation.
sfml would not care about system dependent values but instead just
notice whether or not the wheel has been turned up/down.
e.g. for a maximum of 50 events per sec: when at least 20 ms have passed
and the wheel float value is != 0 then sfml would divide elapsed ms by 20
and generate a move event with that. the value can be scaled to match
non-apple systems but acceleration and sensbility would be back in the
programmers hands.

Quote
1) The delta is not provided directly as it can be calculated very
easily. I don't understand what your problem is with that.


no real problem here. just wondered how this event type can be useful.
i think deltas would be more appropriate. but maybe it was designed for
a purpose that i just can't imagine right now... i suggest storing both :)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
2 mouse event questions
« Reply #4 on: October 21, 2009, 07:29:42 pm »
Quote from: "seb.dd"
never used an apple mouse. a common mouse like mine lets you feel the
wheel ticks. and as a user i expect one tick to have some effect.

I agree with you, though I also have to take in account the people using an Apple mouse. As you may also have seen, there is even no more wheel in the Apple mouse that came out today.

Quote from: "seb.dd"
in my case 0.5 would mean one event every 5 slow ticks.

Do you mean you currently need to do exactly ten slow ticks to get a SFML mouse wheel event ?

The other point is I can't also set a too sensitive setting, it must remain usable by the Apple mouse users (that — I believe — are most of the Mac users).

Quote from: "seb.dd"
just an idea: let's handle it similar to framerate independent animation.
sfml would not care about system dependent values but instead just
notice whether or not the wheel has been turned up/down.
e.g. for a maximum of 50 events per sec: when at least 20 ms have passed
and the wheel float value is != 0 then sfml would divide elapsed ms by 20
and generate a move event with that. the value can be scaled to match
non-apple systems but acceleration and sensbility would be back in the
programmers hands.

To me, this means ignoring the user mouse wheel settings and I really don't like this.
Want to play movies in your SFML application? Check out sfeMovie!

seb.dd

  • Newbie
  • *
  • Posts: 12
    • View Profile
2 mouse event questions
« Reply #5 on: October 24, 2009, 02:31:08 am »
Quote
Do you mean you currently need to do exactly ten slow ticks to get a SFML mouse wheel event ?


around 9 - 12 slow ticks ...

as for the other statements: i understand this is not as simple and that you already have figured out some sophisticated compromise.
and yes, this luring magic mouse possibly opens up a new category anyway ;)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
2 mouse event questions
« Reply #6 on: October 25, 2009, 06:03:56 pm »
I did some testing and I get mouse wheel events REALLY easily while moving REALLY slowly on my touchpad (and I can reach a delta of 70 units if I move my fingers quickly). I need to move a bit longer with my mouse (having a ball) but I checked my sensibility settings and it matches (I can reach 20 units moving the ball quickly).

As for my settings I set 6 out of 10 for my touchpad and 3 out of 8 for my mouse. I dunno if my settings are unusual but maybe you could check yours in the System Preferences.

If your settings are fine, then I dunno how to fix your issue without causing excessive sensibility.

If other users could try out the mouse wheel events and give some feedback it could help too.
For my test application I used the SFML Window-based project, added an include for iostream and added the following code in the event loop :
Code: [Select]
if (Event.Type == sf::Event::MouseWheelMoved) {
    std::cout << "wheel move : " << Event.MouseWheel.Delta << std::endl;
}


Edit: I added an archive containing the whole project to build the testing app: scroll.zip.
Want to play movies in your SFML application? Check out sfeMovie!

Noegddgeon

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Soundcloud
2 mouse event questions
« Reply #7 on: October 26, 2009, 02:40:25 am »
I tested Ceylo's code on my Macbook, with my Trackpad's scrolling speed set to 8 out of 10. The result was that I got events triggered fairly easily; here's sample output of me moving my finger slowly down the pad from the top to the middle (about 5 seconds):

Code: [Select]

wheel move : -1
wheel move : -1
wheel move : -1
wheel move : -1


Here's the same length of the pad, but done more quickly (about 2 seconds):

Code: [Select]

wheel move : -7
wheel move : -6
wheel move : -8
wheel move : -8
wheel move : -8
wheel move : -6
wheel move : -7
wheel move : -7
wheel move : -8


And lastly, here's me using the program and taking about a quarter of a second to slide my finger down the entire thing:

Code: [Select]

wheel move : -36
wheel move : -29
wheel move : -18
wheel move : -15
wheel move : -39
wheel move : -17
wheel move : -28


Going fast enough at times, I can get the program to spit out deltas higher than 100.

Hope this helps at all. Haven't tried it with a mouse with a scrolling wheel.

Colton[/code]
Whether you think you can or you can't, you're right.

 

anything