1
Graphics / Mouse position relative to games window in SFML 2?
« on: August 30, 2011, 01:15:00 pm »
Hi
I've been following a tutorial for SFML http://redkiing.wordpress.com/category/games/sfml/ and have a problem. Although I got the game running with minimal changes for 2.0, I can't find how to get the mouse position relative to the games window rather the current desktop position.
These are the parts where i get the mouse click position. This part is changed from the tutorial due to Input getting scrapped in 2.0.
main.cpp
uInterface.cpp
Hoping someone can give me a clue as to how to solve this!
I've been following a tutorial for SFML http://redkiing.wordpress.com/category/games/sfml/ and have a problem. Although I got the game running with minimal changes for 2.0, I can't find how to get the mouse position relative to the games window rather the current desktop position.
These are the parts where i get the mouse click position. This part is changed from the tutorial due to Input getting scrapped in 2.0.
main.cpp
Code: [Select]
else if (Event.Type == Event.MouseButtonReleased && Event.MouseButton.Button == sf::Mouse::Left)
ui.placeInColumn(sf::Mouse());
uInterface.cpp
Code: [Select]
sf::Vector2f MousePosition(GetMousePosition.GetPosition(sf::RenderWindow &Game));
column = float(MousePosition.x)/board.getWindowWidth()*BOARD_X_SIZE+1;
Hoping someone can give me a clue as to how to solve this!