Register/unregister events on objects

I have several objects in game and they have a set of events on which they react (left mouse click and mouse move).

In the certain point in game,some of those objects have to stop react on left mouse click and mouse move
and begin to take different event (right mouse click).How can this be done?

dekyco

I have several objects in game and they have a set of events on which they
react (left mouse click and mouse move).

In the certain point in game,some of those objects have to stop react on
left mouse click and mouse move
and begin to take different event (right mouse click).How can this be done?

Since no one has answered your question, I’ll give it a shot.

Have a flag in the object for each event type. If the flag is true,
then the object reacts to that event. If not, it ignores the event.
Have methods for setting and clearing the flags. When you want the
object to react to an event, set the event flag to true. When you want
the object to stop reacting to an event, set the flag to false.

Bob PendletonOn Sat, Jan 23, 2010 at 12:23 PM, dekyco wrote:

dekyco


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

Thank you Bob! I did some creative thinking and manage to get it right (at least for me),
something like this:

if (!vectorOfSprites[i]->SpriteDead())
…//move the sprite

dekyco

Thank you Bob! I did some creative thinking and manage to get it right (at
least for me),
something like this:

if (!vectorOfSprites[i]->SpriteDead())
…//move the sprite

Looks good to me.

Bob PendletonOn Mon, Feb 1, 2010 at 3:22 PM, dekyco wrote:

dekyco


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------