mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 00:10:32 +00:00
Moved ImGui Module Properties to public directory and added to ImGui Module interface allowing access their instance.
This commit is contained in:
parent
a8ba10d074
commit
62d26f4ee5
@ -185,6 +185,16 @@ ImGuiContext** FImGuiModule::GetImGuiContextHandle()
|
||||
}
|
||||
#endif
|
||||
|
||||
FImGuiModuleProperties& FImGuiModule::GetProperties()
|
||||
{
|
||||
return ImGuiModuleManager->GetProperties();
|
||||
}
|
||||
|
||||
const FImGuiModuleProperties& FImGuiModule::GetProperties() const
|
||||
{
|
||||
return ImGuiModuleManager->GetProperties();
|
||||
}
|
||||
|
||||
bool FImGuiModule::IsInputMode() const
|
||||
{
|
||||
return ImGuiModuleManager && ImGuiModuleManager->GetProperties().IsInputEnabled();
|
||||
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ImGuiDelegates.h"
|
||||
#include "ImGuiModuleProperties.h"
|
||||
#include "ImGuiTextureHandle.h"
|
||||
|
||||
#include <ModuleManager.h>
|
||||
@ -104,6 +105,15 @@ public:
|
||||
virtual void ReleaseTexture(const FImGuiTextureHandle& Handle);
|
||||
|
||||
/**
|
||||
* Get ImGui module properties.
|
||||
*
|
||||
* @returns Reference to an instance of ImGui module properties that allows to read and/or modify module state.
|
||||
*/
|
||||
virtual FImGuiModuleProperties& GetProperties();
|
||||
virtual const FImGuiModuleProperties& GetProperties() const;
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Check whether Input Mode is enabled (tests ImGui.InputEnabled console variable).
|
||||
*
|
||||
* @returns True, if Input Mode is enabled (ImGui.InputEnabled != 0) and false otherwise.
|
||||
@ -111,6 +121,7 @@ public:
|
||||
virtual bool IsInputMode() const;
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Set Input Mode state (sets ImGui.InputEnabled console variable, so it can be used together with a console).
|
||||
*
|
||||
* @param bEnabled - Whether Input Mode should be enabled (ImGui.InputEnabled = 1) or not (ImGui.InputEnabled = 0).
|
||||
@ -118,11 +129,13 @@ public:
|
||||
virtual void SetInputMode(bool bEnabled);
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Toggle Input Mode state (changes ImGui.InputEnabled console variable).
|
||||
*/
|
||||
virtual void ToggleInputMode();
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Check whether ImGui Demo is shown (tests ImGui.ShowDemo console variable).
|
||||
*
|
||||
* @returns True, if demo is shown (ImGui.ShowDemo != 0) and false otherwise.
|
||||
@ -130,6 +143,7 @@ public:
|
||||
virtual bool IsShowingDemo() const;
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Set whether to show ImGui Demo (sets ImGui.ShowDemo console variable, so it can be used together with a console).
|
||||
*
|
||||
* @param bShow - Whether to show ImGui Demo (ImGui.ShowDemo = 1) or not (ImGui.ShowDemo = 0).
|
||||
@ -137,6 +151,7 @@ public:
|
||||
virtual void SetShowDemo(bool bShow);
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Please use GetProperties() as this function is scheduled for removal.
|
||||
* Toggle ImGui Demo (changes ImGui.ShowDemo console variable).
|
||||
*/
|
||||
virtual void ToggleShowDemo();
|
||||
@ -148,7 +163,7 @@ public:
|
||||
private:
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual void SetProperties(const class FImGuiModuleProperties& Properties);
|
||||
virtual void SetProperties(const FImGuiModuleProperties& Properties);
|
||||
virtual struct ImGuiContext** GetImGuiContextHandle();
|
||||
#endif
|
||||
};
|
||||
|
@ -2,48 +2,46 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <IConsoleManager.h>
|
||||
|
||||
|
||||
// Collects and give access to module properties.
|
||||
class FImGuiModuleProperties
|
||||
/** Properties that define state of the ImGui module. */
|
||||
class IMGUI_API FImGuiModuleProperties
|
||||
{
|
||||
public:
|
||||
|
||||
// Check whether input is enabled.
|
||||
/** Check whether input is enabled. */
|
||||
bool IsInputEnabled() const { return bInputEnabled; }
|
||||
|
||||
// Enable or disable ImGui input.
|
||||
/** Enable or disable ImGui input. */
|
||||
void SetInputEnabled(bool bEnabled) { bInputEnabled = bEnabled; }
|
||||
|
||||
// Toggle ImGui input.
|
||||
/** Toggle ImGui input. */
|
||||
void ToggleInput() { SetInputEnabled(!IsInputEnabled()); }
|
||||
|
||||
// Check whether keyboard navigation is enabled.
|
||||
/** Check whether keyboard navigation is enabled. */
|
||||
bool IsKeyboardNavigationEnabled() const { return bKeyboardNavigationEnabled; }
|
||||
|
||||
// Enable or disable keyboard navigation.
|
||||
/** Enable or disable keyboard navigation. */
|
||||
void SetKeyboardNavigationEnabled(bool bEnabled) { bKeyboardNavigationEnabled = bEnabled; }
|
||||
|
||||
// Toggle keyboard navigation.
|
||||
/** Toggle keyboard navigation. */
|
||||
void ToggleKeyboardNavigation() { SetKeyboardNavigationEnabled(!IsKeyboardNavigationEnabled()); }
|
||||
|
||||
// Check whether gamepad navigation is enabled.
|
||||
/** Check whether gamepad navigation is enabled. */
|
||||
bool IsGamepadNavigationEnabled() const { return bGamepadNavigationEnabled; }
|
||||
|
||||
// Enable or disable gamepad navigation.
|
||||
/** Enable or disable gamepad navigation. */
|
||||
void SetGamepadNavigationEnabled(bool bEnabled) { bGamepadNavigationEnabled = bEnabled; }
|
||||
|
||||
// Toggle gamepad navigation.
|
||||
/** Toggle gamepad navigation. */
|
||||
void ToggleGamepadNavigation() { SetGamepadNavigationEnabled(!IsGamepadNavigationEnabled()); }
|
||||
|
||||
// Check whether ImGui demo is visible.
|
||||
/** Check whether ImGui demo is visible. */
|
||||
bool ShowDemo() const { return bShowDemo; }
|
||||
|
||||
// Show or hide ImGui demo.
|
||||
/** Show or hide ImGui demo. */
|
||||
void SetShowDemo(bool bShow) { bShowDemo = bShow; }
|
||||
|
||||
// Toggle ImGui demo.
|
||||
/** Toggle ImGui demo. */
|
||||
void ToggleDemo() { SetShowDemo(!ShowDemo()); }
|
||||
|
||||
private:
|
Loading…
Reference in New Issue
Block a user