49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#pragma once
|
|
|
|
#include "GUI/Menu/MenuItemBase.h"
|
|
#include "MenuButton.generated.h"
|
|
|
|
extern FLinearColor uiIdleColor;
|
|
extern FLinearColor uiSelectedColor;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class UNREALPROJECT_API UMenuButton : public UMenuItemBase
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UMenuButton(const FObjectInitializer& init);
|
|
void NativeConstruct() override;
|
|
void FocusTick(float DeltaTime) override;
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FButtonPressed);
|
|
UPROPERTY(BlueprintAssignable, Category = "MenuButton")
|
|
FButtonPressed onPressed;
|
|
|
|
virtual void NativeOnMenuAction(EMenuActionBinding binding) override;
|
|
virtual void NativeOnSelectionChanged(bool selected, bool controller) override;
|
|
|
|
// Called when this button is pressed, and if it was a controller or a mouse
|
|
virtual void NativeOnPressed(bool controllerInput);
|
|
|
|
// Updates button text + glow
|
|
UFUNCTION(BlueprintCallable, Category="MenuButton")
|
|
void SetButtonText(FString text);
|
|
|
|
void SimulatePressed() { m_OnPressed(); }
|
|
|
|
protected:
|
|
UFUNCTION()
|
|
virtual void m_OnPressed();
|
|
|
|
UOverlay* m_textOverlay;
|
|
UOverlay* m_blurOverlay;
|
|
UPROPERTY()
|
|
UTextBlock* m_label;
|
|
UButton* m_button;
|
|
};
|