Hi,
I was reading through the tutorial module on vertex arrays, and I found a few code typos that might need to be fixed.
Please take a look at the tilemap example. When you are getting the position of the tile's texture from the texturemap, the tu variable is wrong. It currently reads:
int tu = tileNumber / (m_tileset.getSize().x / tileSize.x);
A modulus should be used there instead like this:
int tu = tileNumber % (m_tileset.getSize().x / tileSize.x);
Another couple of errors I found is when you define the quad's four corners. If you look at top left and bottom left corner the code is:
quad[0].position = sf::Vector2f(i) * tileSize.x, j * tileSize.y);
quad[3].position = sf::Vector2f(i) * tileSize.x, (j + 1) * tileSize.y);
You're closing out those two parenthesis too early. The code should be something like:
quad[0].position = sf::Vector2f(i * tileSize.x, j * tileSize.y);
quad[3].position = sf::Vector2f(i * tileSize.x, (j + 1) * tileSize.y);
Those corrections might be helpful for someone that's new to coding.