Created
September 1, 2023 11:39
-
-
Save tenpn/d67bc33bc04c5165a49afa14555637b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct FWidget | |
{ | |
FWidget() : Name() {} | |
FWidget(FString Name) : Name(Name) {} | |
FWidget(FWidget Other) : Name(Other.Name) {} | |
void ProcessIntensity(float Intensity) { /** **/ } | |
FString Name; | |
} | |
void ProcessWidgets(const TArray<FWidget> WidgetsToProcess, float Intensity) | |
{ | |
for(auto Widget : WidgetsToProcess) | |
{ | |
Widget.ProcessIntensity(Intensity); | |
} | |
} | |
TArray<FWidget> CollectWidgets() | |
{ | |
TArray<FWidget> Widgets; | |
// collect | |
return Widgets; | |
} | |
// returns default Widget if can't be found | |
FWidget FindWidget(const TArray<FWidget> WidgetsToSearch, FString Name) | |
{ | |
for(const auto Widget : WidgetsToSearch) | |
{ | |
if (Widget.Name == Name) | |
{ | |
return Widget; | |
} | |
} | |
return FWidget(); | |
} | |
void Main() | |
{ | |
const TArray<FWidget> Widgets = CollectWidgets(); | |
ProcessWidgets(Widgets, 99.9f); | |
const FWidget Found = FindWidget(Widgets, TEXT("Find me")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment