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

Author Topic: Map tearing  (Read 1311 times)

0 Members and 1 Guest are viewing this topic.

test

  • Newbie
  • *
  • Posts: 4
    • View Profile
Map tearing
« on: November 03, 2015, 04:11:28 pm »
I'm trying to make a game. But when I tried to load and use map (I'm using this lib to load map made in Tiled -> http://trederia.blogspot.co.uk/2013/05/tiled-map-loader-for-sfml.html) it starts tearing like on the images listed below(first image is normal the second is the problem). There is the code that have this problem
#include <tmx/MapLoader.h>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace sf;
using namespace tmx;
using namespace std;

void main()
{
        RenderWindow mWindow(VideoMode(640,480),"");
        MapLoader mlvl("");
        if (!(mlvl.Load("stage1.tmx")))
        {
                cout << "Map error";
        }

        Clock clock;
        while (mWindow.isOpen())
        {

                float time = clock.getElapsedTime().asSeconds();
                clock.restart();
               
                Event event;
                while (mWindow.pollEvent(event))
                {
                        if (event.type == Event::Closed)
                                mWindow.close();
                }

                View view = mWindow.getView();
                view.move(Vector2f(0.1*time, 0.1*time));

                mWindow.setView(view);

                mWindow.clear();
                mWindow.draw(mlvl);
                mWindow.display();
        }
}
 

So, can someone say where I need to dig?

P.S. There is archive with map and tile sheet if you want to run this code.

(click to show/hide)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Map tearing
« Reply #1 on: November 03, 2015, 04:14:06 pm »
Laurent Gomila - SFML developer

test

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Map tearing
« Reply #2 on: November 03, 2015, 05:00:45 pm »
Thanks, that helped.

 

anything