Lots of work on focus management
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/HitResult.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "InputEvents.h"
|
||||
#include "InputModeRequest.h"
|
||||
#include "PlayerControllerBase.generated.h"
|
||||
|
||||
UCLASS(BlueprintType, Blueprintable)
|
||||
@@ -41,6 +41,20 @@ public:
|
||||
// eventually reconcile focus, pointer, and capture state.
|
||||
void UpdateInputMode();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||
|
||||
private:
|
||||
FDelegateHandle FocusChangingHandle;
|
||||
void HandleFocusChanging(
|
||||
const struct FFocusEvent &FocusEvent,
|
||||
const class FWeakWidgetPath &OldPath,
|
||||
const TSharedPtr<class SWidget> &OldFocusedWidget,
|
||||
const class FWidgetPath &NewPath,
|
||||
const TSharedPtr<class SWidget> &NewFocusedWidget);
|
||||
|
||||
public:
|
||||
|
||||
// Input stack overrides: unsorted, append-on-push.
|
||||
virtual void PushInputComponent(UInputComponent* InInputComponent) override;
|
||||
virtual bool PopInputComponent(UInputComponent* InInputComponent) override;
|
||||
@@ -55,8 +69,8 @@ public:
|
||||
// (thanks to DefaultToSelf + HideSelfPin): the widget self-binds,
|
||||
// we find its owning PlayerController, and register the request.
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Input Mode",
|
||||
meta = (DefaultToSelf = "Widget", HideSelfPin = "true"))
|
||||
static void WidgetRequestInputMode(class UUserWidget *Widget, bool ShowPointer, bool BlockInput, class UWidget *Focus);
|
||||
meta = (DefaultToSelf = "Widget", HideSelfPin = "true", EnableInputComponent = "true"))
|
||||
static void WidgetRequestInputMode(class UUserWidget *Widget, bool ShowPointer, bool BlockInput, class UWidget *Focus, bool EnableInputComponent);
|
||||
|
||||
// Get the player controller, cast to AlxPlayerControllerBase.
|
||||
static AlxPlayerControllerBase *FromContext(const UObject *Context);
|
||||
@@ -64,8 +78,22 @@ public:
|
||||
UPROPERTY()
|
||||
FHitResult CurrentLookAt;
|
||||
|
||||
// Input mode requests - see InputModeRequest.h for an explanation.
|
||||
UPROPERTY()
|
||||
FlxInputModeRequests InputModeRequests;
|
||||
|
||||
// The last input mode request whose focus request was granted.
|
||||
UPROPERTY()
|
||||
int32 LastRequestGrantedFocus = 0;
|
||||
|
||||
// The viewport client uses this to notify us that the user
|
||||
// clicked on a focusable widget.
|
||||
void ClickToFocus(TSharedRef<SWidget> Widget);
|
||||
|
||||
private:
|
||||
TWeakPtr<SWidget> ClickToFocusTarget;
|
||||
|
||||
public:
|
||||
|
||||
bool MustCallLookAtChanged = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user