mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 16:30:32 +00:00
77bb73dbce
- Added ImGui Context Manager to create and manage ImGui Context Proxies. - Changed ImGui Context Proxy to dynamically create context and allow pairing with input state. - Changed ImGui Module Manager to create one widget per context. - Changed ImGui Widget to work in different input modes. - Changed ImGui Input State to allow partial reset (only mouse or keyboard).
72 lines
1.8 KiB
C++
72 lines
1.8 KiB
C++
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
|
|
|
#pragma once
|
|
|
|
#include "ImGuiContextManager.h"
|
|
#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:
|
|
|
|
// Get ImGui contexts manager.
|
|
FImGuiContextManager& GetContextManager() { return ContextManager; }
|
|
|
|
// Get texture resources manager.
|
|
FTextureManager& GetTextureManager() { return TextureManager; }
|
|
|
|
// Event called right after ImGui is updated, to give other subsystems chance to react.
|
|
FSimpleMulticastDelegate& OnPostImGuiUpdate() { return PostImGuiUpdateEvent; }
|
|
|
|
private:
|
|
|
|
FImGuiModuleManager();
|
|
~FImGuiModuleManager();
|
|
|
|
FImGuiModuleManager(const FImGuiModuleManager&) = delete;
|
|
FImGuiModuleManager& operator=(const FImGuiModuleManager&) = delete;
|
|
|
|
FImGuiModuleManager(FImGuiModuleManager&&) = delete;
|
|
FImGuiModuleManager& operator=(FImGuiModuleManager&&) = delete;
|
|
|
|
void Initialize();
|
|
void Uninitialize();
|
|
|
|
void LoadTextures();
|
|
|
|
void RegisterTick();
|
|
void UnregisterTick();
|
|
|
|
bool IsInUpdateThread();
|
|
|
|
void Tick(float DeltaSeconds);
|
|
|
|
void OnViewportCreated();
|
|
|
|
void AddWidgetToViewport(UGameViewportClient* GameViewport);
|
|
void AddWidgetToAllViewports();
|
|
|
|
// Event that we call after ImGui is updated.
|
|
FSimpleMulticastDelegate PostImGuiUpdateEvent;
|
|
|
|
// Manager for ImGui contexts.
|
|
FImGuiContextManager ContextManager;
|
|
|
|
// Manager for textures resources.
|
|
FTextureManager TextureManager;
|
|
|
|
// Slate widgets that we attach to game viewports.
|
|
TMap<int32, TSharedPtr<SImGuiWidget>> ViewportWidgets;
|
|
|
|
FDelegateHandle TickDelegateHandle;
|
|
FDelegateHandle ViewportCreatedHandle;
|
|
|
|
bool bInitialized = false;
|
|
};
|