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

Author Topic: Overlaying Images  (Read 2618 times)

0 Members and 1 Guest are viewing this topic.

Azurus

  • Newbie
  • *
  • Posts: 7
    • View Profile
Overlaying Images
« on: October 09, 2011, 07:40:41 am »
I have a single background image and then images that would go in front of the background. The problem is, that when I display the background and the other image, the images seem to be a little messed up. Some lines aren't straight as they should be and it looks like the second image was first cut out using paint.net's magic wand. (Using SFML 1.6 here)

Is there any way to fix this? I'm using two images and sprites each and drawing one right after the other and then displaying the window.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Overlaying Images
« Reply #1 on: October 09, 2011, 08:23:08 am »
It'd be nice if you could provide a screenshot of what's going on, and a complete and minimal piece of code that demonstrates it.
I use the latest build of SFML2

Azurus

  • Newbie
  • *
  • Posts: 7
    • View Profile
Overlaying Images
« Reply #2 on: October 09, 2011, 08:46:47 pm »
The problem is not as evident in the screenshot, but take a close look at the outline of the text and the right part of the bottom line. You'll probably need to use the zoom button to see it clearly.
http://imageshack.us/photo/my-images/718/failcug.png/

My code is pretty much this:
Code: [Select]
//Load images from file
sf::Image image, image2;
image.LoadFromFile("images/MainMenu.png");
image2.LoadFromFile("images/Background.png");

sf::Sprite sprite(image);
sf::Sprite sprite2(image2);

//Render
window.Clear();
window.Draw(sprite2);
window.Draw(sprite);

window.Display();

MainMenu.png is the black lines and Start Game/Exit Game text you see in the window. The background is the light blue/orangish thing behind it.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Overlaying Images
« Reply #3 on: October 10, 2011, 02:09:36 am »
Not only is that code not complete, but it would be a great idea to give us the actual images as well.
I use the latest build of SFML2

Azurus

  • Newbie
  • *
  • Posts: 7
    • View Profile
Overlaying Images
« Reply #4 on: October 10, 2011, 03:15:25 am »
Nevermind, I figured out that all I had to do was image2.SetSmooth(false); which apparently stops the image from blurring itself in an attempt to look smoother.