SFML community forums

Help => Graphics => Topic started by: WhiteWind on February 08, 2013, 01:43:13 am

Title: Help with getting width of a texture from a sprite (SFML 2.0)
Post by: WhiteWind on February 08, 2013, 01:43:13 am
I just started learning SFML 2.0 and have been reading a tutorial, which unfortunately is in 1.6. Anyway, I have an Animation class, which has an sf::Sprite member, and in my int Animation::getFrameWidth() function I'm trying to do this:

return spriteImage.getTexture().getSize().x / amountOfFramesX;

// request for member 'getSize' in '((Animation*)this)->Animation::spriteImage.sf::Sprite::getTexture()', which is of non-class type 'const sf::Texture*'

I've used this in other parts of my program and its worked fine:

someTexture.getSize().x

Any help?
Title: Re: Help with getting width of a texture from a sprite (SFML 2.0)
Post by: cire on February 08, 2013, 02:38:01 am
return spriteImage.getTexture()->getSize().x / amountOfFramesX ;

getTexture
returns a pointer (as the error message indicates.)