SFML community forums
Help => Window => Topic started by: sludge on August 22, 2010, 02:09:18 am
-
The title says everything.
In my gameloop, the following variable is checked for a left mouse clicked every iteration.
const sf::Input& input = editorWindow.GetInput();
I noticed that sometimes the mouse does not seem to respond as anticipated. After adding a simple cout statement after
if(input.IsMouseButtonDown(sf::Mouse::Left))
I learned that the condition is not returning true after every time I press the left mouse button. I know that the input class is used to gather real-time input. Are some of the mouse clicks not being registered simply because of a lag in between calls to GetInput()?
I imagine that things will function as expected if I check for a mouse event instead? Is this the case?
-
if there is a «lag» it's with cout.
sf::Input is updated with sf::Event. So using sf::Event will not change anything here.
-
It depends on where you're calling it. If it's not in the event handler code, then it could miss it.
-
Ah ha. I figured it out. After you mentioned that input and events are essentially the same thing, it all clicked.