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

Author Topic: Ugly sprite drawing  (Read 1247 times)

0 Members and 1 Guest are viewing this topic.

Great Programmer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Ugly sprite drawing
« on: July 21, 2011, 07:52:21 am »
Hi.

I'm trying to draw an image on the screen, but the one I draw looks much worse than the original.

On the left the real image, on the right it's as sfml draws it:



I tried bmp, png and jpg formats, as well as different sizes - always the same.
What to do if I want to draw the image exactly as it's in the file?


Here is my code for the image:

Code: [Select]
RenderWindow window;
window.Create(VideoMode(640,480,32),"SFML Window");

Image img;
img.LoadFromFile("kon.PNG");

Sprite sprite;
sprite.SetImage(img);
sprite.SetPosition(100.f,100.f);

...

window.Clear(Color(0xff,0xff,0xff));
window.Draw(sprite);
window.Display();

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Ugly sprite drawing
« Reply #1 on: July 21, 2011, 08:33:07 am »
Code: [Select]
img.SetSmooth(false)
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Ugly sprite drawing
« Reply #2 on: July 21, 2011, 06:12:09 pm »
Laurent, this must be the most commonly asked question on SFML.

I suppose if an New Users FAQ were to be written, would that help? Would people even read it (in my experience, no)?

As a new user myself, I am tempted to write an Idiot's Guide to SFML...

Ed
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Ugly sprite drawing
« Reply #3 on: July 21, 2011, 06:29:28 pm »
I have a better solution: smoothing is disabled by default in SFML 2 ;)
Laurent Gomila - SFML developer