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

Pages: [1]
1
Window / waitEvent - loop.
« on: June 23, 2023, 10:55:14 am »
Is it possible to make simple example, that is something like :

#include <iostream>
#include <SFML\Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(300, 300), "SFML Works");

        sf::RectangleShape shape(sf::Vector2f(150,150));

        shape.setFillColor(sf::Color::Blue);

        while (window.isOpen()) {

                sf::Event event;
                while (window.pollEvent(event)) {

                        if (event.type == sf::Event::Closed) {
                                window.close();
                        }

                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}

To be done using waitEvent in gameloop instead of pollEvent, and make this basic example work?

2
General / Events - help.
« on: June 15, 2023, 03:44:34 pm »
Hi everybody,

First, i would love to say that i use to develop a lot of stuff using SFML a few years ago, all following docs from your page, but now i have a problem that i don't know how to resolve.

I was making kind of presentation/tutorial of SFML, and now i am in a bit of problem because i have request to make a one example of using SFML with full event driven game loop (not optimized "busy wait" loop with controlling number of FPS). As a saw, all stuff like - setFrameLimit, vsync, or manually customized with timers - are giving good performance with small CPU usage, but still, request is - make one example with full event driven loop ( wait for event - i know that there is - WaitForEvent function, but i was using it only in some situations in combination with PollEvent, like pauses etc ).

Is it possible for someone of you to help me, or make basic example with just drawing screen or something trivial on it like square ?

Thank you for reading.


Pages: [1]