8
« on: September 03, 2010, 10:25:10 am »
I didn't really notice this until I started working on my tilemap system for my game, but all my images I try and render have a weird edge color to them on the top and left side of the images. Also I noticed that when I try and declare SetSubRect(left, top, right, bottom) my tile will only be 31, 31 and if I try and make it 32, 32 like it is in the tilesheet I get a portion of the other tile. Is this something already known, or what is the issue I am having here. I tried using different format images and that doesn't seem to fix the issue. I am starting small like a 3x3 tilemap, and I haven't been able to move up to larger because the issue stays the same. Do I need to create a empty space around all my tiles will that fix the issue? It almost seems like in the tilesheet it is blending the edges of the tiles around it creating a faded color. If the tile is alone a 32x32 image, than that faded border is on the top and left like I stated above.
Here is my code, below, if I set the subrect to be 32, 32, 64, 64 I get partial edge of my other tile, and if I try 33, 33, 65, 65 I also get partial edge of my other tile, seems like they are blending some how. And if I do 33, 33, 64, 64 I get not partial edges but then my tile is 31x31 when I take a screenshot and size it up.
int main()
{
sf::RenderWindow Game(sf::VideoMode(800, 600, 32), "SFML CLevel Class Test", sf::Style::Close);
sf::Event Event;
const sf::Input& Input = Game.GetInput();
sf::Image Buffer;
sf::Sprite Sprite;
if(!Buffer.LoadFromFile("MapSheet.png"))
return EXIT_FAILURE;
else
{
Sprite.SetImage(Buffer);
Sprite.SetSubRect(sf::IntRect(33, 33, 64, 64));
Sprite.SetPosition(100, 100);
}
while(Game.IsOpened())
{
while(Game.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed)
Game.Close();
}
if(Input.IsKeyDown(sf::Key::Escape))
Game.Close();
Game.Clear(sf::Color(100, 149, 236));
Game.Draw(Sprite);
Game.Display();
}
return EXIT_SUCCESS;
}