Plasma Engine  2.0
Loading...
Searching...
No Matches
EventMessageHandlerComponent.h
1#pragma once
2
3#include <Core/Messages/EventMessage.h>
4#include <Core/World/World.h>
5
6struct plEventMessage;
7
14{
15 PL_DECLARE_ABSTRACT_COMPONENT_TYPE(plEventMessageHandlerComponent, plComponent);
16
18 // plComponent
19
20public:
21 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
22 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
23
24protected:
25 virtual void Deinitialize() override;
26
27
29 // plEventMessageHandlerComponent
30
31public:
35
37 void SetDebugOutput(bool bEnable);
38
40 bool GetDebugOutput() const;
41
43 void SetGlobalEventHandlerMode(bool bEnable); // [ property ]
44
46 bool GetGlobalEventHandlerMode() const { return m_bIsGlobalEventHandler; } // [ property ]
47
49 void SetPassThroughUnhandledEvents(bool bPassThrough); // [ property ]
50 bool GetPassThroughUnhandledEvents() const { return m_bPassThroughUnhandledEvents; } // [ property ]
51
53 static plArrayPtr<plComponentHandle> GetAllGlobalEventHandler(const plWorld* pWorld);
54
55 static void ClearGlobalEventHandlersForWorld(const plWorld* pWorld);
56
57private:
58 bool m_bDebugOutput = false;
59 bool m_bIsGlobalEventHandler = false;
60 bool m_bPassThroughUnhandledEvents = false;
61};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Base class of all component types.
Definition Component.h:25
virtual void SerializeComponent(plWorldWriter &inout_stream) const
Override this to save the current state of the component to the given stream.
Definition Component.cpp:54
virtual void Deinitialize()
This method is called before the component is destroyed. A derived type can override this method to d...
Definition Component.cpp:133
virtual void DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
Base class for components that want to handle 'event messages'.
Definition EventMessageHandlerComponent.h:14
bool GetGlobalEventHandlerMode() const
Returns whether this component is registered as a global event handler.
Definition EventMessageHandlerComponent.h:46
plEventMessageHandlerComponent()
Keep the constructor private or protected in derived classes, so it cannot be called manually.
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
Base class for all messages that are sent as 'events'.
Definition EventMessage.h:8