SFML community forums
Help => Graphics => Topic started by: dreadnought on March 01, 2012, 12:46:14 pm
-
Hi there,
im currently trying to get my tilemap working.
mostly it works fine, but to reduce the number of
needed tiles i added the abillity to rotate a tile.
But when i actually do that i get some nasty black lines.
(See the pic i added)
Here is the code i use:
( Tilesize is 50)
MapTile.LoadFromFile("data/img/TileSet.png");
MapTile.SetSmooth(false);
maptile.SetImage(MapTile);
maptile.SetCenter(25,25);
mousetile.SetImage(MapTile);
mousetile.SetCenter(25,25);
...
// Draw Map-Tiles
for (int i = View::GetViewRect().Left/TileSize; i<View::GetViewRect().Right/TileSize && i<Game::GetMapWidth();i++)
{
for (int j = View::GetViewRect().Top/TileSize; j<View::GetViewRect().Bottom/TileSize && j<Game::GetMapHeight();j++)
{
maptile.SetPosition(i*TileSize+25,j*TileSize+25);
sf::IntRect SubRect;
if(Map[i][j]._tile==0)
{
emptytile.SetPosition(i*TileSize,j*TileSize);
renderWindow.Draw(emptytile);
}
if(Map[i][j]._tile==1)
{
SubRect.Left=0;
SubRect.Top=0;
SubRect.Right=50;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==2)
{
SubRect.Left=50;
SubRect.Top=0;
SubRect.Right=100;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==3)
{
SubRect.Left=0;
SubRect.Top=50;
SubRect.Right=50;
SubRect.Bottom=100;
}
if(Map[i][j]._tile==4)
{
SubRect.Left=50;
SubRect.Top=50;
SubRect.Right=100;
SubRect.Bottom=100;
}
if(Map[i][j]._tile!=0)
{
maptile.SetSubRect(SubRect);
maptile.SetRotation(Map[i][j]._direction*90);
renderWindow.Draw(maptile);
}
}
}
can someone help me with this?
(http://i44.tinypic.com/avk3tz.jpg)
-
Have you tried to turn smoothing off (tilemap.SetSmooth(false))?
-
as you can see on line two of the code smoothing is allready set off
-
Sorry, I didn't see it.
You should try SFML 2. SFML 1.6 has some bugs and is not maintained anymore, you'll get more help (especially from me) with SFML 2.
-
i didnt changed to SFML 2.0 because there is no official release yet.
Im afraid i have to update my code to often when i use it before it is "ready"
But when you say "Hey fool, change to SFML 2.0! It is worth it!" i surely will update...
(and then bomb you with questions you have to answer ;) )
-
SFML 2 is complete, but there's still one change to do, and it will possibly impact all the classes and functions. So... yeah, wait a little bit more :D