Event Manager

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
RustyNail
Posts: 168
Joined: Fri Jun 02, 2006 1:49 pm
Contact:

Event Manager

Post by RustyNail »

I have an Event structure:

Code: Select all

typedef struct {
     int type, sender, receivers, data ;
}event;
where sender / receivers are indices of Scene Nodes, a vector of which (ID & Pointer) is held in my Scene Manager.
The Root Node has an Index of 0,
All node that need to receive "system" events (key press, key release, mouse moe, etc...) have negative indices. all others - positive...
A Key press triggers the Scene Manager's sendEvent() method, which sends an event to all 'negative' nodes ( getEvent(event) ), they then decide what to do. Now, while this is effective for sending events to many nodes from the outside of the scene manager, it is almost impossible to send specific events to seperate nodes, especially from the update() procedure of a node, like a collision event...
My questions to you:
1. What do you think of this system?
2. How can I make it be capable of easily sending specific events from one node to another?
:roll:
I have recently discovered that both the Flu and my Algebra teacher have exact the same effect on my health: it quickly degrades.
Post Reply