Finish implementing IsKeyUsedByPlayerController

This commit is contained in:
2025-05-27 16:30:49 -04:00
parent 40da211985
commit 23194ac0e5
9 changed files with 140 additions and 168 deletions

View File

@@ -4,7 +4,8 @@
#include "CoreMinimal.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Input/Events.h"
#include "CommonTypes.h"
#include "UtilityLibrary.generated.h"
class UEnhancedInputLocalPlayerSubsystem;
@@ -132,13 +133,21 @@ public:
UFUNCTION(BlueprintPure, Category="Widget")
static void GetPositionOfGridPanelMiddleCell(UGridPanel *GridPanel, FVector2D &UpperLeftXY, FVector2D &LowerRightXY);
// Create a mapping context that maps all keyboard keys to a single input action.
// Check if a given key is used by the mapping context.
//
// This mapping context is usually meant to be used in conjunction with a
// hand-crafted mapping context, to act as a catch-all that catches all
// keys that aren't mapped in the hand-crafted mapping.
//
UFUNCTION(BlueprintCallable, Category="Input", meta=(WorldContext="WorldContextObject"))
static void MapAllKeyboardKeysToOneInputAction(UInputMappingContext *IMC, UInputAction *Action);
UFUNCTION(BlueprintCallable, Category = "Input", meta = (ExpandEnumAsExecs="ReturnValue"))
static ElxUsedOrNotUsed IsKeyUsedByMappingContext(const FKeyEvent &KeyEvent, const UInputMappingContext *MappingContext);
// Check if a given key is used by the player controller.
//
// If you pass in a null pointer for the player controller, then this
// function will use the first player controller by default.
//
// If 'Include Escape and FKeys' is checked, then the escape key
// and the function keys are also considered to be 'used' by the
// player controller. It is generally a good idea to treat these
// keys as reserved for play-in-editor.
//
UFUNCTION(BlueprintCallable, Category = "Input", meta = (WorldContext="Context", ExpandEnumAsExecs="ReturnValue", IncludeEscapeAndFkeys="true"))
static ElxUsedOrNotUsed IsKeyUsedByPlayerController(const FKeyEvent &KeyEvent, bool IncludeEscapeAndFkeys, const APlayerController *PlayerController, const UObject *Context);
};