2017-03-26 20:32:57 +00:00
|
|
|
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-08-28 19:29:07 +00:00
|
|
|
#include "ImGuiContextManager.h"
|
2017-03-26 20:32:57 +00:00
|
|
|
#include "SImGuiWidget.h"
|
|
|
|
#include "TextureManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
// Central manager that implements module logic. It initializes and controls remaining module components.
|
|
|
|
class FImGuiModuleManager
|
|
|
|
{
|
|
|
|
// Allow module to control life-cycle of this class.
|
|
|
|
friend class FImGuiModule;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-08-28 19:29:07 +00:00
|
|
|
// Get ImGui contexts manager.
|
|
|
|
FImGuiContextManager& GetContextManager() { return ContextManager; }
|
2017-03-26 20:32:57 +00:00
|
|
|
|
|
|
|
// Get texture resources manager.
|
|
|
|
FTextureManager& GetTextureManager() { return TextureManager; }
|
|
|
|
|
2017-04-22 15:38:04 +00:00
|
|
|
// Event called right after ImGui is updated, to give other subsystems chance to react.
|
|
|
|
FSimpleMulticastDelegate& OnPostImGuiUpdate() { return PostImGuiUpdateEvent; }
|
|
|
|
|
2017-03-26 20:32:57 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
FImGuiModuleManager();
|
|
|
|
~FImGuiModuleManager();
|
|
|
|
|
|
|
|
FImGuiModuleManager(const FImGuiModuleManager&) = delete;
|
|
|
|
FImGuiModuleManager& operator=(const FImGuiModuleManager&) = delete;
|
|
|
|
|
|
|
|
FImGuiModuleManager(FImGuiModuleManager&&) = delete;
|
|
|
|
FImGuiModuleManager& operator=(FImGuiModuleManager&&) = delete;
|
|
|
|
|
|
|
|
void LoadTextures();
|
|
|
|
|
2018-05-24 20:55:25 +00:00
|
|
|
bool IsTickRegistered() { return TickDelegateHandle.IsValid(); }
|
2017-03-26 20:32:57 +00:00
|
|
|
void RegisterTick();
|
|
|
|
void UnregisterTick();
|
|
|
|
|
2018-05-24 20:55:25 +00:00
|
|
|
void CreateTickInitializer();
|
|
|
|
void ReleaseTickInitializer();
|
|
|
|
|
2017-03-26 20:32:57 +00:00
|
|
|
bool IsInUpdateThread();
|
|
|
|
|
|
|
|
void Tick(float DeltaSeconds);
|
|
|
|
|
|
|
|
void OnViewportCreated();
|
|
|
|
|
|
|
|
void AddWidgetToViewport(UGameViewportClient* GameViewport);
|
2018-05-24 20:55:25 +00:00
|
|
|
void AddWidgetsToActiveViewports();
|
2017-03-26 20:32:57 +00:00
|
|
|
|
2017-04-22 15:38:04 +00:00
|
|
|
// Event that we call after ImGui is updated.
|
|
|
|
FSimpleMulticastDelegate PostImGuiUpdateEvent;
|
|
|
|
|
2017-08-28 19:29:07 +00:00
|
|
|
// Manager for ImGui contexts.
|
|
|
|
FImGuiContextManager ContextManager;
|
2017-03-26 20:32:57 +00:00
|
|
|
|
|
|
|
// Manager for textures resources.
|
|
|
|
FTextureManager TextureManager;
|
|
|
|
|
2017-09-27 20:16:54 +00:00
|
|
|
// Slate widgets that we created.
|
|
|
|
TArray<TWeakPtr<SImGuiWidget>> Widgets;
|
2017-03-26 20:32:57 +00:00
|
|
|
|
2018-05-24 20:55:25 +00:00
|
|
|
FDelegateHandle TickInitializerHandle;
|
2017-03-26 20:32:57 +00:00
|
|
|
FDelegateHandle TickDelegateHandle;
|
|
|
|
FDelegateHandle ViewportCreatedHandle;
|
|
|
|
|
2018-05-24 20:55:25 +00:00
|
|
|
bool bTexturesLoaded = false;
|
2017-03-26 20:32:57 +00:00
|
|
|
};
|