1
Graphics / How incorporate more tiles instead of just one?
« on: June 29, 2014, 09:37:10 am »
How would I add more than one tile to this vertex map? Haven't been able to find a solution, and my ideas that I have tried are very slim on working.
I want to be able to use more than on tile (like look at an array and replace the numbers with a tile???)
Any clues/help to get me started?
I want to be able to use more than on tile (like look at an array and replace the numbers with a tile???)
Any clues/help to get me started?
class MapLoader : public TileLoader
{
public:
MapLoader(void)
{
m_mapdata.MapX = 100;
m_mapdata.MapY = 100;
m_mapdata.TextureName = "0.gif";
}
virtual void AppendTile(int gx, int gy, sf::VertexArray& garr)
{
sf::Vertex ver;
ver.position = sf::Vector2f(gx*16.f, gy*16.f);
ver.texCoords = sf::Vector2f(0.f, 0.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f + 16.f, gy*16.f);
ver.texCoords = sf::Vector2f(16.f, 0.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f + 16.f, gy*16.f + 16.f);
ver.texCoords = sf::Vector2f(16.f, 16.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f, gy*16.f + 16.f);
ver.texCoords = sf::Vector2f(0.f, 16.f);
garr.append(ver);
}
};
{
public:
MapLoader(void)
{
m_mapdata.MapX = 100;
m_mapdata.MapY = 100;
m_mapdata.TextureName = "0.gif";
}
virtual void AppendTile(int gx, int gy, sf::VertexArray& garr)
{
sf::Vertex ver;
ver.position = sf::Vector2f(gx*16.f, gy*16.f);
ver.texCoords = sf::Vector2f(0.f, 0.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f + 16.f, gy*16.f);
ver.texCoords = sf::Vector2f(16.f, 0.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f + 16.f, gy*16.f + 16.f);
ver.texCoords = sf::Vector2f(16.f, 16.f);
garr.append(ver);
ver.position = sf::Vector2f(gx*16.f, gy*16.f + 16.f);
ver.texCoords = sf::Vector2f(0.f, 16.f);
garr.append(ver);
}
};