Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2009, 4:56:42 AM (15 years ago)
Author:
landauf
Message:

Added support for named events (so one object can fire multiple different events).
Added a new class, EventFilter, to filter differently named events and map them to different states.

I've wrapped the event names with a pretty useless macro, but I want to expand this in the future and register possible event names in the Identifier of the corresponding class. This allows us to get the possible event names in a static manner and thus build an editor upon it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/BaseObject.cc

    r5887 r5888  
    300300        @brief Fires an event (without a state).
    301301    */
    302     void BaseObject::fireEvent()
    303     {
    304         this->fireEvent(true);
    305         this->fireEvent(false);
     302    void BaseObject::fireEvent(const std::string& name)
     303    {
     304        this->fireEvent(true, name);
     305        this->fireEvent(false, name);
    306306    }
    307307
     
    309309        @brief Fires an event which activates or deactivates a state.
    310310    */
    311     void BaseObject::fireEvent(bool activate)
    312     {
    313         this->fireEvent(activate, this);
     311    void BaseObject::fireEvent(bool activate, const std::string& name)
     312    {
     313        this->fireEvent(activate, this, name);
    314314    }
    315315
     
    317317        @brief Fires an event which activates or deactivates a state with agiven originator (the object which triggered the event).
    318318    */
    319     void BaseObject::fireEvent(bool activate, BaseObject* originator)
    320     {
    321         Event event(activate, originator);
     319    void BaseObject::fireEvent(bool activate, BaseObject* originator, const std::string& name)
     320    {
     321        Event event(activate, originator, name);
    322322
    323323        for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
Note: See TracChangeset for help on using the changeset viewer.