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 - jronald

Pages: [1]
1
Graphics / view.move not smooth enough
« on: December 14, 2014, 08:58:02 am »
BTW, if the line below is commented out,  it will be fast enough:
window.setFramerateLimit(60);

-----------------------------------------------------

When navigating on the map, it is not smooth enough, especially when the resolution  of the view is high.
Any way to optimize? Thanks.

int main()
{
        sf::View view(sf::FloatRect(0, 0, 1280, 720));

        sf::Texture texture;
        texture.loadFromFile("world.png");

        sf::Sprite map(texture);

        sf::RenderWindow window(sf::VideoMode(640, 480), "test view");
        window.setFramerateLimit(60);

        // run the main loop
        while (window.isOpen())
        {
                // handle events
                sf::Event event;
                while (window.pollEvent(event))
                {
                        switch (event.type)
                        {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        default:
                                break;
                        }
                }

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
                {
                        view.move(0, -4);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
                {
                        view.move(-4, 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
                {
                        view.move(0, 4);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
                {
                        view.move(4, 0);
                }

                window.clear();

                window.setView(view);
                window.draw(map);

                window.display();
        }

        return 0;
}
 

2
Develop Environment:
    Visual Studio 2013
    Windows 7
    Debug

0. In project/property page/Debugging set Environment to ../../lib/Debug
1. copy the resource directory to the project directory if there is one

Why not to make it automatic?
Thanks.

3
Graphics / Does SFML support partially refresh/redraw?
« on: December 09, 2014, 05:45:44 pm »
In SFML 2.1, I only find the RenderWindow::clear(color) that clear the whole window, also the Window::display draw the whole window.

My question is that, does it support, for example, only draw the necessary area, e.g. a rect. I think it'll be much efficent then. This is very good for developing apps/boardgames etc.

Pages: [1]
anything