1
Graphics / Re: 1024 x 1024 tile map
« on: June 23, 2017, 05:40:43 pm »
So I've added this method to the loop which creates 4 vertecies in a
vector<vector<sf::Vertex>> vertices;
this is the way I'm currently assigning them
void CGameMap::CreateRenderingVertecies(int row,int col)
{
int temp = col * 4;
sf::Vertex* tStrip = &vertices[row][temp];
tStrip[0].position = sf::Vector2f(temp / 4 * multiplier row * multiplier);
tStrip[1].position = sf::Vector2f(temp / 4 * multiplier, (row + 1) * multiplier);
tStrip[2].position = sf::Vector2f((temp / 4 + 1)*multiplier, row * multiplier);
tStrip[3].position = sf::Vector2f((temp / 4 + 1)*multiplier, (row + 1) * multiplier);
tStrip[0].texCoords = sf::Vector2f(0, 0);
tStrip[1].texCoords = sf::Vector2f(0, 16);
tStrip[2].texCoords = sf::Vector2f(16, 0);
tStrip[3].texCoords = sf::Vector2f(16, 16);
}
I am not sure, how to attach the texture and/or states in order to use it in my draw method where im passing a reference of the window.
vector<vector<sf::Vertex>> vertices;
this is the way I'm currently assigning them
void CGameMap::CreateRenderingVertecies(int row,int col)
{
int temp = col * 4;
sf::Vertex* tStrip = &vertices[row][temp];
tStrip[0].position = sf::Vector2f(temp / 4 * multiplier row * multiplier);
tStrip[1].position = sf::Vector2f(temp / 4 * multiplier, (row + 1) * multiplier);
tStrip[2].position = sf::Vector2f((temp / 4 + 1)*multiplier, row * multiplier);
tStrip[3].position = sf::Vector2f((temp / 4 + 1)*multiplier, (row + 1) * multiplier);
tStrip[0].texCoords = sf::Vector2f(0, 0);
tStrip[1].texCoords = sf::Vector2f(0, 16);
tStrip[2].texCoords = sf::Vector2f(16, 0);
tStrip[3].texCoords = sf::Vector2f(16, 16);
}
I am not sure, how to attach the texture and/or states in order to use it in my draw method where im passing a reference of the window.