UnrealFightingFramework/Source/UnrealFightingFramework/Input/FFInputBufferComponent.h

50 lines
958 B
C++

// Unreal Fighting Framework by Kevin Poretti
#pragma once
// FF includes
#include "Utils/TCircleBuffer.h"
// UE includes
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "FFInputBufferComponent.generated.h"
/**
* Struct representing the state of a player's inputs for one frame
*/
USTRUCT()
struct FFFInputState
{
GENERATED_BODY()
FVector2D MoveAxes;
FVector2D LookAxes;
int32 Buttons;
};
USTRUCT()
struct FFFInputSequence
{
GENERATED_BODY()
};
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class UNREALFIGHTINGFRAMEWORK_API UFFInputBufferComponent : public UActorComponent
{
GENERATED_BODY()
public:
UFFInputBufferComponent();
void AddInput(const FFFInputState& InputState);
bool CheckInputSequence(const FFFInputSequence& InputSequence);
protected:
/** The underlying buffer data structure for holding past input states */
TCircleBuffer<FFFInputState, 120> InputBuffer;
};