Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Trying to load tilemap in .tmx format  (Read 1649 times)

0 Members and 1 Guest are viewing this topic.

Mmarzex

  • Newbie
  • *
  • Posts: 8
    • View Profile
Trying to load tilemap in .tmx format
« on: February 22, 2013, 09:00:11 pm »
Hi all,

So I am trying to load my tilemap from tiled using the loader created here for SFML 2.0 found in this topic http://en.sfml-dev.org/forums/index.php?topic=3023.msg62106#msg62106.

My problem is that it appears to work but when I run it I get this in my window:


. It gives me that blue at the top which makes me think it is loading but I'm not sure at all.
 
here is my main.cpp
#include<SFML/Graphics.hpp>
#include "ResourcePath.hpp"
#include<iostream>
#include<fstream>

#include<string>
#include<vector>
#include<sstream>
#include "TmxLoader.h"

#define ScreenWidth 800
#define ScreenHeight 600

#define BLOCKSIZE 40
int main()
{
    sf::RenderWindow Window(sf::VideoMode(ScreenWidth, ScreenHeight, 32), "SFML Made Easy");
    bool play = true;
    sf::Event event;
   
    //LoadMap("/Users/maxmarze/Dropbox/sfml/Udemy/Udemy/Map1.txt");
    sf::View myView;
    myView.setSize(sf::Vector2f(1000, 1000));
    myView.setCenter(400, 300);
   
    tmx::TileMap myMap;
   
    myMap.LoadFromFile("level One_one.tmx", "/Users/maxmarze/Dropbox/sfml/Udemy/Udemy/tile_maps/");
    myMap.SetDrawingBounds(myView.getViewport());
   
    while(play == true)
    {
        while(Window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
            {
                play = false;
            }
        }
       
        Window.clear();
      //  DrawMap(Window);
        myMap.Draw(Window);
        Window.display();
       
       
    }
   
    Window.close();
    return 0;
}

And the loader code is just in the above link. My tile map is 800*800 pixels so I don't understand why it would not be loading on the full screen. Anyone have any idea?