SFML community forums
Help => Window => Topic started by: ThatSomeMess on March 11, 2012, 12:03:49 am
-
Hi,
I've written a small test program which collects events and draws to the screen only when the left mouse button is down.
The problem occurs with the following sequence of events:
I hold down the left mouse button to start drawing.
I move the mouse cursor outside of the window area.
I release the button.
I move the cursor back into the window area.
Now the screen is still being drawn to even though the mouse button is no longer down.
Code:
if (input.IsMouseButtonDown(sf::Mouse::Left))
{
// register action for undo, and save prompt
while (input.IsMouseButtonDown(sf::Mouse::Left))
{
eInst.editActionDraw();
/* get and discard events */
win->Clear();
drawTiles();
drawUI();
win->Display();
}
}
-
It's a bad side effect of how sf::Input is implemented: it collects the window events instead of directly asking the OS. Therefore, anything that happens outside the window is not taken in account.
It's already fixed in SFML 2.