Hmm, this happens when I tried it as well.
I'm running win7 64bit and using the latest snapshot.
EDIT: You can work around it using' button pressed' booleans like this:
#include "SFML\Graphics.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768, 32), "Blah");
sf::Vector2f pos(0, 0);
bool running = true;
while (running)
{
bool shift = false, M1 = false;
sf::Event ev;
while (window.PollEvent(ev))
{
if (ev.Type == sf::Event::Closed)
{
running = false;
}
}
if (sf::Keyboard::IsKeyPressed(sf::Keyboard::LShift))
shift = true;
if(sf::Mouse::IsButtonPressed(sf::Mouse::Left))
M1 = true;
if(M1 && shift)
{
pos.x = sf::Mouse::GetPosition(window).x;
pos.y = sf::Mouse::GetPosition(window).y;
}
window.Clear();
sf::Shape shape;
if(shift)
shape = sf::Shape::Circle(pos, 10, sf::Color::Green);
else if(M1)
shape = sf::Shape::Circle(pos, 10, sf::Color::Blue);
else
shape = sf::Shape::Circle(pos, 10, sf::Color::Red);
window.Draw(shape);
window.Display();
}
return 0;
}
The code above acts as you wanted it to in the OP.
However so much as nesting these if statements reproduces the bug.
if (sf::Keyboard::IsKeyPressed(sf::Keyboard::LShift))
{
shift = true;
if(sf::Mouse::IsButtonPressed(sf::Mouse::Left))
M1 = true;
}