Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "TestProject1_precompiled.h"
- #include <AzCore/Memory/SystemAllocator.h>
- #include <AzCore/Module/Module.h>
- #include <platform_impl.h>
- #include <IGem.h>
- #include <ISystem.h>
- #include <ILevelSystem.h>
- #include <CrySystemBus.h>
- #include <TestProject1SystemComponent.h>
- namespace TestProject1
- {
- class TestProject1Module
- : public AZ::Module
- , protected CrySystemEventBus::Handler
- , protected ISystemEventListener
- {
- public:
- AZ_RTTI(TestProject1Module, "{A41622CC-D3C7-40F8-9C42-52962315FEAE}", AZ::Module);
- AZ_CLASS_ALLOCATOR(TestProject1Module, AZ::SystemAllocator, 0);
- TestProject1Module()
- : AZ::Module()
- {
- CrySystemEventBus::Handler::BusConnect();
- // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
- m_descriptors.insert(m_descriptors.end(), {
- TestProject1SystemComponent::CreateDescriptor(),
- });
- }
- ~TestProject1Module()
- {
- CrySystemEventBus::Handler::BusDisconnect();
- if (gEnv && gEnv->pSystem && gEnv->pSystem->GetISystemEventDispatcher())
- {
- gEnv->pSystem->GetISystemEventDispatcher()->RemoveListener(this);
- }
- }
- /**
- * Add required SystemComponents to the SystemEntity.
- */
- AZ::ComponentTypeList GetRequiredSystemComponents() const override
- {
- return AZ::ComponentTypeList{
- azrtti_typeid<TestProject1SystemComponent>(),
- };
- }
- void OnSystemEvent(ESystemEvent systemEvent, UINT_PTR wparam, UINT_PTR lparam)
- {
- switch (systemEvent)
- {
- case ESYSTEM_EVENT_GAME_POST_INIT_DONE:
- {
- }
- break;
- default:
- break;
- }
- }
- protected:
- void OnCrySystemPreInitialize(ISystem& system, const SSystemInitParams& systemInitParams) override
- {
- (void)systemInitParams;
- gEnv = system.GetGlobalEnvironment();
- }
- void OnCrySystemInitialized(ISystem& system, const SSystemInitParams& systemInitParams) override
- {
- (void)systemInitParams;
- system.GetISystemEventDispatcher()->RegisterListener(this);
- }
- void OnCrySystemPostShutdown() override
- {
- gEnv = nullptr;
- }
- };
- }
- // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
- // The first parameter should be GemName_GemIdLower
- // The second should be the fully qualified name of the class above
- AZ_DECLARE_MODULE_CLASS(TestProject1_67efe5a8ba3c4a4f8b5e55d86efb9cb7, TestProject1::TestProject1Module)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement