SFML community forums

General => General discussions => Topic started by: barnack on August 04, 2019, 05:24:27 pm

Title: Why isn't there a networking event?
Post by: barnack on August 04, 2019, 05:24:27 pm
Game Maker has it, and it makes sense to me honestly. Not as default, but as a feature the programmer can either enable or disable.

The idea is being able to receive and elaborate networking messages through the events system, without requiring the user to deal with async stuff.

Right now for what i'm working on i'll make a class that does exactly that, in a second thread it takes data from the network and fills a queue; the main cycle after handling events handles that queue's content as if it was another event. (well it's more complex than that for thread safety and actually uses two queues so you don't lock the main thread, but that's the idea.)
Title: Re: Why isn't there a networking event?
Post by: Rosme on August 05, 2019, 06:16:09 pm
Because the event system is made to handle window related event(e.g. keyboard input in the window, mouse in the window, resizing, close, etc.)

SFML is not a game engine. It's up to you to implement a network event system. Plus the way you do may not solve all use cases.