Hello.
I apologize in advance for my weak English
I wrote a class that draws tilemap several layers , but I have a problem because the tile layer "solid " or " object" draw with a black border ( alpha channel is black )
Shows how it looks more or less
I read data from XML.
Problem exist in layer other than bg, while dot is "player"
"bg" tiles is always appended to vertex array first than "solid" or "objects"
// class declaration TileMap : public sf::Drawable, public sf::Transformable
// i try set sf::BlendAlpha, no effect
while(tile)
{
if(lName == "bg")
{
appendTile(x,y,tileNumber);
}
if(lName == "solid" && tileNumber != -1)
{
appendTile(x,y,tileNumber);
solidTiles.push_back(SolidTile(x,y));
}
}
and append tile function.
void TileMap::appendTile(const sf::Int32 x,const sf::Int32 y, const sf::Int32 GID)
{
sf::Int32 tu = GID % (m_tileset.getSize().x / tile_width);
sf::Int32 tv = GID / (m_tileset.getSize().x / tile_height);
sf::Vertex* quad = &m_vertices[(x + y * width_in_tiles) * 4];
quad[0].position = sf::Vector2f(x * tile_width, y * tile_height);
quad[1].position = sf::Vector2f((x + 1) * tile_width, y * tile_height);
quad[2].position = sf::Vector2f((x + 1) * tile_width, (y + 1) * tile_height);
quad[3].position = sf::Vector2f(x * tile_width, (y + 1) * tile_height);
quad[0].texCoords = sf::Vector2f(tu * tile_width, tv * tile_height);
quad[1].texCoords = sf::Vector2f((tu + 1) * tile_width, tv * tile_height);
quad[2].texCoords = sf::Vector2f((tu + 1) * tile_width, (tv + 1) * tile_height);
quad[3].texCoords = sf::Vector2f(tu * tile_width, (tv + 1) * tile_height);
}
problem looks like that
Thanks in advance.