I have been trying to place this sprite on the center of the window by using the code below...
But the sprite is placed on TOP-LEFT corner of the window.
Spaceship::Spaceship(sf::RenderWindow& game_window){
auto surface = sf::VideoMode::getDesktopMode();
signed int ss_x = surface.width/2;
signed int ss_y = surface.height/2;
int ss_width = 128;
int ss_height = 128;
int ss_radius = ss_width/2;
}
void Spaceship::drawsprite(sf::RenderWindow& game_window){
sf::Texture ship;
if (!ship.loadFromFile(resourcePath() + "space-shuttle-64.png")) {
return EXIT_FAILURE;
}
sf::Sprite ss_sprite(ship);
ss_sprite.setPosition(ss_x,ss_y);
game_window.draw(ss_sprite);
}