Pretty simple question. For example:
float deltaTime;
void rotateShape(RectangleShape currentShape);
int main()
{
Clock theClock;
RectangleShape myShape(Vector2f(100.f, 100.f));
while (window.isOpen())
{
deltaTime = theClock.restart().asSeconds() * 60;
rotateShape(myShape);
myShape.rotate(5.f * deltaTime); // < this works
myShape.move(10.f * deltaTime, 0.f); // < this works
myShape.scale(1.01f, 1.01f); // < this works
;
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed)
window.close();
}
window.clear(Color(0,0,0));
window.draw(myShape);
window.display();
}
}
void rotateShape(RectangleShape currentShape)
{
cout << currentShape.getRotation() << endl; // < this works
currentShape.rotate(5.f * deltaTime); // < this doesn't work
currentShape.move(10.f * deltaTime, 0.f); // < this doesn't work
currentShape.scale(1.01f, 1.01f); // < this doesn't work
// etc.
}
Why don't the transform functions work when called from my own function?
As usual apologies for the probably noob question and thanks in advance.