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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hvince95

Pages: [1]
1
Window / Re: SFML 2.0 mouse position
« on: July 25, 2012, 01:51:51 pm »
thanks very much.

The problem was I had MouseButton, not mouseButton.

Thanks for your help!

2
Window / Re: SFML 2.0 mouse position
« on: July 25, 2012, 12:54:51 pm »
Sorry,
using the
menuEvent.MouseButtonEvent.x
version, it throws an error (in codeBlocks):
error: invalid use of 'struct sf::Event::MouseButtonEvent'

This is during compilation.

3
Window / Re: SFML 2.0 mouse position
« on: July 25, 2012, 12:10:34 pm »
Thankyou, and Yes, it was just an extract, here is the actual code:
sf::Event menuEvent;
while(true) {
        while(window.pollEvent(menuEvent)) {
                if(menuEvent.type == sf::Event::MouseButtonPressed) {
                        return HandleClick(menuEvent.MouseButtonEvent.x, menuEvent.MouseButtonEvent.y);
                }
        }
}
Where HandleClick is a function which takes two ints, and returns another value.
The thing is, the current code does not work, I'm not sure why.

I also tried doing:
return HandleClick(menuEvent.MouseButtonEvent.x, menuEvent.MouseButtonEvent.y);
but to no avail.

4
Window / SFML 2.0 mouse position
« on: July 25, 2012, 11:46:55 am »
Hey, new to the forums and SFML in general.

Just trying to follow this "http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx" tutorial and porting it over to SFML 2.0 in the process.  I cannot for the life of me get the mouse position in part 3 to port.

here is the code I am trying to port:
sf::Event menuEvent;
if(menuEvent.type == sf::Event::MouseButtonPressed) {
return sf::Event::MouseButtonEvent.x;
return sf::Event::MouseButtonEvent.y;
}
Just ignore that I returned twice for the sace of the this.

How should I be doing this?  I tried a few variants:
sf::Event menuEvent;
if(menuEvent.type == sf::Event::MouseButtonPressed) {
return menuEvent.MouseButtonEvent.x;
return menuEvent.MouseButtonEvent.y;
}
But this doesn't work.  Any ideas?

And one more quick question, when should I be using '::' or when should I be using '.' a full stop?

Pages: [1]
anything