Touch Interface Designer 2025.2
Create touch interface with a visual editor and manage all mobile inputs like gestures
Loading...
Searching...
No Matches
ProgressBarLayer.h
Go to the documentation of this file.
1// Copyright 2025 Lost in Game Studio. All Rights Reserved.
2
3#pragma once
4
6#include "ProgressBarLayer.generated.h"
7
9class UMaterialInterface;
10class UMaterialInstanceDynamic;
11
12UENUM(BlueprintType)
26
27//TODO: Show this fill type only for linear progress bar
28UENUM(BlueprintType)
29enum class EProgressFillStyle : uint8
30{
34
38
39 //Use material to fill geometry
41
42 //Draw lines
44};
45
46UCLASS()
47class TOUCHINTERFACE_API UProgressBarLayer : public UComponentDecorator
48{
49 GENERATED_BODY()
50
51public:
53
54 virtual void BeginDestroy() override;
55
56 virtual void Initialize(TObjectPtr<ULayoutComponent> Component) override;
57
58 virtual TSharedRef<SWidget> CreateWidgetInstance() override;
59
60#if WITH_EDITOR
61 virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
62
63 virtual void SynchronizeProperties() override;
64#endif
65
66 UFUNCTION(Category="ProgressBar", BlueprintCallable, BlueprintPure)
67 virtual float GetPercent() { return Percent; }
68
69 UFUNCTION(Category="ProgressBar", BlueprintCallable)
70 virtual void SetPercent(const float InPercent);
71
72 UFUNCTION(Category="ProgressBar", BlueprintCallable)
73 virtual float AddPercent(const float Value);
74
75 UFUNCTION(Category="ProgressBar", BlueprintCallable)
76 virtual float SubtractPercent(const float Value);
77
78 //TODO: Set type, style
79
80private:
81
82public:
83 //Percent (0 = empty to 1 = full)
84 UPROPERTY(Category="ProgressBar", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(ClampMin=0.0f, ClampMax=1.0f))
85 float Percent;
86
87 // Fill style of progress bar
88 UPROPERTY(Category="ProgressBar|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
89 EProgressFillStyle FillStyle;
90
91 // Fill type of progress bar
92 UPROPERTY(Category="ProgressBar|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="FillStyle!=EProgressFillStyle::Material", EditConditionHides))
93 EProgressFillType FillType;
94
95 // Material used for fill bar
96 UPROPERTY(Category="ProgressBar|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="FillStyle==EProgressFillStyle::Material", EditConditionHides))
97 FSoftObjectPath FillMaterial;
98
99 // Color of fill bar
100 UPROPERTY(Category="ProgressBar|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
101 FLinearColor FillColor;
102
103
104 // Start angle value in degree
105 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(ClampMin=0.0f, ClampMax=360.0f))
106 float StartAngle;
107
108 // End angle value in degree
109 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(ClampMin=0.0f, ClampMax=360.f))
110 float EndAngle;
111
112 // Rotation of circular progress
113 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
114 float AngularOffset;
115
116 // Radius of fill bar
117 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(ClampMin=0.0f, ClampMax=1.0f))
118 float Radius;
119
120 // Thickness of fill bar
121 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
122 float Thickness;
123
124 // Precision of circle
125 UPROPERTY(Category="ProgressBar|Style|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
126 int32 CircleResolution;
127
128
129 // If enabled, add background under fill bar
130 UPROPERTY(Category="ProgressBar|Style|Background", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
131 uint8 bDrawBackground:1;
132
133 // Slate brush for background bar
134 UPROPERTY(Category="ProgressBar|Style|Background", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="bDrawBackground==true", EditConditionHides))
135 FSlateBrush BackgroundBrush;
136
137 // Color of background bar
138 UPROPERTY(Category="ProgressBar|Style|Background", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="bDrawBackground==true", EditConditionHides))
139 FLinearColor BackgroundColor;
140
141 // Radius of background bar
142 UPROPERTY(Category="ProgressBar|Style|Background|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(ClampMin=0.0f, ClampMax=1.0f), meta=(EditCondition="bDrawBackground==true", EditConditionHides))
143 float BackgroundRadius;
144
145 // Thickness of background bar
146 UPROPERTY(Category="ProgressBar|Style|Background|Circular", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="bDrawBackground==true", EditConditionHides))
147 float BackgroundThickness;
148
149
150 // If enabled, use custom material instead of pre-build material
151 UPROPERTY(Category="ProgressBar|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
152 uint8 bOverrideMaterial:1;
153
154 //TODO: Material property: Smoothness, thickness, division, etc
155
156 //UPROPERTY(Category="Progress Bar Layer|Advanced", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
157 //uint8 bUseDivision:1;
158
159 //UPROPERTY(Category="Progress Bar Layer|Advanced", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"), meta=(EditCondition="bUseDivision==true", EditConditionHides))
160 //int32 Division;
161
162
163
164 // Whether or not, the anti-aliasing is used for drawing
165 UPROPERTY(Category="ProgressBar|Advanced|Optimization", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
166 uint8 bAntiAliasing:1;
167
168private:
169 UPROPERTY()
170 TObjectPtr<UMaterialInstanceDynamic> MaterialInstance;
171
172 TSharedPtr<SProgressBarLayer> ProgressBarWidget;
173
174#if WITH_EDITORONLY_DATA
175 UPROPERTY(Transient)
176 TObjectPtr<UMaterialInterface> PreviewMaterial;
177#endif
178};
BlueprintType
Definition ComponentDecorator_Animation.h:40
EProgressFillStyle
Definition ProgressBarLayer.h:30
@ Draw
Definition ProgressBarLayer.h:43
@ Masked
Definition ProgressBarLayer.h:37
@ Scale
Definition ProgressBarLayer.h:33
@ Material
Definition ProgressBarLayer.h:40
EProgressFillType
Definition ProgressBarLayer.h:14
@ CircularCenter
Definition ProgressBarLayer.h:24
@ FromCenter
Definition ProgressBarLayer.h:17
@ BottomToTop
Definition ProgressBarLayer.h:21
@ CounterClockwise
Definition ProgressBarLayer.h:23
@ FromCenterVertical
Definition ProgressBarLayer.h:19
@ RightToLeft
Definition ProgressBarLayer.h:16
@ Clockwise
Definition ProgressBarLayer.h:22
@ LeftToRight
Definition ProgressBarLayer.h:15
@ TopToBottom
Definition ProgressBarLayer.h:20
@ FromCenterHorizontal
Definition ProgressBarLayer.h:18
Definition SProgressBarLayer.h:14
UComponentDecorator()
Definition ComponentDecorator.cpp:19
virtual TSharedRef< SWidget > CreateWidgetInstance() override
Definition ProgressBarLayer.cpp:72
Category
Definition ProgressBarLayer.h:66
virtual BlueprintPure float GetPercent()
Definition ProgressBarLayer.h:67
EditAnywhere
Definition ProgressBarLayer.h:84
UProgressBarLayer()
Definition ProgressBarLayer.cpp:12
virtual void Initialize(TObjectPtr< ULayoutComponent > Component) override
Definition ProgressBarLayer.cpp:54
BlueprintCallable
Definition ProgressBarLayer.h:66
BlueprintReadOnly
Definition ProgressBarLayer.h:84
virtual void BeginDestroy() override
Definition ProgressBarLayer.cpp:44
meta
Definition ProgressBarLayer.h:84