Witam!
Mam tu część mojego kodu:
while (W.isOpen())
{
W.clear(Color::Cyan);
while (W.pollEvent(e))
{
if (e.type==Event::Closed || (Keyboard::isKeyPressed(Keyboard::Escape))) W.close();
if (e.type==Keyboard::isKeyPressed(Keyboard::Space)) R.setFillColor(Color(rand() % 256, 100, rand() % 256));
if (e.type == Event::KeyPressed && e.key.code == Keyboard::W) moveDirect = Vector2f(0, -1);
if (e.type == Event::KeyPressed && e.key.code == Keyboard::S) moveDirect = Vector2f(0, 1);
if (e.type == Event::KeyReleased && (e.key.code == Keyboard::W || e.key.code == Keyboard::S)) moveDirect = Vector2f(0, 0);
if (e.type == Event::MouseButtonPressed && e.mouseButton.button == Mouse::Left) R.scale(Vector2f(2.0, 2.0));
if (e.type == Event::MouseButtonPressed && e.mouseButton.button == Mouse::Right) R.scale(Vector2f(0.5, 0.5));
if (e.type == Event::MouseMoved) R.setPosition(Mouse::getPosition(W).x - 30, (Mouse::getPosition(W).y - 30));
}
R.move(moveDirect);
W.draw(R);
W.display();
}
Chcę dowiedzieć się czemu ta linijka kodu odpowiadająca za zmianę koloru nie działa. Błędu nie ma ale kolor po naciśnięciu spacji się nie zmienia.