Touch Interface Designer 2025.2
Create touch interface with a visual editor and manage all mobile inputs like gestures
Loading...
Searching...
No Matches
ComponentDecorator_Animation.h
Go to the documentation of this file.
1// Copyright 2025 Lost in Game Studio. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UObject/Object.h"
7#include "Containers/Ticker.h"
8#include "ComponentDecorator_Animation.generated.h"
9
10class SWidget;
12
13UENUM()
15{
16 //Trigger once when component is pressed
18
19 //Trigger once when component is released
21
22 //Trigger once when component is initialized
24
25 //Trigger once before destruction
26 //AtEnd,
27
28 //It does nothing. It's up to the user to call the function to start, reverse or stop the animation
30};
31
32//TODO: Dynamic not needed?
33DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTickableObject, const float, DeltaTime);
34
35//TODO: Animation modify value of property in decorator object. Then decorator object notify modification to widget
36
40UCLASS(Abstract, Blueprintable, BlueprintType, EditInlineNew, HideCategories=("Default", "Internal", "InternalUse")/*, DefaultToInstanced*/)
41class TOUCHINTERFACE_API UComponentDecorator_Animation : public UObject/*, public FTickableGameObject*/
42{
43 GENERATED_BODY()
44
45public:
46 UComponentDecorator_Animation();
47
48 virtual void Initialize(const TSharedPtr<SWidget> Widget, const TObjectPtr<UComponentDecorator> Decorator);
49
50 //virtual class UWorld* GetWorld() const override;
51
52protected:
53 virtual void BeginDestroy() override;
54
55 bool Tick_Internal(const float DeltaTime);
56
57public:
58 UFUNCTION(Category="Tick", BlueprintCallable)
59 virtual void SetTickEnabled(const bool bEnable);
60
61 UFUNCTION(Category="Tick", BlueprintCallable, BlueprintNativeEvent)
62 void PlayAnimation(const bool bFromStart);
63
64 UFUNCTION(Category="Tick", BlueprintCallable, BlueprintNativeEvent)
65 void PlayReverseAnimation(const bool bFromEnd);
66
67 UFUNCTION(Category="Tick", BlueprintCallable, BlueprintNativeEvent)
68 void StopAnimation();
69
70protected:
71 UFUNCTION(Category="Tick", BlueprintNativeEvent)
72 void Tick(const float DeltaSeconds);
73
74 //UPROPERTY(Category="Tick", BlueprintAssignable)
75 //FTickableObject OnTick;
76
77public:
78 UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
79 EAnimationTriggerMode StartTriggerMode;
80
81 //If enabled, animation is always playing from start except if StartTriggerMode is equal to OnDemand.
82 UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
83 uint8 bPlayFromStart:1;
84
85 UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
86 EAnimationTriggerMode EndTriggerMode;
87
88 //If enabled, animation is always playing reverse from end except if EndTriggerMode is equal to OnDemand.
89 UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
90 uint8 bReverseFromEnd:1;
91
92 //If enabled, stop animation instead of playing reverse
93 UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
94 uint8 bStopAnimation:1;
95
96 // If enabled, animation
97 //UPROPERTY(Category="Animation", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
98 //uint8 bPingPong:1;
99
100 //TODO: Send event for start and finish
101
102 //TODO: Blueprintable : create custom animation
103
104 //TODO: Event that modify color, image properties
105
106 //TODO: Use tick or timer?
107
108private:
109 // Define if this object tick at start or if it should be started manually
110 UPROPERTY(Category="Tick", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
111 uint8 bStartTickEnabled:1;
112
113 // 0.0 means each frame
114 UPROPERTY(Category="Tick", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
115 float TickRate;
116
117protected:
118 TSharedPtr<SWidget> DecoratorWidget;
119
120 TWeakObjectPtr<UComponentDecorator> DecoratorObject;
121
122private:
123 FTSTicker::FDelegateHandle TickerHandle;
124};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTickableObject, const float, DeltaTime)
EditInlineNew
Definition ComponentDecorator_Animation.h:40
Abstract
Definition ComponentDecorator_Animation.h:40
BlueprintType
Definition ComponentDecorator_Animation.h:40
HideCategories
Definition ComponentDecorator_Animation.h:40
EAnimationTriggerMode
Definition ComponentDecorator_Animation.h:15
@ OnDemand
Definition ComponentDecorator_Animation.h:29
@ OnPress
Definition ComponentDecorator_Animation.h:17
@ AtBegin
Definition ComponentDecorator_Animation.h:23
@ OnRelease
Definition ComponentDecorator_Animation.h:20
Blueprintable
Definition ComponentDecorator_Animation.h:40
meta
Definition GestureRecognizerComp.h:274
Definition ComponentDecorator.h:36
virtual void BeginDestroy() override
Definition ComponentDecorator.cpp:35
TSharedPtr< SWidget > DecoratorWidget
Definition ComponentDecorator.h:218
virtual void Initialize(TObjectPtr< ULayoutComponent > Component)
Definition ComponentDecorator.cpp:56
EditAnywhere
Definition ComponentDecorator.h:164
Category
Definition ComponentDecorator.h:80
BlueprintCallable
Definition ComponentDecorator.h:80
BlueprintReadOnly
Definition ComponentDecorator.h:178