BVB Source Codes

CRYENGINE Show CustomEventsManager.h Source code

Return Download CRYENGINE: download CustomEventsManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef _CUSTOMEVENTMANAGER_H_
  4. #define _CUSTOMEVENTMANAGER_H_
  5.  
  6. #if _MSC_VER > 1000
  7.         #pragma once
  8. #endif
  9.  
  10. #include <CryAction/ICustomEvents.h>
  11. #include <CryCore/Containers/CryListenerSet.h>
  12.  
  13. ///////////////////////////////////////////////////
  14. // Manager implementation to associate custom events
  15. ///////////////////////////////////////////////////
  16. class CCustomEventManager : public ICustomEventManager
  17. {
  18. public:
  19.         CCustomEventManager();
  20.         virtual ~CCustomEventManager();
  21.  
  22. public:
  23.         // ICustomEventManager
  24.         virtual bool           RegisterEventListener(ICustomEventListener* pListener, const TCustomEventId eventId) override;
  25.         virtual bool           UnregisterEventListener(ICustomEventListener* pListener, const TCustomEventId eventId) override;
  26.         virtual bool           UnregisterEvent(TCustomEventId eventId) override;
  27.         virtual void           Clear() override;
  28.         virtual void           FireEvent(const TCustomEventId eventId, const TFlowInputData& customData) override;
  29.         virtual TCustomEventId GetNextCustomEventId() override;
  30.         // ~ICustomEventManager
  31.  
  32.         void GetMemoryUsage(ICrySizer* pSizer) const
  33.         {
  34.                 SIZER_COMPONENT_NAME(pSizer, "CustomEventManager");
  35.  
  36.                 pSizer->AddObject(this, sizeof(*this));
  37.         }
  38.  
  39. private:
  40.         typedef CListenerSet<ICustomEventListener*> TCustomEventListeners;
  41.  
  42.         struct SCustomEventData
  43.         {
  44.                 SCustomEventData()
  45.                         : m_listeners(0)
  46.                 {}
  47.  
  48.                 TCustomEventListeners m_listeners;
  49.         };
  50.  
  51.         // Mapping of custom event id to listeners
  52.         typedef std::map<TCustomEventId, SCustomEventData> TCustomEventsMap;
  53.         TCustomEventsMap m_customEventsData;
  54.         TCustomEventId   m_curHighestEventId;
  55. };
  56.  
  57. #endif
  58.  
downloadCustomEventsManager.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top