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

Author Topic: What has replaced the Image function GetWidth() in SFML 2.0  (Read 3565 times)

0 Members and 2 Guests are viewing this topic.

ZeroAndOne

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
What has replaced the Image function GetWidth() in SFML 2.0
« on: December 30, 2012, 09:09:35 am »
I have a sprite sheet that I would like to animate by subdividing it into sub-rectangles but I am unable to, :( because the function getWidth() for the sprite sheet has been removed in SFML 2.0 and I don't know what has replaced it. ???
« Last Edit: December 30, 2012, 09:14:29 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: What has replaced the Image function GetWidth() in SFML 2.0
« Reply #1 on: December 30, 2012, 09:14:54 am »
Is getSize() really difficult to find by looking at the API documentation? >:(
Laurent Gomila - SFML developer

ZeroAndOne

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: What has replaced the Image function GetWidth() in SFML 2.0
« Reply #2 on: December 30, 2012, 09:31:45 am »
but isn't getSize() going to return the whole size of the image in Kbs or MBs? I want the number of pixels across the image and also the number of pixels on the height of the image. will getSize() be able to achieve this? If Yes. How?   

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: What has replaced the Image function GetWidth() in SFML 2.0
« Reply #3 on: December 30, 2012, 09:51:52 am »
The doc says that it returns the "size in pixels" (not in KB or MB), and the return value is a Vector2 (a pair of <x, y> values). So it returns exactly what you want: getSize().x is the width, getSize().y is the height.
Laurent Gomila - SFML developer

ZeroAndOne

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: What has replaced the Image function GetWidth() in SFML 2.0
« Reply #4 on: December 30, 2012, 09:53:30 am »
thanks, I get it now.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: What has replaced the Image function GetWidth() in SFML 2.0
« Reply #5 on: December 30, 2012, 09:55:00 am »
I'll update the documentation to make this more explicit.
Laurent Gomila - SFML developer