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

Author Topic: Is SFML message-driven or event-driven?  (Read 114 times)

0 Members and 1 Guest are viewing this topic.

hdsiria

  • Newbie
  • *
  • Posts: 21
    • View Profile
Is SFML message-driven or event-driven?
« on: April 29, 2024, 03:49:48 pm »
i asked ai and it says:

It is based on an event-driven model.In SFML, the main event loop is controlled by the SFML application. The application constantly retrieves events from the event queue and responds accordingly. This event loop is responsible for receiving user input, updating game state, rendering graphics, and other operations.
 
Is it true?

kojack

  • Sr. Member
  • ****
  • Posts: 318
  • C++/C# game dev teacher.
    • View Profile
Re: Is SFML message-driven or event-driven?
« Reply #1 on: April 29, 2024, 04:49:10 pm »
Not really correct.
SFML apps are not specifically event driven. Usually the main application loop will do an inner event loop for some things like resizing the window or doing event based keyboard/mouse stuff, but the events are not used for game state or rendering (and input can also be done without events).
Events only happen when something like a key is pressed or something happens to the window, but a game needs to run continuously, faster than events come in. So it's not like an event based application like Winforms or similar.