October3d55/M/AutoSettings/Source/AutoSettingsInput/Public/UI/AxisLabel.h

41 lines
962 B
C
Raw Normal View History

2025-03-10 09:43:27 +08:00
// Copyright Sam Bonifacio. All Rights Reserved.
#pragma once
#include "Blueprint/UserWidget.h"
#include "InputLabel.h"
#include "AxisLabel.generated.h"
/**
* Label for an input axis on a particular scale
* Shows the icon for the key it is bound to if available, or falls back to text label
*/
UCLASS(abstract)
class AUTOSETTINGSINPUT_API UAxisLabel : public UInputLabel
{
GENERATED_BODY()
public:
// Name of the axis to display
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Axis Label")
FName AxisName;
// Scale of the key to display
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Axis Label")
float Scale;
// Initialize this label
void InitializeLabel();
virtual void UpdateLabel_Implementation() override;
protected:
UPROPERTY(BlueprintReadOnly, Category = "Axis Label", meta = (BindWidget))
UKeyLabel* KeyLabel;
UKeyLabel* GetKeyLabel() const { return KeyLabel;}
virtual void NativePreConstruct() override;
};