当前位置: 首页>>代码示例>>C++>>正文


C++ EventHandler::GetEventType方法代码示例

本文整理汇总了C++中EventHandler::GetEventType方法的典型用法代码示例。如果您正苦于以下问题:C++ EventHandler::GetEventType方法的具体用法?C++ EventHandler::GetEventType怎么用?C++ EventHandler::GetEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventHandler的用法示例。


在下文中一共展示了EventHandler::GetEventType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UnsubscribeFromEventReceiver

void Object::UnsubscribeFromEventReceiver(Object* receiver)
{
    EventHandler* handler = eventHandlers_.First();
    EventHandler* previous = 0;

    while (handler)
    {
        if (handler->GetReceiver() == receiver)
        {

            if (handler->GetSender())
                context_->RemoveEventReceiver(this, handler->GetSender(), handler->GetEventType());
            else
                context_->RemoveEventReceiver(this, handler->GetEventType());

            EventHandler* next = eventHandlers_.Next(handler);
            eventHandlers_.Erase(handler, previous);
            handler = next;
        }
        else
        {
            previous = handler;
            handler = eventHandlers_.Next(handler);
        }
    }

}
开发者ID:dragonCASTjosh,项目名称:AtomicGameEngine,代码行数:27,代码来源:Object.cpp

示例2: UnsubscribeFromAllEvents

void Object::UnsubscribeFromAllEvents()
{
    for (;;)
    {
        EventHandler* handler = eventHandlers_.First();
        if (handler)
        {
            if (handler->GetSender())
                context_->RemoveEventReceiver(this, handler->GetSender(), handler->GetEventType());
            else
                context_->RemoveEventReceiver(this, handler->GetEventType());
            eventHandlers_.Erase(handler);
        }
        else
            break;
    }
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:17,代码来源:Object.cpp

示例3: UnsubscribeFromAllEventsExcept

void Object::UnsubscribeFromAllEventsExcept(const PODVector<StringHash>& exceptions, bool onlyUserData)
{
    EventHandler* handler = eventHandlers_.First();
    EventHandler* previous = 0;
    
    while (handler)
    {
        EventHandler* next = eventHandlers_.Next(handler);
        
        if ((!onlyUserData || handler->GetUserData()) && !exceptions.Contains(handler->GetEventType()))
        {
            if (handler->GetSender())
                context_->RemoveEventReceiver(this, handler->GetSender(), handler->GetEventType());
            else
                context_->RemoveEventReceiver(this, handler->GetEventType());
            
            eventHandlers_.Erase(handler, previous);
        }
        else
            previous = handler;

        handler = next;
    }
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:24,代码来源:Object.cpp

示例4: FindSpecificEventHandler

EventHandler* Object::FindSpecificEventHandler(Object* sender, StringHash eventType, EventHandler** previous) const
{
    EventHandler* handler = eventHandlers_.First();
    if (previous)
        *previous = 0;
    
    while (handler)
    {
        if (handler->GetSender() == sender && handler->GetEventType() == eventType)
            return handler;
        if (previous)
            *previous = handler;
        handler = eventHandlers_.Next(handler);
    }
    
    return 0;
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:17,代码来源:Object.cpp

示例5: FindEventHandler

EventHandler* Object::FindEventHandler(StringHash eventType, EventHandler** previous) const
{
    EventHandler* handler = eventHandlers_.First();
    if (previous)
        *previous = 0;
    
    while (handler)
    {
        if (handler->GetEventType() == eventType)
            return handler;
        if (previous)
            *previous = handler;
        handler = eventHandlers_.Next(handler);
    }
    
    return 0;
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:17,代码来源:Object.cpp

示例6: UnsubscribeFromEvents

void Object::UnsubscribeFromEvents(Object* sender)
{
    if (!sender)
        return;
    
    for (;;)
    {
        EventHandler* previous;
        EventHandler* handler = FindSpecificEventHandler(sender, &previous);
        if (handler)
        {
            context_->RemoveEventReceiver(this, handler->GetSender(), handler->GetEventType());
            eventHandlers_.Erase(handler, previous);
        }
        else
            break;
    }
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:18,代码来源:Object.cpp

示例7: OnEvent

void Object::OnEvent(Object* sender, StringHash eventType, VariantMap& eventData)
{
    // Make a copy of the context pointer in case the object is destroyed during event handler invocation
    Context* context = context_;
    EventHandler* specific = 0;
    EventHandler* nonSpecific = 0;
    
    EventHandler* handler = eventHandlers_.First();
    while (handler)
    {
        if (handler->GetEventType() == eventType)
        {
            if (!handler->GetSender())
                nonSpecific = handler;
            else if (handler->GetSender() == sender)
            {
                specific = handler;
                break;
            }
        }
        handler = eventHandlers_.Next(handler);
    }
    
    // Specific event handlers have priority, so if found, invoke first
    if (specific)
    {
        context->SetEventHandler(specific);
        specific->Invoke(eventData);
        context->SetEventHandler(0);
        return;
    }
    
    if (nonSpecific)
    {
        context->SetEventHandler(nonSpecific);
        nonSpecific->Invoke(eventData);
        context->SetEventHandler(0);
    }
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:39,代码来源:Object.cpp


注:本文中的EventHandler::GetEventType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。