mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-19 00:40:32 +00:00
5968c3ce84
- Added ImGui Input Handler class that allows to customize handling of the keyboard and gamepad input. - Added ImGui Settings to allow specify custom input handler implementation. - Added editor support for ImGui Settings. - Input handling in ImGui Widget is divided for querying the handler (more customizable) and actual input processing based on the handler’s response (fixed and simplified). - Removed a need for checking console state in different input handling functions in ImGui Widget by suppressing keyboard focus support when console is opened.
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "ImGuiInputHandler.h"
|
|
|
|
#include <Delegates/Delegate.h>
|
|
#include <UObject/Object.h>
|
|
|
|
// Select right soft class reference header to avoid warning (new header contains FSoftClassPath to FStringClassReference
|
|
// typedef, so we will use that as a common denominator).
|
|
#include <Runtime/Launch/Resources/Version.h>
|
|
#if (ENGINE_MAJOR_VERSION < 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 18))
|
|
#include <StringClassReference.h>
|
|
#else
|
|
#include <UObject/SoftObjectPath.h>
|
|
#endif
|
|
|
|
#include "ImGuiSettings.generated.h"
|
|
|
|
|
|
// Settings for ImGui module.
|
|
UCLASS(config=ImGui, defaultconfig)
|
|
class UImGuiSettings : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
UImGuiSettings();
|
|
~UImGuiSettings();
|
|
|
|
// Path to custom implementation of ImGui Input Handler.
|
|
const FStringClassReference& GetImGuiInputHandlerClass() const { return ImGuiInputHandlerClass; }
|
|
|
|
// Delegate raised when ImGuiInputHandlerClass property has changed.
|
|
FSimpleMulticastDelegate OnImGuiInputHandlerClassChanged;
|
|
|
|
protected:
|
|
|
|
// Path to own implementation of ImGui Input Handler allowing to customize handling of keyboard and gamepad input.
|
|
// If not set then default handler is used.
|
|
UPROPERTY(EditAnywhere, config, Category = "Input", meta = (MetaClass = "ImGuiInputHandler"))
|
|
FStringClassReference ImGuiInputHandlerClass;
|
|
|
|
private:
|
|
|
|
#if WITH_EDITOR
|
|
|
|
void RegisterPropertyChangedDelegate();
|
|
void UnregisterPropertyChangedDelegate();
|
|
|
|
void OnPropertyChanged(class UObject* ObjectBeingModified, struct FPropertyChangedEvent& PropertyChangedEvent);
|
|
|
|
#endif // WITH_EDITOR
|
|
};
|