UnrealFightingFramework/Source/UnrealFightingFramework/Input/FFPlayerController.cpp

52 lines
1.1 KiB
C++

// Unreal Fighting Framework by Kevin Poretti
#include "FFPlayerController.h"
// FF includes
#include "FFInputBufferComponent.h"
// UE includes
#include "EnhancedInputSubsystems.h"
AFFPlayerController::AFFPlayerController()
{
InputBuffer = CreateDefaultSubobject<UFFInputBufferComponent>(TEXT("InputBuffer"));
}
void AFFPlayerController::SendInputsToRemote() const
{
}
void AFFPlayerController::ModifyRawInput()
{
ModifiedInput = RawInput;
}
void AFFPlayerController::FixedTick(float OneFrame)
{
//UnacknowledgedInputs.Push(RawInput);
InputBuffer->AddInput(ModifiedInput);
//SendInputsToRemote();
}
void AFFPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player))
{
if (UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
{
if (!DefaultInputMapping.IsNull())
{
InputSystem->AddMappingContext(DefaultInputMapping.LoadSynchronous(), 0);
}
}
}
}