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

Author Topic: Cursor Position  (Read 4270 times)

0 Members and 1 Guest are viewing this topic.

barata

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Cursor Position
« on: June 13, 2014, 12:45:04 pm »
How can I get cursor position on my window or get position of window?
For example, I have screen resolution 1920x1080 and window 1280x720. My cursor position can be 1440x1050 and its bad... So, how can I get cursor position when CursorX <= 1280 and CursorY <= 720?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Cursor Position
« Reply #1 on: June 13, 2014, 12:54:12 pm »
Please read the documentation and tutorials.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Cursor Position
« Reply #2 on: July 01, 2014, 02:27:01 pm »
It's all here. Look for the part that says "You can also get and set the current position of the mouse, either relatively to the desktop or to a window."
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Cursor Position
« Reply #3 on: July 01, 2014, 10:25:14 pm »
The question is almost 3 weeks old... and since the author has not responded in such a long time, it's unlikely that he reponds now. So there's no need to bring the topic to the front, unless you say something new or important ;)

Also, it's often a good idea to point people to the tutorials without being specific about every sentence, so they learn to read them completely and don't just read the parts you mention and ask a similar question the next day.

Same here, by the way.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Cursor Position
« Reply #4 on: July 01, 2014, 11:35:24 pm »
I accept that this thread was a little too old so I'm sorry about that. I was just reading through some stuff and thought I could help. I didn't think to check the date  :-[

I do think that generally pointing people to tutorials can help in the long run but sometimes it can feel a bit unhelpful when people tell you to seemingly "find the answer on your own because we don't care." I'm not saying that that's what it is, but that's what it can seem like at first.
When I was researching which library I wanted to use, I found a number of discussion about the different ones. A number of times I came across people talking about the reputation of SFML's forums saying that they're aren't helpful and people were told to just RTFM. It made me think twice about SFML. I got past that and I always attempt to check tutorials and documentation first if I have any questions but I can imagine that some people didn't get past it and gave up thinking that the forum isn't helpful. Newbies often need helping more specifically at first.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Cursor Position
« Reply #5 on: July 02, 2014, 12:05:42 am »
but sometimes it can feel a bit unhelpful when people tell you to seemingly "find the answer on your own because we don't care."
As ironically as it may sound, it's rather "find the answer on your own because we do care".

Experienced users are generally able to answer a lot of questions. In many cases this is very helpful, because the problem to solve may look very difficult for a newcomer, but very common to those who have already encountered it. However, questions that result simply because the asker didn't spend any effort on research -- be it intentionally or not -- should not be encouraged in my opinion. Not primarily because it floods the forum with trivial questions and rewards lazyness, but because just showing the solution doesn't teach people how to approach problems. It's likely that another, very similar problem emerges soon, and then -- should we again repeat the tutorial texts and solve the one specific problem, or rather show how to solve a whole category of problems in the future?

Checking the official tutorials and the documentation is the very first thing one should always do, when there is a question about functionality in the library. Programming newcomers may not know this, that's why we hint to those resources in a friendly way. But quoting and repeating the tutorial again and again in the forum somehow defeats the purpose of it existing in the first place. And it is not only a waste of time for people who answer, but also for those who ask -- if they know how and where to look things up, they will progress much faster than if they wait for answers all the time.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Cursor Position
« Reply #6 on: July 02, 2014, 12:14:52 am »
I know that the thing that I was saying in the quote was untrue; I meant that it can look like that to newcomers. I agree with you entirely that the first place should be the documentation but people are often shunned away without any direction or questions about why they haven't found the answer themselves.

You say
we hint to those resources in a friendly way
but I can't help but think that
Please read the documentation and tutorials.
is not going to be seen as friendly, nor does it actually give any direction specific to the given problem.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Cursor Position
« Reply #7 on: July 02, 2014, 12:37:49 am »
but I can't help but think that
Please read the documentation and tutorials.
is not going to be seen as friendly
I don't see anything unfriendly, unpolite or offending in my sentence. The only thing that it may be is uncomfortable for the reader, because he is not given the solution he might have expected.

nor does it actually give any direction specific to the given problem.
Yes, because exactly this is part of the process of looking up the right tutorial.

The question is "how can I get cursor position on my window" -> the problem is related to the window -> the tutorial section about the SFML Window module looks promising -> now there is a specific tutorial about mouse input -> let's read it. Given your link, it's not immediately clear how this information can be accessed (or people simply don't care when they know links will be posted).

It's of course a bit an extreme point of view to show what I mean, I'm not always that strict either. But in general, I see it as a good thing to not provide the final and definite answer for questions that can be trivially researched -- or worse -- that don't even come up when users read the tutorials in the first place.
« Last Edit: July 02, 2014, 12:41:13 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Cursor Position
« Reply #8 on: July 04, 2014, 12:28:07 am »
I don't see anything unfriendly, unpolite or offending in my sentence. The only thing that it may be is uncomfortable for the reader, because he is not given the solution he might have expected.
The thing here is not that it is unfriendly, unpolite, or offending, but that it is also not friendly or polite. It would seem distant to a newcomer.

Quote
I'm not always that strict either. But in general, I see it as a good thing to not provide the final and definite answer for questions
You're not always strict with not giving answers and I don't always give the final answer, so neither of us are always the way we just were in this post  ;) Sometimes, I just feel generous, especially to newbies as I remember coming here for the first time and, to be fair, I'm still just a newbie myself.
I know it might not look like it but I totally agree with you.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything