A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
ControlsReminderWidget.cpp
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
4#include "Components/Image.h"
5#include "Components/TextBlock.h"
6#include "UI/UIData.h"
7#include "HeadMountedDisplayFunctionLibrary.h"
9
11{
12 Super::Init(WidgetInfo);
13 UControlsReminderWidgetInfo* WidgetData = Cast<UControlsReminderWidgetInfo>(WidgetInfo);
14 ensure(WidgetData);
15 WidgetData->SetCurrentDevice(UHeadMountedDisplayFunctionLibrary::GetHMDDeviceName());
16 UTexture2D* Texture = WidgetData->GetCurrentDeviceTexture();
17
18 SetImage(DeviceImage, Texture);
19}
20
21void UControlsReminderWidget::SetImage(UImage* Image, UTexture2D* Texture) const
22{
23 if (Texture)
24 {
25 Image->SetBrushFromTexture(Texture, true);
26 }
27}
UDataAsset class representing basic widget information.
Definition UIData.h:56
virtual void Init(UBasicWidgetInfo *WidgetInfo) override
Initializes the widget with the provided widget information.
UImage * DeviceImage
UPROPERTY(BlueprintReadWrite, Meta = (BindWidget))
void SetImage(UImage *Image, UTexture2D *Texture) const
Sets the image of the device image widget.
Widget information class for the controls reminder widget in the PixoCore module.
UTexture2D * GetCurrentDeviceTexture() const
Gets controls image of the current device.
void SetCurrentDevice(const FName &DeviceName)