mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 16:30:32 +00:00
10ce6386d4
- With the mouse sharing enabled, SImGuiWidget can update mouse position without enabling hit-tests. Actual input mode depends whether mouse cursor is hovering any ImGui window or not. - Added to context proxy interface to read whether that context has mouse hovering any window. - Added boilerplate code to support mouse sharing settings, properties and commands.
83 lines
3.1 KiB
C++
83 lines
3.1 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::ToggleMouseInputSharing = TEXT("ImGui.ToggleMouseInputSharing");
|
|
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))
|
|
, ToggleMouseInputSharingCommand(ToggleMouseInputSharing,
|
|
TEXT("Toggle ImGui mouse input sharing."),
|
|
FConsoleCommandDelegate::CreateRaw(this, &FImGuiModuleCommands::ToggleMouseInputSharingImpl))
|
|
, 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::ToggleMouseInputSharingImpl()
|
|
{
|
|
Properties.ToggleMouseInputSharing();
|
|
}
|
|
|
|
void FImGuiModuleCommands::ToggleDemoImpl()
|
|
{
|
|
Properties.ToggleDemo();
|
|
}
|