CogImGui: Let the click pass through when imgui input is disabled.

CogSample: Add Start/Escape menu
This commit is contained in:
Arnaud Jamin
2023-11-07 01:35:57 -05:00
parent dacbaf2bea
commit 294cb56610
11 changed files with 18 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,6 +30,11 @@ void SCogImguiWidget::Construct(const FArguments& InArgs)
FontAtlas = InArgs._FontAtlas;
Render = InArgs._Render;
if (FCogImguiModule::Get().GetEnableInput() == false)
{
SetVisibility(EVisibility::SelfHitTestInvisible);
}
ImGuiContext = ImGui::CreateContext(FontAtlas);
ImPlotContext = ImPlot::CreateContext();
ImPlot::SetImGuiContext(ImGuiContext);
@@ -163,6 +168,8 @@ void SCogImguiWidget::TickFocus()
//--------------------------------------------------------------------------------------------------------------------------
void SCogImguiWidget::TakeFocus()
{
SetVisibility(EVisibility::Visible);
FSlateApplication& SlateApplication = FSlateApplication::Get();
PreviousUserFocusedWidget = SlateApplication.GetUserFocusedWidget(SlateApplication.GetUserIndexForKeyboard());
@@ -182,6 +189,8 @@ void SCogImguiWidget::TakeFocus()
//--------------------------------------------------------------------------------------------------------------------------
void SCogImguiWidget::ReturnFocus()
{
SetVisibility(EVisibility::SelfHitTestInvisible);
if (HasKeyboardFocus())
{
auto FocusWidgetPtr = PreviousUserFocusedWidget.IsValid()
@@ -459,6 +468,11 @@ FReply SCogImguiWidget::OnMouseMove(const FGeometry& MyGeometry, const FPointerE
//--------------------------------------------------------------------------------------------------------------------------
FReply SCogImguiWidget::OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& FocusEvent)
{
if (FCogImguiModule::Get().GetEnableInput() == false)
{
return FReply::Unhandled();
}
Super::OnFocusReceived(MyGeometry, FocusEvent);
FSlateApplication::Get().ResetToDefaultPointerInputSettings();
+4 -1
View File
@@ -108,7 +108,10 @@ void ACogSampleGameState::Tick(float DeltaSeconds)
//const float ServerWorldTimeDelta = LocalWorldTime - ServerWorldTime;
//FCogDebugPlot::PlotValue(this, "Server World Time Delta", ServerWorldTimeDelta);
CogWindowManager->Tick(DeltaSeconds);
if (CogWindowManager != nullptr)
{
CogWindowManager->Tick(DeltaSeconds);
}
#endif //ENABLE_COG
}