SFML community forums

Help => Graphics => Topic started by: Azurus on October 09, 2011, 07:40:41 am

Title: Overlaying Images
Post by: Azurus 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.
Title: Overlaying Images
Post by: OniLinkPlus 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.
Title: Overlaying Images
Post by: Azurus 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.
Title: Overlaying Images
Post by: OniLinkPlus 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.
Title: Overlaying Images
Post by: Azurus 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.