diff --git a/public/engine/IEngineService.h b/public/engine/IEngineService.h index 2592190a..f365715f 100644 --- a/public/engine/IEngineService.h +++ b/public/engine/IEngineService.h @@ -13,8 +13,8 @@ #include #include #include -// AM TODO: eventdispatcher.h needs to be added when we get CEventDispatcher ready. +class ISwitchLoopModeStatusNotify; class IAddonListChangeNotify; struct EventClientOutput_t @@ -30,12 +30,12 @@ public: virtual void *GetServiceDependencies( void ) = 0; virtual const char *GetName( void ) const = 0; virtual bool ShouldActivate( const char * ) = 0; - virtual void OnLoopActivate( const EngineLoopState_t &loopState, /*CEventDispatcher * */void * pEventDispatcher) = 0; - virtual void OnLoopDeactivate( const EngineLoopState_t &loopState, /*CEventDispatcher * */ void *pEventDispatcher) = 0; + virtual void OnLoopActivate( const EngineLoopState_t &loopState, CEventDispatcher *pEventDispatcher) = 0; + virtual void OnLoopDeactivate( const EngineLoopState_t &loopState, CEventDispatcher *pEventDispatcher) = 0; virtual bool IsActive( void ) const = 0; virtual void SetActive( bool ) = 0; virtual void SetName( const char *pszName ) = 0; - virtual void RegisterEventMap( /*CEventDispatcher * */ void *pEventDispatcher, EventMapRegistrationType_t nRegistrationType ) = 0; + virtual void RegisterEventMap( CEventDispatcher *pEventDispatcher, EventMapRegistrationType_t nRegistrationType ) = 0; virtual uint16 GetServiceIndex( void ) = 0; virtual void SetServiceIndex( uint16 index ) = 0; }; @@ -51,15 +51,15 @@ public: virtual const char *GetActiveLoopName( void ) const = 0; virtual IEngineService *FindService( const char * ) = 0; virtual PlatWindow_t GetEngineWindow( void ) const = 0; - virtual SwapChainHandle_t GetEngineSwapChain(void) const = 0; - virtual void *GetEngineInputContext( void ) const = 0; + virtual SwapChainHandle_t GetEngineSwapChain( void ) const = 0; + virtual InputContextHandle_t GetEngineInputContext( void ) const = 0; virtual void *GetEngineDeviceInfo( void ) const = 0; virtual int GetEngineDeviceWidth( void ) const = 0; virtual int GetEngineDeviceHeight( void ) const = 0; virtual int GetEngineSwapChainSize( void ) const = 0; virtual bool IsLoopSwitchQueued( void ) const = 0; virtual bool IsLoopSwitchRequested( void ) const = 0; - virtual /*CEventDispatcher * */void * GetEventDispatcher(void) = 0; + virtual CEventDispatcher *GetEventDispatcher( void ) = 0; virtual void *GetDebugVisualizerMgr( void ) = 0; virtual int GetActiveLoopClientServerMode( void ) const = 0; virtual void EnableMaxFramerate( bool ) = 0; diff --git a/public/engine/eventdispatcher.h b/public/engine/eventdispatcher.h new file mode 100644 index 00000000..ff55186c --- /dev/null +++ b/public/engine/eventdispatcher.h @@ -0,0 +1,62 @@ +#ifndef EVENTDISPATCHER_H +#define EVENTDISPATCHER_H + +#ifdef _WIN32 +#pragma once +#endif + +#include +#include + +class ISchemaBinding; + +struct CEventDispatcher_Base +{ + struct EventListenerInfo_t + { + CUtlAbstractDelegate m_Delegate; + const char *m_pszName; + int32 m_nPriority; + uint8 m_nDelegateParamCount; + bool m_bDelegateReturnsVoid; + }; + + struct DelegateIterator_Base_t + { + const CUtlVector< EventListenerInfo_t > *pListeners; + CUtlVectorFixedGrowable< int, 4 > skipListeners; + int nCurrent; + DelegateIterator_Base_t *pNext; + bool bIteratingForward; + bool bIsInListenerTelemetryScope; + }; + + CThreadFastMutex m_Lock; + DelegateIterator_Base_t *m_pActiveIterators; +}; + +struct CEventID_SchemaBinding +{ + int8 unused; +}; + +struct CEventIDManager_SchemaBinding : CEventID_SchemaBinding +{ +}; + +struct CEventIDManager_Default : CEventIDManager_SchemaBinding +{ +}; + +template +struct CEventDispatcher_Identified : CEventDispatcher_Base +{ + CUtlMap< const ISchemaBinding*, CCopyableUtlVector, unsigned int, bool (*)(const ISchemaBinding* const&, const ISchemaBinding* const&)> m_EventListenerMap; +}; + +template +struct CEventDispatcher : CEventDispatcher_Identified +{ +}; + +#endif // EVENTDISPATCHER_H \ No newline at end of file diff --git a/public/iloopmode.h b/public/iloopmode.h index 25849565..72776d44 100644 --- a/public/iloopmode.h +++ b/public/iloopmode.h @@ -11,15 +11,14 @@ #endif #include +#include #include +#include -class ISwitchLoopModeStatusNotify; class ISource2WorldSession; class ISceneView; class IPrerequisite; -DECLARE_POINTER_HANDLE(PlatWindow_t); -DECLARE_POINTER_HANDLE(InputContextHandle_t); DECLARE_POINTER_HANDLE(SwapChainHandle_t); DECLARE_POINTER_HANDLE(HSceneViewRenderTarget); DECLARE_POINTER_HANDLE(ActiveLoop_t); @@ -106,9 +105,9 @@ abstract_class ILoopMode public: virtual bool LoopInit( KeyValues *pKeyValues, ILoopModePrerequisiteRegistry *pRegistry ) = 0; virtual void LoopShutdown( void ) = 0; - virtual void OnLoopActivate( const EngineLoopState_t &state, /*CEventDispatcher **/void* pEventDispatcher) = 0; - virtual void OnLoopDeactivate( const EngineLoopState_t &state, /*CEventDispatcher **/void *pEventDispatcher ) = 0; - virtual void RegisterEventMap( /*CEventDispatcher **/void* pEventDispatcher, EventMapRegistrationType_t nRegistrationType) = 0; + virtual void OnLoopActivate( const EngineLoopState_t &state, CEventDispatcher *pEventDispatcher) = 0; + virtual void OnLoopDeactivate( const EngineLoopState_t &state, CEventDispatcher *pEventDispatcher ) = 0; + virtual void RegisterEventMap( CEventDispatcher *pEventDispatcher, EventMapRegistrationType_t nRegistrationType) = 0; virtual InputHandlerResult_t HandleInputEvent( const InputEvent_t &event, CSplitScreenSlot nSplitScreenPlayerSlot ) = 0; virtual ISceneView* AddViewsToSceneSystem( const EngineLoopState_t &state, double flRenderTime, double flRealTime, const RenderViewport_t &viewport, const RHBackColorBuffer_t &backColorBuffer ) = 0; diff --git a/public/inputsystem/InputEnums.h b/public/inputsystem/InputEnums.h index 76d8fe88..6e464f68 100644 --- a/public/inputsystem/InputEnums.h +++ b/public/inputsystem/InputEnums.h @@ -11,6 +11,9 @@ #endif #include "tier0/basetypes.h" +#include "tier0/platwindow.h" + +FORWARD_DECLARE_HANDLE( InputContextHandle_t ); // Standard maximum +/- value of a joystick axis #define MAX_BUTTONSAMPLE 32768 @@ -99,9 +102,10 @@ enum InputEventType_t struct InputEvent_t { + PlatWindow_t m_hWnd; int m_nType; // Type of the event (see InputEventType_t) int m_nTick; // Tick on which the event occurred - int m_nData; // Generic 32-bit data, what it contains depends on the event + uint64 m_nData; // Generic 64-bit data, what it contains depends on the event int m_nData2; // Generic 32-bit data, what it contains depends on the event int m_nData3; // Generic 32-bit data, what it contains depends on the event };