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

Author Topic: Help with getting width of a texture from a sprite (SFML 2.0)  (Read 4809 times)

0 Members and 1 Guest are viewing this topic.

WhiteWind

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Help with getting width of a texture from a sprite (SFML 2.0)
« 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?

cire

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: Help with getting width of a texture from a sprite (SFML 2.0)
« Reply #1 on: February 08, 2013, 02:38:01 am »
return spriteImage.getTexture()->getSize().x / amountOfFramesX ;

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

 

anything