Tiled Map Loader for SFML Help
Jun 14, 2013 at 3:41am UTC
So I have the following code using
http://en.sfml-dev.org/forums/index.php?topic=3023.0. It compiles correctly, but does not display the map on the screen. Is it an issue with my code or an issue with the map file itself?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <level.h>
int main(){
sf::RenderWindow window(sf::VideoMode(640, 480), "" );
sf::View view;
view.setCenter(player_x, player_y);
view.setSize(640, 480);
Level sample_map;
sample_map.LoadFromFile("c:/gfx/sample_map.tmx" );
sample_map.SetDrawingBounds(view.getViewport());
while (window.isOpen()){
sf::Event event;
while (window.pollEvent(event)){
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Green);
window.setView(view);
sample_map.Draw(window);
window.display();
}
return 0;
}
Jun 14, 2013 at 4:28pm UTC
Last edited on Jun 14, 2013 at 6:33pm UTC
Topic archived. No new replies allowed.