1
System / Mouse event problem....
« on: February 19, 2017, 11:22:29 am »
I have the event loop inside the main.cpp and i have 2 classes (a game class and a player class) i want the player to shoot if the user presses the mouse. but the only thing i could use was the sf::Mouse::isButtonPressed(sf::Mouse::Left) it works but if you press it just keeps repeating. so i was thinking about using events. but then i need to send it via main.cpp to game.cpp to the player.cpp. is there another way of doing this?
EDIT:
does someone know a good way of sending event data. because now i have a fucntion in the game.cpp thats named SetMouseState(bool state) that sets a value in the game.h called mouseState and i have the same function in the player.cpp that does the same thing. this is really annoying to do it for every single button.
EDIT:
does someone know a good way of sending event data. because now i have a fucntion in the game.cpp thats named SetMouseState(bool state) that sets a value in the game.h called mouseState and i have the same function in the player.cpp that does the same thing. this is really annoying to do it for every single button.