Touch Interface Designer 2025.2
Create touch interface with a visual editor and manage all mobile inputs like gestures
Loading...
Searching...
No Matches
SDesignHelper.h
Go to the documentation of this file.
1// Copyright Lost in Game Studio. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Widgets/SLeafWidget.h"
8
10
12class TOUCHINTERFACE_API SDesignHelper : public SLeafWidget
13{
14public:
16 _StartOpacity(1.0f),
17 _DrawInteractionZone(false)
18 {}
19
20 SLATE_ARGUMENT(UVirtualControlSetup*, Setup)
21 SLATE_ARGUMENT(float, StartOpacity)
22 SLATE_ARGUMENT(bool, DrawInteractionZone)
23 SLATE_ARGUMENT(FIntPoint, ScreenSize)
24 SLATE_ARGUMENT(float, DPIScale)
25
26 SLATE_END_ARGS()
27
28
29 void Construct(const FArguments& InArgs);
30
31 //Begin SWidget
32 virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override;
33 virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
34 //End SWidget
35
36private:
37 virtual void PaintButton(const FVirtualControl& VirtualControl, const FGeometry& AllottedGeometry, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle) const;
38 virtual void PaintJoystick(const FVirtualControl& VirtualControl, const FGeometry& AllottedGeometry, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle) const;
39 virtual void PaintTouchRegion(const FVirtualControl& VirtualControl, const FGeometry& AllottedGeometry, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle) const;
40
41 void DrawLayer(const FVisualLayer& InLayer, const FVector2D InSize, const FVector2D InBrushSize, const FVector2D InOffset, const FGeometry& AllottedGeometry, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle) const;
42
43public:
44 void SetSetupAsset(const UVirtualControlSetup* NewSetup);
45 void SetScreenSize(const FIntPoint InScreenSize);
46 void SetOpacity(const float InOpacity);
47 void SetDpiScale(const float InDPIScale) { DPIScale = InDPIScale; }
48 void SetDrawInteractionZone(const bool bEnable) { bDrawInteractionZone = bEnable; }
49
50private:
51 float GetScaleFactor(const FGeometry& AllottedGeometry) const;
52
53 const UVirtualControlSetup* SetupPreviewed;
54
55 FIntPoint ScreenSize;
56
57 float DPIScale;
58
59 float Opacity;
60
61 uint8 bDrawInteractionZone:1;
62};
Definition SDesignHelper.h:13
void SetDrawInteractionZone(const bool bEnable)
Definition SDesignHelper.h:48
void SetDpiScale(const float InDPIScale)
Definition SDesignHelper.h:47
SLATE_BEGIN_ARGS(SDesignHelper)
Definition SDesignHelper.h:15
Definition VirtualControlSetup.h:465
Definition VirtualControlSetup.h:165
Definition VirtualControlSetup.h:62