SFML community forums

Help => Graphics => Topic started by: ZeroAndOne on December 30, 2012, 09:09:35 am

Title: What has replaced the Image function GetWidth() in SFML 2.0
Post by: ZeroAndOne 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. ???
Title: Re: What has replaced the Image function GetWidth() in SFML 2.0
Post by: Laurent on December 30, 2012, 09:14:54 am
Is getSize() really difficult to find by looking at the API documentation? >:(
Title: Re: What has replaced the Image function GetWidth() in SFML 2.0
Post by: ZeroAndOne 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?   
Title: Re: What has replaced the Image function GetWidth() in SFML 2.0
Post by: Laurent 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.
Title: Re: What has replaced the Image function GetWidth() in SFML 2.0
Post by: ZeroAndOne on December 30, 2012, 09:53:30 am
thanks, I get it now.
Title: Re: What has replaced the Image function GetWidth() in SFML 2.0
Post by: Laurent on December 30, 2012, 09:55:00 am
I'll update the documentation to make this more explicit.