Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - idontreallywolf

Pages: [1]
1
General / Re: can't place sprite on center
« on: January 18, 2017, 11:10:33 pm »
PROBLEM SOLVED:

STACKOVERFLOW LINK

2
General / can't place sprite on center
« on: January 18, 2017, 10:03:07 pm »
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);
}
 

Pages: [1]
anything