SFML community forums

Help => Graphics => Topic started by: WaterNode on December 26, 2012, 11:42:32 pm

Title: SFML 2.0 Image Dimension Setting Problems?
Post by: WaterNode on December 26, 2012, 11:42:32 pm
I am attempting to create an image, as seen:
sf::Image i1(32, 32, sf::Color(0, 255, 0));
Although, for the first argument, 32, where I try to set the dimension, it gives me this error:
no instance of the constructor "sf::Image::Image" matches the argument list
Very peculiar, I'm rather new to SFML, and I have no idea how to fix this.
Title: Re: SFML 2.0 Image Dimension Setting Problems?
Post by: eXpl0it3r on December 26, 2012, 11:50:45 pm
Well the answer is already given in the compiler error, there simply isn't a constructor with such an argument list. Check in the official documentation (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php); there's only the default constructor.
What you want is, to create a sf::Image and then call create():
sf::Image img;
img.create(32, 32, sf::Color(0, 255, 0));
Title: Re: SFML 2.0 Image Dimension Setting Problems?
Post by: WaterNode on December 26, 2012, 11:59:25 pm
Thank you, it worked.