UnrealImGui/Source/ImGui/Private/ImGuiModuleCommands.cpp
Sebastian 09572a8ef9 Refactorization of ImGui settings:
- Divided ImGui settings into UImGuiSettings persistent object and FImGuiModuleSettings proxy that provides interface for other classes and handles delayed loading of UImGuiSettings.
- Removed from FImGuiModuleProperties and FImGuiModuleCommands direct dependencies on UImGuiSettings.
- Simplified FImGuiModuleProperties making it more robust when moving data after hot-reloading.
- Inverted binding logic by injecting FImGuiModuleProperties and FImGuiModuleCommands into FImGuiModuleSettings and letting it take care of synchronization. Dependencies are setup by module manager.
- Added to module manager FImGuiModuleSettings and interface to access it.
- Cleaned interface of FImGuiInputHandlerFactory and removed direct dependency on settings.
2018-12-08 21:03:18 +00:00

74 lines
2.7 KiB
C++

// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
#include "ImGuiPrivatePCH.h"
#include "ImGuiModuleCommands.h"
#include "Utilities/DebugExecBindings.h"
const TCHAR* const FImGuiModuleCommands::ToggleInput = TEXT("ImGui.ToggleInput");
const TCHAR* const FImGuiModuleCommands::ToggleKeyboardNavigation = TEXT("ImGui.ToggleKeyboardNavigation");
const TCHAR* const FImGuiModuleCommands::ToggleGamepadNavigation = TEXT("ImGui.ToggleGamepadNavigation");
const TCHAR* const FImGuiModuleCommands::ToggleKeyboardInputSharing = TEXT("ImGui.ToggleKeyboardInputSharing");
const TCHAR* const FImGuiModuleCommands::ToggleGamepadInputSharing = TEXT("ImGui.ToggleGamepadInputSharing");
const TCHAR* const FImGuiModuleCommands::ToggleDemo = TEXT("ImGui.ToggleDemo");
FImGuiModuleCommands::FImGuiModuleCommands(FImGuiModuleProperties& InProperties)
: Properties(InProperties)
, ToggleInputCommand(ToggleInput,
TEXT("Toggle ImGui input mode."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleInputImpl))
, ToggleKeyboardNavigationCommand(ToggleKeyboardNavigation,
TEXT("Toggle ImGui keyboard navigation."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleKeyboardNavigationImpl))
, ToggleGamepadNavigationCommand(ToggleGamepadNavigation,
TEXT("Toggle ImGui gamepad navigation."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleGamepadNavigationImpl))
, ToggleKeyboardInputSharingCommand(ToggleKeyboardInputSharing,
TEXT("Toggle ImGui keyboard input sharing."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleKeyboardInputSharingImpl))
, ToggleGamepadInputSharingCommand(ToggleGamepadInputSharing,
TEXT("Toggle ImGui gamepad input sharing."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleGamepadInputSharingImpl))
, ToggleDemoCommand(ToggleDemo,
TEXT("Toggle ImGui demo."),
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleDemoImpl))
{
}
void FImGuiModuleCommands::SetKeyBinding(const TCHAR* CommandName, const FImGuiKeyInfo& KeyInfo)
{
DebugExecBindings::UpdatePlayerInputs(KeyInfo, CommandName);
}
void FImGuiModuleCommands::ToggleInputImpl()
{
Properties.ToggleInput();
}
void FImGuiModuleCommands::ToggleKeyboardNavigationImpl()
{
Properties.ToggleKeyboardNavigation();
}
void FImGuiModuleCommands::ToggleGamepadNavigationImpl()
{
Properties.ToggleGamepadNavigation();
}
void FImGuiModuleCommands::ToggleKeyboardInputSharingImpl()
{
Properties.ToggleKeyboardInputSharing();
}
void FImGuiModuleCommands::ToggleGamepadInputSharingImpl()
{
Properties.ToggleGamepadInputSharing();
}
void FImGuiModuleCommands::ToggleDemoImpl()
{
Properties.ToggleDemo();
}