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

Author Topic: how to properly handle input/events?  (Read 1941 times)

0 Members and 1 Guest are viewing this topic.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
how to properly handle input/events?
« on: September 17, 2014, 05:11:49 pm »
Hello,

I Read the SFML game development book, and am very interested in how it handled input/events in its command based system. Is there anymore information on that subject? Also is this the best way if situational what other good methods are there? Should input be separated from other events? Should other systems than the entity system receive events? If so with the same system as the entities or different ones?

please help me and thank you for reading my post  :).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: how to properly handle input/events?
« Reply #1 on: September 17, 2014, 05:17:29 pm »
If you read the book, which part did you not understand? It's fully explained in the book...

There are always multiple ways to go about something. What is your use case?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: how to properly handle input/events?
« Reply #2 on: September 17, 2014, 05:28:46 pm »
I did understand but just extra info for maybe different ways, for example if i google command based communication system i don't really get anything useful. maybe some source that it in a bit more detail maybe a comparison with other alternatives what alternatives are there could you even do a full game without one?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: how to properly handle input/events?
« Reply #3 on: September 17, 2014, 06:07:01 pm »
The handling of input is nothing special. The basis is that when an event or input happens some form of a callback function gets called.

The command pattern from the book is one way and fits their game.
They do mention the message bus pattern which is a different way of doing things, but it can go beyond just input or system event.
The Thor library has yet again a different approach and enables you to uniformly handle realtime input and events.

Overall input/evenf handling is the relatively easy part of writting a game and it's important to choose a system that goes hand in hand with your game.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything