Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CustomWidget .h
- /**
- * CustomWidget should be derived from every UUserWidget in this project
- */
- UCLASS()
- class PROJECT_API UCustomWidget : public UUserWidget
- {
- GENERATED_BODY()
- public:
- virtual void NativeTick(const FGeometry& InGeometry, float DeltaTime) override;
- FVector2D GetPositionInViewport() const;
- TSharedPtr<SWidget> GetWidget() { return MyWidget.Pin(); };
- FVector2D GetSize() { return AbsoluteSize; };
- virtual FWidgetSpace GetSpace();
- bool IsWidgetOverlapping(UCustomWidget* Widget);
- protected:
- FVector2D AbsolutePosition;
- FVector2D AbsoluteSize;
- };
- //FocusableWidget.h
- /**
- * FocusableWidget is a widget which defines its custom Focus and Unfocus Function. These functions will be called through AUISystem
- */
- UCLASS()
- class THEPASSENGER_API UFocusableWidget : public UCustomWidget
- {
- GENERATED_BODY()
- public:
- UFocusableWidget(const FObjectInitializer& ObjInitializer)
- {
- bIsFocused = false;
- bInteractable = true;
- }
- virtual void Focus() { bIsFocused = true; };
- virtual void UnFocus() { bIsFocused = false; };
- virtual void Interact() {};
- bool IsFocused() { return bIsFocused; }
- protected:
- bool bIsFocused;
- bool bInteractable;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement