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

Author Topic: SFML 2.0 Image Dimension Setting Problems?  (Read 1569 times)

0 Members and 1 Guest are viewing this topic.

WaterNode

  • Newbie
  • *
  • Posts: 8
    • View Profile
SFML 2.0 Image Dimension Setting Problems?
« 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.
« Last Edit: December 26, 2012, 11:44:41 pm by WaterNode »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 Image Dimension Setting Problems?
« Reply #1 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; 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));
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

WaterNode

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML 2.0 Image Dimension Setting Problems?
« Reply #2 on: December 26, 2012, 11:59:25 pm »
Thank you, it worked.

 

anything