mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 16:30:32 +00:00
Added functionality allowing to apply changes in canvas size settings while playing.
This commit is contained in:
parent
26f8729604
commit
253eff0525
@ -166,6 +166,7 @@ void FImGuiModuleSettings::SetCanvasSizeInfo(const FImGuiCanvasSizeInfo& CanvasS
|
|||||||
if (CanvasSize != CanvasSizeInfo)
|
if (CanvasSize != CanvasSizeInfo)
|
||||||
{
|
{
|
||||||
CanvasSize = CanvasSizeInfo;
|
CanvasSize = CanvasSizeInfo;
|
||||||
|
OnCanvasSizeInfoChangeDelegate.Broadcast(CanvasSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ public:
|
|||||||
// Generic delegate used to notify changes of boolean properties.
|
// Generic delegate used to notify changes of boolean properties.
|
||||||
DECLARE_MULTICAST_DELEGATE_OneParam(FBoolChangeDelegate, bool);
|
DECLARE_MULTICAST_DELEGATE_OneParam(FBoolChangeDelegate, bool);
|
||||||
DECLARE_MULTICAST_DELEGATE_OneParam(FStringClassReferenceChangeDelegate, const FStringClassReference&);
|
DECLARE_MULTICAST_DELEGATE_OneParam(FStringClassReferenceChangeDelegate, const FStringClassReference&);
|
||||||
|
DECLARE_MULTICAST_DELEGATE_OneParam(FImGuiCanvasSizeInfoChangeDelegate, const FImGuiCanvasSizeInfo&);
|
||||||
|
|
||||||
// Constructor for ImGui module settings. It will bind to instances of module properties and commands and will
|
// Constructor for ImGui module settings. It will bind to instances of module properties and commands and will
|
||||||
// update them every time when settings are changed.
|
// update them every time when settings are changed.
|
||||||
@ -202,6 +203,9 @@ public:
|
|||||||
// Delegate raised when software cursor configuration is changed.
|
// Delegate raised when software cursor configuration is changed.
|
||||||
FBoolChangeDelegate OnUseSoftwareCursorChanged;
|
FBoolChangeDelegate OnUseSoftwareCursorChanged;
|
||||||
|
|
||||||
|
// Delegate raised when information how to calculate the canvas size is changed.
|
||||||
|
FImGuiCanvasSizeInfoChangeDelegate OnCanvasSizeInfoChangeDelegate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void UpdateSettings();
|
void UpdateSettings();
|
||||||
|
@ -283,6 +283,10 @@ void SImGuiWidget::RegisterImGuiSettingsDelegates()
|
|||||||
{
|
{
|
||||||
Settings.OnUseSoftwareCursorChanged.AddRaw(this, &SImGuiWidget::SetHideMouseCursor);
|
Settings.OnUseSoftwareCursorChanged.AddRaw(this, &SImGuiWidget::SetHideMouseCursor);
|
||||||
}
|
}
|
||||||
|
if (!Settings.OnCanvasSizeInfoChangeDelegate.IsBoundToObject(this))
|
||||||
|
{
|
||||||
|
Settings.OnCanvasSizeInfoChangeDelegate.AddRaw(this, &SImGuiWidget::SetCanvasSizeInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SImGuiWidget::UnregisterImGuiSettingsDelegates()
|
void SImGuiWidget::UnregisterImGuiSettingsDelegates()
|
||||||
@ -291,6 +295,7 @@ void SImGuiWidget::UnregisterImGuiSettingsDelegates()
|
|||||||
|
|
||||||
Settings.OnImGuiInputHandlerClassChanged.RemoveAll(this);
|
Settings.OnImGuiInputHandlerClassChanged.RemoveAll(this);
|
||||||
Settings.OnUseSoftwareCursorChanged.RemoveAll(this);
|
Settings.OnUseSoftwareCursorChanged.RemoveAll(this);
|
||||||
|
Settings.OnCanvasSizeInfoChangeDelegate.RemoveAll(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SImGuiWidget::SetHideMouseCursor(bool bHide)
|
void SImGuiWidget::SetHideMouseCursor(bool bHide)
|
||||||
|
Loading…
Reference in New Issue
Block a user