SFML community forums

Help => Graphics => Topic started by: ILostMyAccount on February 06, 2015, 01:20:05 pm

Title: Is this correct?
Post by: ILostMyAccount on February 06, 2015, 01:20:05 pm
As the title says, is this correct?
(http://i.imgur.com/gbATyiN.png?1)
Title: Re: Is this correct?
Post by: Gambit on February 06, 2015, 01:36:20 pm
This is the most ambiguous, unproductive and ... silly.. question. Can you be more specific about what you are asking is "correct"?
Title: Re: Is this correct?
Post by: Laurent on February 06, 2015, 01:44:12 pm
As Gambit said, be specific when you ask a question. Please read this carefully: http://en.sfml-dev.org/forums/index.php?topic=5559.0

And please provide real code that we can copy, not a screen capture.

To answer the question: no, this code is not correct. What your constructor does is to create its own copy the texture, but I assume that you just want to use the original one.

const sf::Texture& m_texture;

Player::Player(const sf::Texture& texture) : m_texture(texture)
{
    ...
}

Or

const sf::Texture* m_texture;

Player::Player(const sf::Texture& texture)
{
    m_texture = &texture;
}

This comment and solution are based on assumption about what you want to do, so no guarantee that it matches what you were asking.