1
Graphics / Jagged edges
« on: May 26, 2011, 02:55:03 pm »
I'm playing around a bit with isometric tiles. At first transparency didn't work but after changing graphics software it worked as it should. But then I noticed that the transparency color bled into the bled into the sprite, so I turned off Smoothing. Now, however, I get jagged edges on my sprites. I cast the X/Y values to integers before drawing. How do I fix this?
The jagged edges wander when I move the sprite in the Y axis.
http://i.imgur.com/1xbsy.png
Also, is there a way to not have the transparent color bleed with smoothing enabled? The file is a .png created in Graphics Gale
The jagged edges wander when I move the sprite in the Y axis.
http://i.imgur.com/1xbsy.png
Also, is there a way to not have the transparent color bleed with smoothing enabled? The file is a .png created in Graphics Gale
Code: [Select]
#include <SFML/Graphics.hpp>
int main(int argc, char *argv[]){
char map[32][32];
unsigned int sprite = 0;
sf::RenderWindow App(sf::VideoMode(800,600,32), "Isometric tiles");
sf::Image Image;
if (!Image.LoadFromFile("testtile.png")){
}
Image.SetSmooth(false);
sf::Sprite Sprite;
Sprite.SetImage(Image);
App.SetFramerateLimit(50);
while(App.IsOpened()){
sf::Event Event;
while(App.GetEvent(Event)){
if(Event.Type == sf::Event::Closed){
App.Close();
}
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Q)){
sprite--;
}
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::W)){
sprite++;
}
if(Event.Type == sf::Event::MouseMoved){
Sprite.SetX((int)(Event.MouseMove.X));
Sprite.SetY((int)(Event.MouseMove.Y));
}
}
App.Clear();
Sprite.SetSubRect(sf::IntRect((64*sprite),0,(64*(sprite+1)), 32));
App.Draw(Sprite);
App.Display();
}
return EXIT_SUCCESS;
}