Sending between objects?

Started by
10 comments, last by dathui 20 years, 3 months ago
quote:Original post by antareus
I am in the middle of writing an article for GD on this subject actually. Look for it shortly.


woa...goodies''r''us

will look for it
reality is only an option
Advertisement
quote:Original post by Anonymous Poster
I just used a message singleton and each class would have a copy of the same msg handler. The classes/objects would then register with the msg handler in their initialisation giving it a uniqie ID. The Msg handler then created a queue for each registered class to hold its messages.

It was up to the classes to check for mail in by calling the msngr handler, which just returned the message at the front of the queue.

In addition to the queue, each class could register a function/callback to be called by the msgr for really important messages, sort of like an interrupt. So normal priority messages would be placed in the queue to be checked at leasiure, while others such as QUIT etc. were initiated automatically.

Don''t know if it''s a good way to do it or not but it worked quite well for our game.


i had a similar design in mind...thou i was worried about how fast it would be, but i''ll look into it as it worked well for you. thanks
reality is only an option

This topic is closed to new replies.

Advertisement