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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - test

Pages: [1]
1
Graphics / 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)

2
General / How can I make looped map?
« on: October 10, 2015, 10:06:28 am »
I'm making side scrolling game and i want to loop my map, so when the player goes right, map repeats infinitely and enemies, coins and so on generate randomly. How can I do it with SFML?
(click to show/hide)

Pages: [1]
anything