Returning struct from function is not working, and i don't know why. Can someone help me?
struct Position {
float x, y;
Position(float position_x, float position_y) {
x = position_x;
y = position_y;
}
};
Position Object::getPosition() {
Position position(sprite.getPosition().x, sprite.getPosition().y);
return position;
}
void updateGame() {
int ball_position_main_x = 50, ball_position_main_y = 50;
while (game_run) {
std::cout << Object::getObject("test")->getPosition().x;
Object::getObject("test")->moveRight(1);
sf::sleep(sf::milliseconds(10));
}
}