Files
integration/Source/Integration/PlayerControllerBase.h

72 lines
2.8 KiB
C
Raw Normal View History

#pragma once
#include "CoreMinimal.h"
#include "Engine/HitResult.h"
#include "GameFramework/PlayerController.h"
2026-04-17 23:43:28 -04:00
#include "InputEvents.h"
#include "PlayerControllerBase.generated.h"
UCLASS(BlueprintType, Blueprintable)
class INTEGRATION_API AlxPlayerControllerBase : public APlayerController
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static void SetLookAt(const UObject *Context, const FHitResult &HitResult);
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static const FHitResult &GetLookAt(const UObject *Context);
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static const AActor *GetLookAtActor(const UObject *Context);
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static FVector2D GetLookAtPixel(const UObject *Context);
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static void SetLookAtChanged(const UObject *Context);
// Blueprint events
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Look-At Detection")
void CalculateLookAt();
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Look-At Detection")
void LookAtChanged();
// Called by GameMode each tick.
void UpdateLookAt();
2026-04-17 23:43:28 -04:00
// Called by GameMode each tick. GCs dead requests and will
// eventually reconcile focus, pointer, and capture state.
void UpdateInputMode();
// Input stack overrides: unsorted, append-on-push.
virtual void PushInputComponent(UInputComponent* InInputComponent) override;
virtual bool PopInputComponent(UInputComponent* InInputComponent) override;
virtual void BuildInputStack(TArray<UInputComponent*>& InputStack) override;
2026-04-17 23:43:28 -04:00
// Read UUserWidget::InputComponent via reflection. The field is
// protected and has no public accessor; this reaches through the
// FProperty so we always see the current value without caching it.
static class UInputComponent* GetWidgetInputComponent(class UUserWidget *Widget);
// Blueprint-facing entry point. Looks like a method on UUserWidget
// (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);
// Get the player controller, cast to AlxPlayerControllerBase.
static AlxPlayerControllerBase *FromContext(const UObject *Context);
UPROPERTY()
FHitResult CurrentLookAt;
2026-04-17 23:43:28 -04:00
UPROPERTY()
FlxInputModeRequests InputModeRequests;
bool MustCallLookAtChanged = false;
};