hi, here is a compressed example:
//#include "tilemap.h"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(512, 256),"RPG");
//TileMap t("testmap.tmx");
window.setFramerateLimit(20);
sf::VertexArray m_vertices;
sf::Texture m_tileset;
m_tileset.loadFromFile("Tileset.png");
m_vertices.setPrimitiveType(sf::Quads);
m_vertices.resize(4);
m_vertices[0].position = sf::Vector2f(0, 0);
m_vertices[1].position = sf::Vector2f(32,0);
m_vertices[2].position = sf::Vector2f(32,32);
m_vertices[3].position = sf::Vector2f(0,32);
m_vertices[0].texCoords = sf::Vector2f(0,0);
m_vertices[1].texCoords = sf::Vector2f(32,0);
m_vertices[2].texCoords = sf::Vector2f(32,32);
m_vertices[3].texCoords = sf::Vector2f(0,32);
sf::RenderStates states;
states.texture = &m_tileset;
while(window.isOpen())
{
sf::Event evt;
//Loop through all window events
while(window.pollEvent(evt))
{
if(evt.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(m_vertices,states);
window.display();
}
return 0;
}
The file is in the attachment.
Why sfml draws is this:
Im using one of the more recent 2.1 SFML versions.