- Shall I use a static class (all variables and methods are static) which tells each card what has been played/activated?
- Is <csignal> of any use for this?
- Shall I generate an instance of signal handler and send its reference to each Card (SignalHandler& sig_handler;)?
2 replies to this topic
#1 Members - Reputation: 185
Posted 09 April 2012 - 11:24 AM
I'm currently working on my own Yu-Gi-Oh! Game (I know, there are a lot of people AND a big company working on it, but it's perfect practice for me) and I think of a "Send Signal"-System everytime a player summons a monster or activates a spell/trap card. Now the problem is how to generate such a signal handler:
Sponsor:
#3 Moderators - Reputation: 7678
Posted 09 April 2012 - 01:58 PM
Those signals are generally used for interprocess communication. That is, if you want to send a message to another different process.
Many games will implement their own event listeners; this model is supported by most modern languages where you can register event listeners, and easily broadcast to all interested listeners.
A simple search for "games message event bus" gives a bunch of useful descriptions of how to implement them, many including source code.
Many games will implement their own event listeners; this model is supported by most modern languages where you can register event listeners, and easily broadcast to all interested listeners.
A simple search for "games message event bus" gives a bunch of useful descriptions of how to implement them, many including source code.






