mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-06 07:38:46 +00:00
CogEngine: Improve various windows widgets usability
- Implement ImGui Copy Paste, and OpenInShell backend. - Fix ColorEdit4 - Fix Hand and NotAllowed cursors - Make the reset of windows configuration automatic (but optional) when getting a config. - Console Window: Improve usability - Stat Window: Add configuration of of MaxFPS, Pings, and PacketLoss. Improve widget usability. - Time Scale Window: Add configuration of time scale. Improve widget usability. - Output Log Window: Fix the Copy. - Selection Window: The Pick button now uses an icon
This commit is contained in:
@@ -12,7 +12,6 @@ public:
|
|||||||
|
|
||||||
UCogCommonConfig()
|
UCogCommonConfig()
|
||||||
{
|
{
|
||||||
Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Reset()
|
virtual void Reset()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class CogEngine : ModuleRules
|
|||||||
PrivateDependencyModuleNames.AddRange(
|
PrivateDependencyModuleNames.AddRange(
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
|
"ApplicationCore",
|
||||||
"CogCommon",
|
"CogCommon",
|
||||||
"CogImgui",
|
"CogImgui",
|
||||||
"CogWindow",
|
"CogWindow",
|
||||||
|
|||||||
@@ -90,14 +90,6 @@ void FCogEngineWindow_Cheats::UpdateCheatColor(const FCogEngineCheat& Cheat) con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_Cheats::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Cheats::GameTick(float DeltaTime)
|
void FCogEngineWindow_Cheats::GameTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,14 +25,6 @@ void FCogEngineWindow_CollisionTester::RenderHelp()
|
|||||||
ImGui::Text("This window is used to test a collision query.");
|
ImGui::Text("This window is used to test a collision query.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_CollisionTester::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_CollisionTester::RenderContent()
|
void FCogEngineWindow_CollisionTester::RenderContent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,14 +32,6 @@ void FCogEngineWindow_CollisionViewer::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_CollisionViewer::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_CollisionViewer::RenderContent()
|
void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
#include "CogWindowManager.h"
|
#include "CogWindowManager.h"
|
||||||
#include "CogWindowWidgets.h"
|
#include "CogWindowWidgets.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui.h"
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -28,6 +32,12 @@ void FCogEngineWindow_Console::Initialize()
|
|||||||
RefreshCommandList();
|
RefreshCommandList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Console::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||||
|
{
|
||||||
|
WindowFlags |= ImGuiWindowFlags_NoScrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Console::RenderContent()
|
void FCogEngineWindow_Console::RenderContent()
|
||||||
{
|
{
|
||||||
@@ -57,39 +67,16 @@ void FCogEngineWindow_Console::RenderContent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Console::RenderMainMenuWidget()
|
void FCogEngineWindow_Console::RenderTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
bIsRenderingWidget = true;
|
if (WidgetMode_OpenCommandList)
|
||||||
|
|
||||||
const ImGuiContext& g = *GImGui;
|
|
||||||
const ImGuiStyle& Style = g.Style;
|
|
||||||
const ImGuiWindow* Window = ImGui::GetCurrentWindow();
|
|
||||||
ImVec2 TooltipPos = Window->DC.CursorPos;
|
|
||||||
TooltipPos.y += Window->MenuBarHeight;
|
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(Config->WidgetWidth);
|
|
||||||
|
|
||||||
RenderInput();
|
|
||||||
const bool IsTextInputActive = ImGui::IsItemActive();
|
|
||||||
|
|
||||||
if (Config->FocusWidgetWhenAppearing && ImGui::IsWindowAppearing())
|
|
||||||
{
|
|
||||||
SelectedCommandIndex = -1;
|
|
||||||
RefreshCommandList();
|
|
||||||
ImGui::ActivateItemByID(InputIdOnWidgetMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextItem())
|
|
||||||
{
|
|
||||||
RenderMenu();
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bPopupCommandListOnWidgetMode)
|
|
||||||
{
|
{
|
||||||
|
bIsWidgetMode = true;
|
||||||
|
|
||||||
|
const ImGuiContext& g = *GImGui;
|
||||||
ImGui::SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.90f);
|
ImGui::SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.90f);
|
||||||
ImGui::SetNextWindowSize(ImVec2(Config->WidgetWidth, ImGui::GetFontSize() * 30), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(Config->WidgetWidth, ImGui::GetFontSize() * 30), ImGuiCond_FirstUseEver);
|
||||||
ImGui::SetNextWindowPos(TooltipPos, ImGuiCond_Always);
|
ImGui::SetNextWindowPos(WidgetMode_CommandListPosition, ImGuiCond_Always);
|
||||||
|
|
||||||
ImGuiWindowFlags flags =
|
ImGuiWindowFlags flags =
|
||||||
ImGuiWindowFlags_NoTitleBar
|
ImGuiWindowFlags_NoTitleBar
|
||||||
@@ -97,28 +84,83 @@ void FCogEngineWindow_Console::RenderMainMenuWidget()
|
|||||||
| ImGuiWindowFlags_NoFocusOnAppearing; // We want the console input text to keep the focus.
|
| ImGuiWindowFlags_NoFocusOnAppearing; // We want the console input text to keep the focus.
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||||
if (ImGui::Begin("ConsoleTooltip", nullptr, flags))
|
const bool IsCommandListWindowVisible = ImGui::Begin("ConsoleCommandList", nullptr, flags);
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
|
if (IsCommandListWindowVisible)
|
||||||
{
|
{
|
||||||
|
ImGui::Spacing();
|
||||||
RenderCommandList();
|
RenderCommandList();
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow("ConsoleCommandListPopup"))
|
||||||
{
|
{
|
||||||
RenderMenu();
|
RenderMenu();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool IsWindowFocused = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows);
|
const bool IsWindowFocused = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows);
|
||||||
|
if (IsWindowFocused)
|
||||||
if (IsTextInputActive == false && IsWindowFocused == false && bRequestInputFocus == false)
|
|
||||||
{
|
{
|
||||||
bPopupCommandListOnWidgetMode = false;
|
if (ImGui::IsKeyPressed(ImGuiKey_DownArrow))
|
||||||
|
{
|
||||||
|
SelectNextCommand();
|
||||||
|
ActivateInputText();
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed(ImGuiKey_UpArrow))
|
||||||
|
{
|
||||||
|
SelectPreviousCommand();
|
||||||
|
ActivateInputText();
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed(ImGuiKey_Tab))
|
||||||
|
{
|
||||||
|
SelectNextCommand();
|
||||||
|
ActivateInputText();
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed(ImGuiKey_Escape))
|
||||||
|
{
|
||||||
|
WidgetMode_OpenCommandList = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsWindowFocused == false && WidgetMode_IsTextInputActive == false)
|
||||||
|
{
|
||||||
|
WidgetMode_OpenCommandList = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::PopStyleVar();
|
|
||||||
|
bIsWidgetMode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Console::RenderMainMenuWidget()
|
||||||
|
{
|
||||||
|
bIsWidgetMode = true;
|
||||||
|
|
||||||
|
const ImGuiWindow* Window = ImGui::GetCurrentWindow();
|
||||||
|
WidgetMode_CommandListPosition = Window->DC.CursorPos;
|
||||||
|
WidgetMode_CommandListPosition.y += Window->MenuBarHeight;
|
||||||
|
|
||||||
|
ImGui::SetNextItemWidth(Config->WidgetWidth);
|
||||||
|
|
||||||
|
RenderInput();
|
||||||
|
WidgetMode_IsTextInputActive = ImGui::IsItemActive();
|
||||||
|
|
||||||
|
if (Config->FocusWidgetWhenAppearing && ImGui::IsWindowAppearing())
|
||||||
|
{
|
||||||
|
SelectedCommandIndex = -1;
|
||||||
|
RefreshCommandList();
|
||||||
|
ActivateInputText();
|
||||||
}
|
}
|
||||||
|
|
||||||
bIsRenderingWidget = false;
|
if (ImGui::BeginPopupContextItem())
|
||||||
|
{
|
||||||
|
RenderMenu();
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
bIsWidgetMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -127,6 +169,8 @@ void FCogEngineWindow_Console::RenderMenu()
|
|||||||
if (ImGui::BeginMenu("Options"))
|
if (ImGui::BeginMenu("Options"))
|
||||||
{
|
{
|
||||||
FCogWindowWidgets::ThinSeparatorText("General");
|
FCogWindowWidgets::ThinSeparatorText("General");
|
||||||
|
|
||||||
|
ImGui::Checkbox("Show Help", &Config->ShowHelp);
|
||||||
|
|
||||||
if (ImGui::Checkbox("Sort Commands", &Config->SortCommands))
|
if (ImGui::Checkbox("Sort Commands", &Config->SortCommands))
|
||||||
{
|
{
|
||||||
@@ -172,7 +216,7 @@ void FCogEngineWindow_Console::RenderMenu()
|
|||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bIsRenderingWidget == false && Config->DockInputInMenuBar)
|
if (bIsWidgetMode == false && Config->DockInputInMenuBar)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(-1);
|
ImGui::SetNextItemWidth(-1);
|
||||||
RenderInput();
|
RenderInput();
|
||||||
@@ -192,17 +236,15 @@ void FCogEngineWindow_Console::RenderInput()
|
|||||||
| ImGuiInputTextFlags_CallbackEdit
|
| ImGuiInputTextFlags_CallbackEdit
|
||||||
| ImGuiInputTextFlags_CallbackAlways;
|
| ImGuiInputTextFlags_CallbackAlways;
|
||||||
|
|
||||||
if (FCogWindowWidgets::InputTextWithHint("##Command", "Command", CurrentUserInput, InputFlags, &OnTextInputCallbackStub, this))
|
const bool IsEnterPressed = FCogWindowWidgets::InputTextWithHint("##Command", "Command", CurrentUserInput, InputFlags, &OnTextInputCallbackStub, this);
|
||||||
|
InputTextId = ImGui::GetItemID();
|
||||||
|
|
||||||
|
if (IsEnterPressed)
|
||||||
{
|
{
|
||||||
ExecuteCommand(CurrentUserInput);
|
ExecuteCommand(CurrentUserInput);
|
||||||
bRequestInputFocus = true;
|
ActivateInputText();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bIsRenderingWidget)
|
|
||||||
{
|
|
||||||
InputIdOnWidgetMode = ImGui::GetItemID();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetItemDefaultFocus();
|
ImGui::SetItemDefaultFocus();
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
@@ -211,19 +253,33 @@ void FCogEngineWindow_Console::RenderInput()
|
|||||||
// we want the text input to always have focus so the user can directly type text if he wants to,
|
// we want the text input to always have focus so the user can directly type text if he wants to,
|
||||||
// but if he doesn't the command list should not clutter the screen.
|
// but if he doesn't the command list should not clutter the screen.
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
if (bIsRenderingWidget && ImGui::IsItemActive() && ImGui::IsMouseClicked(ImGuiMouseButton_Left))
|
if (bIsWidgetMode && ImGui::IsItemActive() && ImGui::IsMouseClicked(ImGuiMouseButton_Left))
|
||||||
{
|
{
|
||||||
bPopupCommandListOnWidgetMode = true;
|
WidgetMode_OpenCommandList = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::IsItemActive() == false && bRequestInputFocus)
|
|
||||||
{
|
|
||||||
ImGui::SetKeyboardFocusHere(-1);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::IsItemActive())
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Console::SelectNextCommand()
|
||||||
|
{
|
||||||
|
SelectedCommandIndex += 1;
|
||||||
|
bScroll = true;
|
||||||
|
|
||||||
|
if (SelectedCommandIndex >= CommandList.Num())
|
||||||
{
|
{
|
||||||
bRequestInputFocus = false;
|
SelectedCommandIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Console::SelectPreviousCommand()
|
||||||
|
{
|
||||||
|
SelectedCommandIndex -= 1;
|
||||||
|
bScroll = true;
|
||||||
|
|
||||||
|
if (SelectedCommandIndex < 0)
|
||||||
|
{
|
||||||
|
SelectedCommandIndex = CommandList.Num() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,43 +289,32 @@ int FCogEngineWindow_Console::OnTextInputCallback(ImGuiInputTextCallbackData* In
|
|||||||
bool DoCompletion = false;
|
bool DoCompletion = false;
|
||||||
if (InData->EventFlag == ImGuiInputTextFlags_CallbackHistory)
|
if (InData->EventFlag == ImGuiInputTextFlags_CallbackHistory)
|
||||||
{
|
{
|
||||||
DoCompletion = true;
|
|
||||||
|
|
||||||
if (InData->EventKey == ImGuiKey_UpArrow)
|
if (InData->EventKey == ImGuiKey_UpArrow)
|
||||||
{
|
{
|
||||||
SelectedCommandIndex -= 1;
|
SelectPreviousCommand();
|
||||||
bScroll = true;
|
|
||||||
|
|
||||||
if (SelectedCommandIndex < 0)
|
|
||||||
{
|
|
||||||
SelectedCommandIndex = CommandList.Num() - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (InData->EventKey == ImGuiKey_DownArrow)
|
else if (InData->EventKey == ImGuiKey_DownArrow)
|
||||||
{
|
{
|
||||||
SelectedCommandIndex += 1;
|
SelectNextCommand();
|
||||||
bScroll = true;
|
|
||||||
|
|
||||||
if (SelectedCommandIndex >= CommandList.Num())
|
|
||||||
{
|
|
||||||
SelectedCommandIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DoCompletion = true;
|
||||||
}
|
}
|
||||||
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackCompletion)
|
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackCompletion)
|
||||||
{
|
{
|
||||||
|
SelectNextCommand();
|
||||||
DoCompletion = true;
|
DoCompletion = true;
|
||||||
}
|
}
|
||||||
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackEdit)
|
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackEdit)
|
||||||
{
|
{
|
||||||
CurrentUserInput = FString(InData->Buf);
|
CurrentUserInput = FString(InData->Buf);
|
||||||
RefreshCommandList();
|
RefreshCommandList();
|
||||||
|
|
||||||
if (bIsRenderingWidget)
|
if (bIsWidgetMode)
|
||||||
{
|
{
|
||||||
bPopupCommandListOnWidgetMode = true;
|
WidgetMode_OpenCommandList = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackAlways)
|
else if (InData->EventFlag == ImGuiInputTextFlags_CallbackAlways)
|
||||||
{
|
{
|
||||||
if (bSetBufferToSelectedCommand)
|
if (bSetBufferToSelectedCommand)
|
||||||
@@ -288,9 +333,9 @@ int FCogEngineWindow_Console::OnTextInputCallback(ImGuiInputTextCallbackData* In
|
|||||||
InData->InsertChars(0, CommandStr.Get());
|
InData->InsertChars(0, CommandStr.Get());
|
||||||
InData->InsertChars(InData->CursorPos, " ");
|
InData->InsertChars(InData->CursorPos, " ");
|
||||||
|
|
||||||
if (bIsRenderingWidget)
|
if (bIsWidgetMode)
|
||||||
{
|
{
|
||||||
bPopupCommandListOnWidgetMode = true;
|
WidgetMode_OpenCommandList = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,25 +349,39 @@ int FCogEngineWindow_Console::OnTextInputCallbackStub(ImGuiInputTextCallbackData
|
|||||||
return ConsoleWindow.OnTextInputCallback(InData);
|
return ConsoleWindow.OnTextInputCallback(InData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_Console::RenderCommandHelp()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Console::RenderCommandList()
|
void FCogEngineWindow_Console::RenderCommandList()
|
||||||
{
|
{
|
||||||
const float HelpHeight = ImGui::GetFontSize() * 5;
|
const float HelpHeight = Config->ShowHelp ? ImGui::GetFontSize() * 5 : 0.0f;
|
||||||
const float Indent = ImGui::GetFontSize() * 0.5f;
|
const float Indent = ImGui::GetFontSize() * 0.5f;
|
||||||
|
const ImVec2 Size = IsWindowRenderedInMainMenu() ? ImVec2(0, ImGui::GetFontSize() * 20) : ImVec2(0.0f, ImGui::GetContentRegionAvail().y - HelpHeight);
|
||||||
|
|
||||||
const ImVec2 Size = IsWindowRenderedInMainMenu() ? ImVec2(0, ImGui::GetFontSize() * 20) : ImVec2(0.0f, -HelpHeight);
|
if (ImGui::BeginChild("Commands", Size, ImGuiChildFlags_None))
|
||||||
if (ImGui::BeginChild("Commands", Size, ImGuiChildFlags_NavFlattened | ImGuiChildFlags_ResizeY))
|
|
||||||
{
|
{
|
||||||
ImGui::Indent(Indent);
|
ImGui::Indent(Indent);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Gather the child window region min max so we can check if the
|
||||||
|
// selected command is clipped to know if we should scroll.
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
const float RegionMinY = ImGui::GetItemRectMin().y;
|
||||||
|
const float RegionMaxY = RegionMinY + ImGui::GetContentRegionAvail().y;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Reset the scroll when the command list reappear, otherwise we
|
||||||
|
// keep the previous scroll which can be confusing.
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
if (ImGui::IsWindowAppearing())
|
||||||
|
{
|
||||||
|
ImGui::SetScrollHereY(0.0f);
|
||||||
|
SelectedCommandIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
int32 Index = 0;
|
int32 Index = 0;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// TODO: The Clipper is currently not working correctly
|
||||||
|
//--------------------------------------------------------------------
|
||||||
ImGuiListClipper Clipper;
|
ImGuiListClipper Clipper;
|
||||||
Clipper.Begin(CommandList.Num());
|
Clipper.Begin(CommandList.Num());
|
||||||
while (Clipper.Step())
|
while (Clipper.Step())
|
||||||
@@ -336,7 +395,7 @@ void FCogEngineWindow_Console::RenderCommandList()
|
|||||||
{
|
{
|
||||||
ImGui::PushID(Index);
|
ImGui::PushID(Index);
|
||||||
const FString& CommandName = CommandList[Index];
|
const FString& CommandName = CommandList[Index];
|
||||||
RenderCommand(CommandName, Index);
|
RenderCommand(CommandName, Index, RegionMinY, RegionMaxY);
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,13 +405,16 @@ void FCogEngineWindow_Console::RenderCommandList()
|
|||||||
}
|
}
|
||||||
Clipper.End();
|
Clipper.End();
|
||||||
|
|
||||||
// If any is available, draw an additional command below the clipper to be able to scroll when pressing bottom
|
//--------------------------------------------------------------------
|
||||||
|
// If any is available, draw an additional command below the clipper
|
||||||
|
// to be able to scroll when pressing bottom
|
||||||
|
//--------------------------------------------------------------------
|
||||||
if (CommandList.IsValidIndex(Index + 1))
|
if (CommandList.IsValidIndex(Index + 1))
|
||||||
{
|
{
|
||||||
const FString& Command = CommandList[Index + 1];
|
const FString& Command = CommandList[Index + 1];
|
||||||
RenderCommand(Command, Index);
|
RenderCommand(Command, Index, RegionMinY, RegionMaxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Unindent(Indent);
|
ImGui::Unindent(Indent);
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
@@ -360,29 +422,31 @@ void FCogEngineWindow_Console::RenderCommandList()
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Render Help
|
// Render Help
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.2f, 0.2f, 0.2f, 0.5f));
|
if (Config->ShowHelp)
|
||||||
if (ImGui::BeginChild("Help", ImVec2(0.0f, ImGui::GetContentRegionAvail().y)))
|
|
||||||
{
|
{
|
||||||
ImGui::Spacing();
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.2f, 0.2f, 0.2f, 0.5f));
|
||||||
ImGui::BeginDisabled();
|
if (ImGui::BeginChild("Help", ImVec2(0.0f, ImGui::GetContentRegionAvail().y)))
|
||||||
ImGui::Indent(Indent);
|
|
||||||
|
|
||||||
if (CommandList.IsValidIndex(SelectedCommandIndex))
|
|
||||||
{
|
{
|
||||||
const FString SelectedCommand = CommandList[SelectedCommandIndex];
|
ImGui::Spacing();
|
||||||
const FString Help = GetConsoleCommandHelp(SelectedCommand);
|
ImGui::BeginDisabled();
|
||||||
const auto& HelpStr = StringCast<ANSICHAR>(*Help);
|
ImGui::Indent(Indent);
|
||||||
ImGui::TextWrapped(HelpStr.Get());
|
|
||||||
|
if (CommandList.IsValidIndex(SelectedCommandIndex))
|
||||||
|
{
|
||||||
|
const FString SelectedCommand = CommandList[SelectedCommandIndex];
|
||||||
|
const FString Help = GetConsoleCommandHelp(SelectedCommand);
|
||||||
|
const auto& HelpStr = StringCast<ANSICHAR>(*Help);
|
||||||
|
ImGui::TextWrapped(HelpStr.Get());
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Unindent(Indent);
|
||||||
|
ImGui::EndDisabled();
|
||||||
}
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
ImGui::Unindent(Indent);
|
ImGui::PopStyleColor();
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
FString FCogEngineWindow_Console::GetConsoleCommandHelp(const FString& InCommandName)
|
FString FCogEngineWindow_Console::GetConsoleCommandHelp(const FString& InCommandName)
|
||||||
{
|
{
|
||||||
@@ -404,7 +468,7 @@ FString FCogEngineWindow_Console::GetConsoleCommandHelp(const FString& InCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Console::RenderCommand(const FString& CommandName, const int32 Index)
|
void FCogEngineWindow_Console::RenderCommand(const FString& CommandName, const int32 Index, float RegionMinY, float RegionMaxY)
|
||||||
{
|
{
|
||||||
const auto& CommandNameStr = StringCast<ANSICHAR>(*CommandName);
|
const auto& CommandNameStr = StringCast<ANSICHAR>(*CommandName);
|
||||||
|
|
||||||
@@ -421,17 +485,25 @@ void FCogEngineWindow_Console::RenderCommand(const FString& CommandName, const i
|
|||||||
ImGuiSelectableFlags Flags =
|
ImGuiSelectableFlags Flags =
|
||||||
ImGuiSelectableFlags_AllowDoubleClick // Double click executes the selected command
|
ImGuiSelectableFlags_AllowDoubleClick // Double click executes the selected command
|
||||||
| ImGuiSelectableFlags_SelectOnClick; // Need to focus the console text input right away, otherwise the Selectable take back the focus on mouse release
|
| ImGuiSelectableFlags_SelectOnClick; // Need to focus the console text input right away, otherwise the Selectable take back the focus on mouse release
|
||||||
|
|
||||||
if (ImGui::Selectable(CommandNameStr.Get(), &IsSelected, Flags))
|
const bool Pressed = ImGui::Selectable(CommandNameStr.Get(), &IsSelected, Flags);
|
||||||
|
const int32 IsClippedTop = ImGui::GetItemRectMin().y < RegionMinY;
|
||||||
|
const int32 IsClippedBottom = ImGui::GetItemRectMax().y > RegionMaxY;
|
||||||
|
|
||||||
|
if (Pressed)
|
||||||
{
|
{
|
||||||
SelectedCommandIndex = Index;
|
SelectedCommandIndex = Index;
|
||||||
bRequestInputFocus = true;
|
|
||||||
bSetBufferToSelectedCommand = true;
|
|
||||||
|
|
||||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||||
{
|
{
|
||||||
ExecuteCommand(CommandName);
|
ExecuteCommand(CommandName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bSetBufferToSelectedCommand = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivateInputText();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginItemTooltip())
|
if (ImGui::BeginItemTooltip())
|
||||||
@@ -455,13 +527,19 @@ void FCogEngineWindow_Console::RenderCommand(const FString& CommandName, const i
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSelected)
|
if (IsSelected && bScroll)
|
||||||
{
|
{
|
||||||
if (bScroll)
|
if (IsClippedBottom)
|
||||||
{
|
{
|
||||||
ImGui::SetScrollHereY(1.0f);
|
ImGui::SetScrollHereY(1.0f);
|
||||||
bScroll = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsClippedTop)
|
||||||
|
{
|
||||||
|
ImGui::SetScrollHereY(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bScroll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +608,12 @@ void FCogEngineWindow_Console::RefreshCommandList()
|
|||||||
SelectedCommandIndex = -1;
|
SelectedCommandIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Console::ActivateInputText() const
|
||||||
|
{
|
||||||
|
return ImGui::ActivateItemByID(InputTextId);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Console::ExecuteCommand(const FString& InCommand)
|
void FCogEngineWindow_Console::ExecuteCommand(const FString& InCommand)
|
||||||
{
|
{
|
||||||
@@ -540,9 +624,9 @@ void FCogEngineWindow_Console::ExecuteCommand(const FString& InCommand)
|
|||||||
GEngine->DeferredCommands.Add(CleanupCommand);
|
GEngine->DeferredCommands.Add(CleanupCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bIsRenderingWidget)
|
if (bIsWidgetMode)
|
||||||
{
|
{
|
||||||
bPopupCommandListOnWidgetMode = false;
|
WidgetMode_OpenCommandList = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentUserInput = FString();
|
CurrentUserInput = FString();
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ void FCogEngineWindow_DebugSettings::Initialize()
|
|||||||
FCogDebug::SetIsFilteringBySelection(GetWorld(), Config->Data.bIsFilteringBySelection);
|
FCogDebug::SetIsFilteringBySelection(GetWorld(), Config->Data.bIsFilteringBySelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_DebugSettings::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_DebugSettings::PreSaveConfig()
|
void FCogEngineWindow_DebugSettings::PreSaveConfig()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ void FCogEngineWindow_Metrics::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_Metrics::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Metrics::PreSaveConfig()
|
void FCogEngineWindow_Metrics::PreSaveConfig()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "CogEngineWindow_NetEmulation.h"
|
#include "CogEngineWindow_NetEmulation.h"
|
||||||
|
|
||||||
#include "CogEngineWindow_Stats.h"
|
#include "CogEngineWindow_Stats.h"
|
||||||
|
#include "CogImguiHelper.h"
|
||||||
#include "CogWindowWidgets.h"
|
#include "CogWindowWidgets.h"
|
||||||
#include "Engine/Engine.h"
|
#include "Engine/Engine.h"
|
||||||
#include "Engine/NetConnection.h"
|
#include "Engine/NetConnection.h"
|
||||||
@@ -16,6 +17,25 @@ void FCogEngineWindow_NetEmulation::RenderHelp()
|
|||||||
ImGui::Text("This window is used to configure the network emulation.");
|
ImGui::Text("This window is used to configure the network emulation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_NetEmulation::Initialize()
|
||||||
|
{
|
||||||
|
Super::Initialize();
|
||||||
|
|
||||||
|
Config = GetConfig<UCogEngineWindowConfig_Stats>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_NetEmulation::RenderContextMenu()
|
||||||
|
{
|
||||||
|
Config->RenderColorConfig();
|
||||||
|
Config->RenderPingConfig();
|
||||||
|
Config->RenderPacketLossConfig();
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
FCogWindow::RenderContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_NetEmulation::RenderContent()
|
void FCogEngineWindow_NetEmulation::RenderContent()
|
||||||
{
|
{
|
||||||
@@ -42,7 +62,7 @@ void FCogEngineWindow_NetEmulation::DrawStats()
|
|||||||
const float Ping = PlayerState->GetPingInMilliseconds();
|
const float Ping = PlayerState->GetPingInMilliseconds();
|
||||||
ImGui::Text("Ping ");
|
ImGui::Text("Ping ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(FCogEngineWindow_Stats::GetPingColor(Ping), "%0.0fms", Ping);
|
ImGui::TextColored(Config->GetPingColor(Ping), "%0.0fms", Ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNetConnection* Connection = PlayerController->GetNetConnection())
|
if (UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||||
@@ -50,12 +70,12 @@ void FCogEngineWindow_NetEmulation::DrawStats()
|
|||||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
ImGui::Text("Packet Loss Out ");
|
ImGui::Text("Packet Loss Out ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(FCogEngineWindow_Stats::GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
ImGui::TextColored(Config->GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
||||||
|
|
||||||
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
ImGui::Text("Packet Loss In ");
|
ImGui::Text("Packet Loss In ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(FCogEngineWindow_Stats::GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
ImGui::TextColored(Config->GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,13 +76,6 @@ void FCogEngineWindow_NetImgui::Shutdown()
|
|||||||
CloseServer();
|
CloseServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_NetImgui::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_NetImgui::RenderHelp()
|
void FCogEngineWindow_NetImgui::RenderHelp()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "CogEngineWindow_OutputLog.h"
|
#include "CogEngineWindow_OutputLog.h"
|
||||||
|
|
||||||
#include "CogDebugHelper.h"
|
#include "CogDebugHelper.h"
|
||||||
|
#include "CogImguiHelper.h"
|
||||||
#include "CogWindowWidgets.h"
|
#include "CogWindowWidgets.h"
|
||||||
#include "Engine/Engine.h"
|
#include "Engine/Engine.h"
|
||||||
|
#include "HAL/PlatformApplicationMisc.h"
|
||||||
#include "Misc/StringBuilder.h"
|
#include "Misc/StringBuilder.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -25,14 +27,6 @@ void FCogEngineWindow_OutputLog::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_OutputLog::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_OutputLog::Clear()
|
void FCogEngineWindow_OutputLog::Clear()
|
||||||
{
|
{
|
||||||
@@ -61,7 +55,6 @@ void FCogEngineWindow_OutputLog::AddLog(const TCHAR* Message, ELogVerbosity::Typ
|
|||||||
TextBuffer.append(Format.GetData(), Format.GetData() + Format.Len());
|
TextBuffer.append(Format.GetData(), Format.GetData() + Format.Len());
|
||||||
|
|
||||||
LineInfo.End = TextBuffer.size();
|
LineInfo.End = TextBuffer.size();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -70,9 +63,9 @@ void FCogEngineWindow_OutputLog::DrawRow(const char* BufferStart, const FLineInf
|
|||||||
ImU32 Color;
|
ImU32 Color;
|
||||||
switch (LineInfo.Verbosity)
|
switch (LineInfo.Verbosity)
|
||||||
{
|
{
|
||||||
case ELogVerbosity::Error: Color = IM_COL32(255, 0, 0, 255); break;
|
case ELogVerbosity::Error: Color = FCogImguiHelper::ToImColor(Config->ErrorColor); break;
|
||||||
case ELogVerbosity::Warning: Color = IM_COL32(255, 200, 0, 255); break;
|
case ELogVerbosity::Warning: Color = FCogImguiHelper::ToImColor(Config->WarningColor); break;
|
||||||
default: Color = IM_COL32(200, 200, 200, 255); break;
|
default: Color = FCogImguiHelper::ToImColor(Config->DefaultColor); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, Color);
|
ImGui::PushStyleColor(ImGuiCol_Text, Color);
|
||||||
@@ -132,21 +125,37 @@ void FCogEngineWindow_OutputLog::DrawRow(const char* BufferStart, const FLineInf
|
|||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_OutputLog::Copy() const
|
||||||
|
{
|
||||||
|
const auto Buffer = StringCast<TCHAR>(TextBuffer.c_str());
|
||||||
|
const wchar_t* BufferData = Buffer.Get();
|
||||||
|
if (BufferData == nullptr)
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
FStringBuilderBase StringBuilder;
|
||||||
|
for (const FLineInfo& LineInfo : LineInfos)
|
||||||
|
{
|
||||||
|
StringBuilder.Append(FString::Printf(TEXT("[%3d] [%s] [%s] "), LineInfo.Frame, *LineInfo.Category.ToString(), ToString(LineInfo.Verbosity)));
|
||||||
|
StringBuilder.Append(BufferData + LineInfo.Start, LineInfo.End - LineInfo.Start);
|
||||||
|
StringBuilder.Append("\n");
|
||||||
|
};
|
||||||
|
|
||||||
|
FPlatformApplicationMisc::ClipboardCopy(StringBuilder.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_OutputLog::RenderContent()
|
void FCogEngineWindow_OutputLog::RenderContent()
|
||||||
{
|
{
|
||||||
Super::RenderContent();
|
Super::RenderContent();
|
||||||
|
|
||||||
bool ClearPressed = false;
|
|
||||||
bool CopyPressed = false;
|
|
||||||
|
|
||||||
if (ImGui::BeginMenuBar())
|
if (ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenu("Options"))
|
if (ImGui::BeginMenu("Options"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Copy"))
|
if (ImGui::MenuItem("Copy"))
|
||||||
{
|
{
|
||||||
ImGui::LogToClipboard();
|
Copy();
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
@@ -156,6 +165,20 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
|||||||
ImGui::Checkbox("Show Verbosity", &Config->ShowVerbosity);
|
ImGui::Checkbox("Show Verbosity", &Config->ShowVerbosity);
|
||||||
ImGui::Checkbox("Show As Table", &Config->ShowAsTable);
|
ImGui::Checkbox("Show As Table", &Config->ShowAsTable);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
constexpr ImGuiColorEditFlags ColorEditFlags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||||
|
FCogImguiHelper::ColorEdit4("Default Color", Config->DefaultColor, ColorEditFlags);
|
||||||
|
FCogImguiHelper::ColorEdit4("Warning Color", Config->WarningColor, ColorEditFlags);
|
||||||
|
FCogImguiHelper::ColorEdit4("Error Color", Config->ErrorColor, ColorEditFlags);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if (ImGui::Button("Reset Settings", ImVec2(-1, 0)))
|
||||||
|
{
|
||||||
|
ResetConfig();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,8 +270,6 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
|||||||
|
|
||||||
if (LineInfo.Verbosity <= (ELogVerbosity::Type)Config->VerbosityFilter)
|
if (LineInfo.Verbosity <= (ELogVerbosity::Type)Config->VerbosityFilter)
|
||||||
{
|
{
|
||||||
const char* LineStart = BufferStart + LineInfo.Start;
|
|
||||||
const char* LineEnd = BufferStart + LineInfo.End;
|
|
||||||
DrawRow(BufferStart, LineInfo, IsTableShown);
|
DrawRow(BufferStart, LineInfo, IsTableShown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,6 +313,11 @@ void FCogEngineWindow_OutputLog::RenderContent()
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::MenuItem("Copy"))
|
||||||
|
{
|
||||||
|
Copy();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ void FCogEngineWindow_Plots::ResetConfig()
|
|||||||
{
|
{
|
||||||
Super::ResetConfig();
|
Super::ResetConfig();
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
|
|
||||||
RefreshPlotSettings();
|
RefreshPlotSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,14 +60,6 @@ void FCogEngineWindow_Selection::Shutdown()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_Selection::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Selection::PreSaveConfig()
|
void FCogEngineWindow_Selection::PreSaveConfig()
|
||||||
{
|
{
|
||||||
@@ -298,17 +290,23 @@ void FCogEngineWindow_Selection::TickSelectionMode()
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Selection::RenderMainMenuWidget()
|
void FCogEngineWindow_Selection::RenderMainMenuWidget()
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Pick"))
|
ImGui::PushStyleVarX(ImGuiStyleVar_ItemSpacing, 0);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
|
||||||
|
if (FCogWindowWidgets::PickButton("##Pick", ImVec2(20, 20)))
|
||||||
{
|
{
|
||||||
GetOwner()->SetActivateSelectionMode(true);
|
GetOwner()->SetActivateSelectionMode(true);
|
||||||
HackWaitInputRelease();
|
HackWaitInputRelease();
|
||||||
}
|
}
|
||||||
RenderPickButtonTooltip();
|
|
||||||
|
|
||||||
//TODO: Could be replaced by a BeginMenu
|
ImGui::PopStyleColor();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
|
RenderPickButtonTooltip();
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||||
AActor* NewSelection = nullptr;
|
AActor* NewSelection = nullptr;
|
||||||
|
|
||||||
|
//TODO: Could be replaced by a BeginMenu
|
||||||
if (FCogWindowWidgets::MenuActorsCombo(
|
if (FCogWindowWidgets::MenuActorsCombo(
|
||||||
"MenuActorSelection",
|
"MenuActorSelection",
|
||||||
NewSelection,
|
NewSelection,
|
||||||
@@ -317,7 +315,7 @@ void FCogEngineWindow_Selection::RenderMainMenuWidget()
|
|||||||
Config->SelectedClassIndex,
|
Config->SelectedClassIndex,
|
||||||
&Filter,
|
&Filter,
|
||||||
GetLocalPlayerPawn(),
|
GetLocalPlayerPawn(),
|
||||||
[this](AActor& Actor) { RenderActorContextMenu(Actor); }))
|
[this](AActor& Actor) { RenderActorContextMenu(Actor); }))
|
||||||
{
|
{
|
||||||
SetGlobalSelection(NewSelection);
|
SetGlobalSelection(NewSelection);
|
||||||
}
|
}
|
||||||
@@ -338,9 +336,11 @@ void FCogEngineWindow_Selection::SetGlobalSelection(AActor* Value) const
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Selection::RenderPickButtonTooltip()
|
void FCogEngineWindow_Selection::RenderPickButtonTooltip()
|
||||||
{
|
{
|
||||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
if (FCogWindowWidgets::BeginItemTooltipWrappedText())
|
||||||
{
|
{
|
||||||
const FString Shortcut = FCogImguiInputHelper::KeyInfoToString(GetOwner()->GetSettings()->ToggleSelectionShortcut);
|
const FString Shortcut = FCogImguiInputHelper::KeyInfoToString(GetOwner()->GetSettings()->ToggleSelectionShortcut);
|
||||||
ImGui::SetTooltip("Enter picking mode to pick an actor on screen. %s", TCHAR_TO_ANSI(*Shortcut));
|
ImGui::Text("Enter selection mode to select an actor on screen. Change which actor type is selectable by clicking the selection combobox\n"
|
||||||
|
"%s", TCHAR_TO_ANSI(*Shortcut));
|
||||||
|
FCogWindowWidgets::EndItemTooltipWrappedText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "CogEngineWindow_Stats.h"
|
#include "CogEngineWindow_Stats.h"
|
||||||
|
|
||||||
|
#include "CogImguiHelper.h"
|
||||||
#include "CogWindowWidgets.h"
|
#include "CogWindowWidgets.h"
|
||||||
#include "Engine/Engine.h"
|
#include "Engine/Engine.h"
|
||||||
#include "Engine/NetConnection.h"
|
#include "Engine/NetConnection.h"
|
||||||
@@ -8,9 +9,7 @@
|
|||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "GameFramework/PlayerState.h"
|
#include "GameFramework/PlayerState.h"
|
||||||
|
|
||||||
ImVec4 StatRedColor(1.0f, 0.4f, 0.3f, 1.0f);
|
|
||||||
ImVec4 StatOrangeColor(1.0f, 0.7f, 0.4f, 1.0f);
|
|
||||||
ImVec4 StatGreenColor(0.5f, 1.0f, 0.6f, 1.0f);
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Stats::Initialize()
|
void FCogEngineWindow_Stats::Initialize()
|
||||||
@@ -19,6 +18,8 @@ void FCogEngineWindow_Stats::Initialize()
|
|||||||
|
|
||||||
bHasWidget = true;
|
bHasWidget = true;
|
||||||
bIsWidgetVisible = true;
|
bIsWidgetVisible = true;
|
||||||
|
|
||||||
|
Config = GetConfig<UCogEngineWindowConfig_Stats>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -29,6 +30,15 @@ void FCogEngineWindow_Stats::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Stats::RenderContextMenu()
|
||||||
|
{
|
||||||
|
Config->RenderAllConfigs();
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
FCogWindow::RenderContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Stats::RenderContent()
|
void FCogEngineWindow_Stats::RenderContent()
|
||||||
{
|
{
|
||||||
@@ -37,7 +47,7 @@ void FCogEngineWindow_Stats::RenderContent()
|
|||||||
extern ENGINE_API float GAverageFPS;
|
extern ENGINE_API float GAverageFPS;
|
||||||
ImGui::Text("FPS ");
|
ImGui::Text("FPS ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(GetFpsColor(GAverageFPS), "%0.0f", GAverageFPS);
|
ImGui::TextColored(Config->GetFpsColor(GAverageFPS), "%0.0f", GAverageFPS);
|
||||||
|
|
||||||
if (const APlayerController* PlayerController = GetLocalPlayerController())
|
if (const APlayerController* PlayerController = GetLocalPlayerController())
|
||||||
{
|
{
|
||||||
@@ -46,7 +56,7 @@ void FCogEngineWindow_Stats::RenderContent()
|
|||||||
const float Ping = PlayerState->GetPingInMilliseconds();
|
const float Ping = PlayerState->GetPingInMilliseconds();
|
||||||
ImGui::Text("Ping ");
|
ImGui::Text("Ping ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(GetPingColor(Ping), "%0.0fms", Ping);
|
ImGui::TextColored(Config->GetPingColor(Ping), "%0.0fms", Ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const UNetConnection* Connection = PlayerController->GetNetConnection())
|
if (const UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||||
@@ -54,12 +64,12 @@ void FCogEngineWindow_Stats::RenderContent()
|
|||||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
ImGui::Text("Packet Loss Out ");
|
ImGui::Text("Packet Loss Out ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
ImGui::TextColored(Config->GetPacketLossColor(OutPacketLost), "%0.0f%%", OutPacketLost);
|
||||||
|
|
||||||
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
ImGui::Text("Packet Loss In ");
|
ImGui::Text("Packet Loss In ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored(GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
ImGui::TextColored(Config->GetPacketLossColor(InPacketLost), "%0.0f%%", InPacketLost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,129 +78,169 @@ void FCogEngineWindow_Stats::RenderContent()
|
|||||||
void FCogEngineWindow_Stats::RenderMainMenuWidget()
|
void FCogEngineWindow_Stats::RenderMainMenuWidget()
|
||||||
{
|
{
|
||||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||||
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
|
||||||
|
|
||||||
RenderMainMenuWidgetFramerate(FCogWindowWidgets::GetFontWidth() * 8);
|
RenderMainMenuWidgetFrameRate();
|
||||||
RenderMainMenuWidgetPing(Connection != nullptr ? FCogWindowWidgets::GetFontWidth() * 7 : 0.0f);
|
|
||||||
RenderMainMenuWidgetPacketLoss(Connection != nullptr ? FCogWindowWidgets::GetFontWidth() * 7 : 0.0f);
|
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
||||||
|
if (Connection != nullptr)
|
||||||
|
{
|
||||||
|
RenderMainMenuWidgetPing();
|
||||||
|
|
||||||
|
RenderMainMenuWidgetPacketLoss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetFramerate(const float Width)
|
void FCogEngineWindow_Stats::RenderMainMenuWidgetFrameRate()
|
||||||
{
|
{
|
||||||
extern ENGINE_API float GAverageFPS;
|
extern ENGINE_API float GAverageFPS;
|
||||||
const int32 Fps = (int32)GAverageFPS;
|
const int32 Fps = static_cast<int32>(GAverageFPS);
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Text, Config->GetFpsColor(Fps));
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, GetFpsColor(Fps));
|
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%3dfps###FrameRateButton"), Fps)));
|
||||||
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%3dfps###FramerateButton"), Fps)));
|
const float Width = ImGui::GetItemRectSize().x;
|
||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(1);
|
||||||
|
|
||||||
if (Open)
|
if (ImGui::BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
ImGui::Text("Fps");
|
Config->RenderColorConfig();
|
||||||
ImGui::SameLine();
|
Config->RenderFrameRateConfig();
|
||||||
|
Super::RenderContextMenu();
|
||||||
int32 MaxFps = GEngine->GetMaxFPS();
|
ImGui::EndPopup();
|
||||||
TArray<int32> Values{ 0, 10, 20, 30, 60, 120 };
|
|
||||||
if (FCogWindowWidgets::MultiChoiceButtonsInt(Values, MaxFps, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
|
||||||
{
|
|
||||||
GEngine->SetMaxFPS(MaxFps);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetItemTooltip("Framerate");
|
if (Open == false)
|
||||||
|
{
|
||||||
|
ImGui::SetItemTooltip("Frame Rate");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Open)
|
||||||
|
{
|
||||||
|
const int32 MaxFps = GEngine->GetMaxFPS();
|
||||||
|
for (int32 i = 0; i < Config->FrameRates.Num(); ++i)
|
||||||
|
{
|
||||||
|
ImGui::PushID(i);
|
||||||
|
const float Value = Config->FrameRates[i];
|
||||||
|
const auto ValueText = StringCast<ANSICHAR>(*FCogWindowWidgets::FormatSmallFloat(Value));
|
||||||
|
if (ImGui::Selectable(ValueText.Get(), Value == MaxFps, ImGuiSelectableFlags_None, ImVec2(Width, 0)))
|
||||||
|
{
|
||||||
|
GEngine->SetMaxFPS(Value);
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPing(const float Width)
|
void FCogEngineWindow_Stats::RenderMainMenuWidgetPing()
|
||||||
{
|
{
|
||||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||||
const APlayerState* PlayerState = PlayerController != nullptr ? PlayerController->GetPlayerState<APlayerState>() : nullptr;
|
const APlayerState* PlayerState = PlayerController != nullptr ? PlayerController->GetPlayerState<APlayerState>() : nullptr;
|
||||||
if (PlayerState == nullptr)
|
if (PlayerState == nullptr)
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
const int32 Ping = static_cast<int32>(PlayerState->GetPingInMilliseconds());
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, Config->GetPingColor(Ping));
|
||||||
|
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%3dms###PingButton"), Ping)));
|
||||||
|
const float Width = ImGui::GetItemRectSize().x;
|
||||||
|
ImGui::PopStyleColor(1);
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
return;
|
Config->RenderColorConfig();
|
||||||
|
Config->RenderPingConfig();
|
||||||
|
Super::RenderContextMenu();
|
||||||
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const float Ping = PlayerState->GetPingInMilliseconds();
|
if (Open == false)
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
|
{
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, GetPingColor(Ping));
|
ImGui::SetItemTooltip("Ping");
|
||||||
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%3dms###PingButton"), (int32)Ping)));
|
}
|
||||||
ImGui::PopStyleColor(2);
|
|
||||||
ImGui::SetItemTooltip("Ping");
|
|
||||||
|
|
||||||
#if DO_ENABLE_NET_TEST
|
#if DO_ENABLE_NET_TEST
|
||||||
if (Open)
|
if (Open)
|
||||||
{
|
{
|
||||||
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
|
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
|
||||||
if (WorldContext.ActiveNetDrivers.Num() > 0)
|
if (WorldContext.ActiveNetDrivers.Num() > 0)
|
||||||
{
|
{
|
||||||
ImGui::Text("Ping");
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||||
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
||||||
TArray<int32> Values{ 0, 50, 100, 200, 500, 1000 };
|
|
||||||
if (FCogWindowWidgets::MultiChoiceButtonsInt(Values, Settings.PktIncomingLagMin, ImVec2(4.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
for (int32 i = 0; i < Config->Pings.Num(); ++i)
|
||||||
{
|
{
|
||||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
ImGui::PushID(i);
|
||||||
|
const float Value = Config->Pings[i];
|
||||||
|
const auto ValueText = StringCast<ANSICHAR>(*FCogWindowWidgets::FormatSmallFloat(Value));
|
||||||
|
if (ImGui::Selectable(ValueText.Get(), Value == Settings.PktIncomingLagMin, ImGuiSelectableFlags_None, ImVec2(Width, 0)))
|
||||||
|
{
|
||||||
|
Settings.PktIncomingLagMin = Value;
|
||||||
|
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
#endif //DO_ENABLE_NET_TEST
|
#endif //DO_ENABLE_NET_TEST
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(const float Width)
|
void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss()
|
||||||
{
|
{
|
||||||
const APlayerController* PlayerController = GetLocalPlayerController();
|
const APlayerController* PlayerController = GetLocalPlayerController();
|
||||||
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
const UNetConnection* Connection = PlayerController != nullptr ? PlayerController->GetNetConnection() : nullptr;
|
||||||
if (Connection == nullptr)
|
if (Connection == nullptr)
|
||||||
{
|
{ return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float OutPacketLost = Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
const float InPacketLost = Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f;
|
||||||
const float TotalPacketLost = (OutPacketLost + InPacketLost) / 2;
|
const float TotalPacketLost = (OutPacketLost + InPacketLost) / 2;
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
|
ImGui::PushStyleColor(ImGuiCol_Text, Config->GetPacketLossColor(TotalPacketLost));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
|
const bool Open = ImGui::BeginMenu(TCHAR_TO_ANSI(*FString::Printf(TEXT("%2d%% ###PacketLossButton"), (int32)TotalPacketLost)));
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
|
const float Width = ImGui::GetItemRectSize().x;
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, GetPacketLossColor(TotalPacketLost));
|
ImGui::PopStyleColor(1);
|
||||||
|
|
||||||
if (ImGui::Button(TCHAR_TO_ANSI(*FString::Printf(TEXT("%2d%%###PacketLossButton"), (int32)TotalPacketLost)), ImVec2(Width, 0.0f)))
|
if (ImGui::BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup("PacketLossPopup");
|
Config->RenderColorConfig();
|
||||||
|
Config->RenderPacketLossConfig();
|
||||||
|
Super::RenderContextMenu();
|
||||||
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopStyleColor(2);
|
if (Open == false)
|
||||||
ImGui::PopStyleVar(2);
|
{
|
||||||
|
ImGui::SetItemTooltip("Packet Loss");
|
||||||
ImGui::SetItemTooltip("Packet Loss");
|
}
|
||||||
|
|
||||||
#if DO_ENABLE_NET_TEST
|
#if DO_ENABLE_NET_TEST
|
||||||
if (ImGui::BeginPopup("PacketLossPopup"))
|
if (Open)
|
||||||
{
|
{
|
||||||
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
|
FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
|
||||||
if (WorldContext.ActiveNetDrivers.Num() > 0)
|
if (WorldContext.ActiveNetDrivers.Num() > 0)
|
||||||
{
|
{
|
||||||
ImGui::Text("Packet Loss");
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
const FNamedNetDriver* SelectedNetDriver = &WorldContext.ActiveNetDrivers[0];
|
||||||
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
FPacketSimulationSettings Settings = SelectedNetDriver->NetDriver->PacketSimulationSettings;
|
||||||
|
|
||||||
TArray<int32> Values{ 0, 5, 10, 20, 30, 40, 50 };
|
for (int32 i = 0; i < Config->PacketLosses.Num(); ++i)
|
||||||
if (FCogWindowWidgets::MultiChoiceButtonsInt(Values, Settings.PktIncomingLoss, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
|
||||||
{
|
{
|
||||||
Settings.PktLoss = Settings.PktIncomingLoss;
|
ImGui::PushID(i);
|
||||||
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
const float Value = Config->PacketLosses[i];
|
||||||
|
const auto ValueText = StringCast<ANSICHAR>(*FCogWindowWidgets::FormatSmallFloat(Value));
|
||||||
|
if (ImGui::Selectable(ValueText.Get(), Value == Settings.PktIncomingLagMin, ImGuiSelectableFlags_None, ImVec2(Width, 0)))
|
||||||
|
{
|
||||||
|
Settings.PktIncomingLoss = Value;
|
||||||
|
Settings.PktLoss = Settings.PktIncomingLoss;
|
||||||
|
SelectedNetDriver->NetDriver->SetPacketSimulationSettings(Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
@@ -198,50 +248,98 @@ void FCogEngineWindow_Stats::RenderMainMenuWidgetPacketLoss(const float Width)
|
|||||||
#endif //DO_ENABLE_NET_TEST
|
#endif //DO_ENABLE_NET_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ImVec4 FCogEngineWindow_Stats::GetFpsColor(const float Value, const float Good /*= 50.0f*/, const float Medium /*= 30.0f*/)
|
ImVec4 UCogEngineWindowConfig_Stats::GetFpsColor(const float Value) const
|
||||||
{
|
{
|
||||||
if (Value > Good)
|
if (Value > GoodFrameRate)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(GoodColor); }
|
||||||
return StatGreenColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Value > Medium)
|
if (Value > MediumFrameRate)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(MediumColor); }
|
||||||
return StatOrangeColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return StatRedColor;
|
return FCogImguiHelper::ToImVec4(BadColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ImVec4 FCogEngineWindow_Stats::GetPingColor(const float Value, const float Good /*= 100.0f*/, const float Medium /*= 200.0f*/)
|
ImVec4 UCogEngineWindowConfig_Stats::GetPingColor(const float Value) const
|
||||||
{
|
{
|
||||||
if (Value > Medium)
|
if (Value > MediumPing)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(BadColor); }
|
||||||
return StatRedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Value > Good)
|
if (Value > GoodPing)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(MediumColor); }
|
||||||
return StatOrangeColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return StatGreenColor;
|
return FCogImguiHelper::ToImVec4(GoodColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ImVec4 FCogEngineWindow_Stats::GetPacketLossColor(const float Value, const float Good /*= 10.0f*/, const float Medium /*= 20.0f*/)
|
ImVec4 UCogEngineWindowConfig_Stats::GetPacketLossColor(const float Value) const
|
||||||
{
|
{
|
||||||
if (Value > Medium)
|
if (Value > MediumPacketLoss)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(BadColor); }
|
||||||
return StatRedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Value > Good)
|
if (Value > GoodPacketLoss)
|
||||||
{
|
{ return FCogImguiHelper::ToImVec4(MediumColor); }
|
||||||
return StatOrangeColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return StatGreenColor;
|
return FCogImguiHelper::ToImVec4(GoodColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogEngineWindowConfig_Stats::RenderAllConfigs()
|
||||||
|
{
|
||||||
|
RenderColorConfig();
|
||||||
|
RenderFrameRateConfig();
|
||||||
|
RenderPingConfig();
|
||||||
|
RenderPacketLossConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogEngineWindowConfig_Stats::RenderColorConfig()
|
||||||
|
{
|
||||||
|
if (ImGui::CollapsingHeader("Display", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
constexpr ImGuiColorEditFlags ColorEditFlags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||||
|
FCogImguiHelper::ColorEdit4("Good Color", GoodColor, ColorEditFlags);
|
||||||
|
ImGui::SetItemTooltip("Color of a stat with a good value.");
|
||||||
|
|
||||||
|
FCogImguiHelper::ColorEdit4("Medium Color", MediumColor, ColorEditFlags);
|
||||||
|
ImGui::SetItemTooltip("Color of a stat with a medium value.");
|
||||||
|
|
||||||
|
FCogImguiHelper::ColorEdit4("Bad Color", BadColor, ColorEditFlags);
|
||||||
|
ImGui::SetItemTooltip("Color of a stat with a bad value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogEngineWindowConfig_Stats::RenderFrameRateConfig()
|
||||||
|
{
|
||||||
|
if (ImGui::CollapsingHeader("Frame Rate", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
ImGui::InputInt("Good Frame Rate", &GoodFrameRate);
|
||||||
|
ImGui::InputInt("Medium Frame Rate", &MediumFrameRate);
|
||||||
|
FCogWindowWidgets::IntArray("Max Frame Rate", FrameRates, 10, ImVec2(0, ImGui::GetFontSize() * 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogEngineWindowConfig_Stats::RenderPingConfig()
|
||||||
|
{
|
||||||
|
if (ImGui::CollapsingHeader("Ping", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
ImGui::InputInt("Good Ping", &GoodPing);
|
||||||
|
ImGui::InputInt("Medium Ping", &MediumPing);
|
||||||
|
FCogWindowWidgets::IntArray("Ping Emulation", Pings, 10, ImVec2(0, ImGui::GetFontSize() * 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogEngineWindowConfig_Stats::RenderPacketLossConfig()
|
||||||
|
{
|
||||||
|
if (ImGui::CollapsingHeader("Packet Loss", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
ImGui::InputInt("Good Packet Loss", &GoodPacketLoss);
|
||||||
|
ImGui::InputInt("Medium Packet Loss", &MediumPacketLoss);
|
||||||
|
FCogWindowWidgets::IntArray("Packet Loss Emulation", PacketLosses, 10, ImVec2(0, ImGui::GetFontSize() * 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "CogEngineWindow_TimeScale.h"
|
#include "CogEngineWindow_TimeScale.h"
|
||||||
|
|
||||||
#include "CogEngineReplicator.h"
|
#include "CogEngineReplicator.h"
|
||||||
|
#include "CogImguiHelper.h"
|
||||||
#include "CogWindowWidgets.h"
|
#include "CogWindowWidgets.h"
|
||||||
#include "Engine/Engine.h"
|
#include "Engine/Engine.h"
|
||||||
#include "Engine/World.h"
|
#include "Engine/World.h"
|
||||||
@@ -10,14 +11,10 @@ void FCogEngineWindow_TimeScale::Initialize()
|
|||||||
{
|
{
|
||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
TimingScales.Add(0.00f);
|
bHasWidget = true;
|
||||||
TimingScales.Add(0.01f);
|
bIsWidgetVisible = true;
|
||||||
TimingScales.Add(0.10f);
|
|
||||||
TimingScales.Add(0.50f);
|
Config = GetConfig<UCogEngineWindowConfig_TimeScale>();
|
||||||
TimingScales.Add(1.00f);
|
|
||||||
TimingScales.Add(2.00f);
|
|
||||||
TimingScales.Add(5.00f);
|
|
||||||
TimingScales.Add(10.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -41,10 +38,84 @@ void FCogEngineWindow_TimeScale::RenderContent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderTimeScaleChoices(Replicator);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_TimeScale::RenderContextMenu()
|
||||||
|
{
|
||||||
|
if (IsWindowRenderedInMainMenu() == false)
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Inline", &Config->Inline);
|
||||||
|
}
|
||||||
|
|
||||||
|
FCogImguiHelper::ColorEdit4("Time Scale Modified Color", Config->TimeScaleModifiedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||||
|
ImGui::SetItemTooltip("Color of the current time scale, in widget mode, when the time scale in not 1.");
|
||||||
|
|
||||||
|
FCogWindowWidgets::FloatArray("Time Scales", Config->TimeScales, 10, ImVec2(0, ImGui::GetFontSize() * 10));
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
FCogWindow::RenderContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_TimeScale::RenderMainMenuWidget()
|
||||||
|
{
|
||||||
|
Super::RenderMainMenuWidget();
|
||||||
|
|
||||||
|
ACogEngineReplicator* Replicator = ACogEngineReplicator::GetLocalReplicator(*GetWorld());
|
||||||
|
if (Replicator == nullptr)
|
||||||
|
{
|
||||||
|
ImGui::TextDisabled("Invalid Replicator");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float CurrentValue = Replicator->GetTimeDilation();
|
||||||
|
if (CurrentValue != 1.0f)
|
||||||
|
{
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Config->TimeScaleModifiedColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto CurrentValueText = StringCast<ANSICHAR>(*FString::Printf(TEXT("x%g"), CurrentValue));
|
||||||
|
const bool Open = ImGui::BeginMenu(CurrentValueText.Get());
|
||||||
|
|
||||||
|
if (CurrentValue != 1)
|
||||||
|
{
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupContextItem())
|
||||||
|
{
|
||||||
|
RenderContextMenu();
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Open)
|
||||||
|
{
|
||||||
|
for (int32 i = 0; i < Config->TimeScales.Num(); ++i)
|
||||||
|
{
|
||||||
|
const float Value = Config->TimeScales[i];
|
||||||
|
const auto ValueText = StringCast<ANSICHAR>(*FString::Printf(TEXT("%g"), Value));
|
||||||
|
if (ImGui::Selectable(ValueText.Get(), Value == Replicator->GetTimeDilation()))
|
||||||
|
{
|
||||||
|
Replicator->SetTimeDilation(Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::SetItemTooltip("Time Scale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_TimeScale::RenderTimeScaleChoices(ACogEngineReplicator* Replicator)
|
||||||
|
{
|
||||||
float Value = Replicator->GetTimeDilation();
|
float Value = Replicator->GetTimeDilation();
|
||||||
if (FCogWindowWidgets::MultiChoiceButtonsFloat(TimingScales, Value, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
|
if (FCogWindowWidgets::MultiChoiceButtonsFloat(Config->TimeScales, Value, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0), Config->Inline))
|
||||||
{
|
{
|
||||||
Replicator->SetTimeDilation(Value);
|
Replicator->SetTimeDilation(Value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -23,8 +23,6 @@ protected:
|
|||||||
|
|
||||||
virtual void GameTick(float DeltaTime) override;
|
virtual void GameTick(float DeltaTime) override;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -11,18 +11,20 @@ class COGENGINE_API FCogEngineWindow_Console : public FCogWindow
|
|||||||
{
|
{
|
||||||
typedef FCogWindow Super;
|
typedef FCogWindow Super;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
|
|
||||||
|
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||||
|
|
||||||
virtual void RenderMainMenuWidget() override;
|
virtual void RenderMainMenuWidget() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +33,8 @@ private:
|
|||||||
void RenderMenu();
|
void RenderMenu();
|
||||||
|
|
||||||
void RenderInput();
|
void RenderInput();
|
||||||
|
void SelectNextCommand();
|
||||||
|
void SelectPreviousCommand();
|
||||||
|
|
||||||
int OnTextInputCallback(ImGuiInputTextCallbackData* InData);
|
int OnTextInputCallback(ImGuiInputTextCallbackData* InData);
|
||||||
|
|
||||||
@@ -38,15 +42,15 @@ private:
|
|||||||
|
|
||||||
void RenderCommandList();
|
void RenderCommandList();
|
||||||
|
|
||||||
void RenderCommand(const FString& CommandName, int32 Index);
|
void RenderCommand(const FString& CommandName, int32 Index, float RegionMinY, float RegionMaxY);
|
||||||
|
|
||||||
void RefreshCommandList();
|
void RefreshCommandList();
|
||||||
|
|
||||||
void RenderCommandHelp();
|
void ActivateInputText() const;
|
||||||
|
|
||||||
void ExecuteCommand(const FString& InCommand);
|
void ExecuteCommand(const FString& InCommand);
|
||||||
|
|
||||||
int32 SelectedCommandIndex = -1;
|
int32 SelectedCommandIndex = INDEX_NONE;
|
||||||
|
|
||||||
TArray<FString> CommandList;
|
TArray<FString> CommandList;
|
||||||
|
|
||||||
@@ -56,18 +60,20 @@ private:
|
|||||||
|
|
||||||
bool bScroll = false;
|
bool bScroll = false;
|
||||||
|
|
||||||
bool bRequestInputFocus = false;
|
|
||||||
|
|
||||||
bool bIsWindowFocused = false;
|
bool bIsWindowFocused = false;
|
||||||
|
|
||||||
bool bPopupCommandListOnWidgetMode = false;
|
|
||||||
|
|
||||||
ImGuiID InputIdOnWidgetMode = 0;
|
|
||||||
|
|
||||||
bool bIsRenderingWidget = false;
|
|
||||||
|
|
||||||
bool bSetBufferToSelectedCommand = false;
|
bool bSetBufferToSelectedCommand = false;
|
||||||
|
|
||||||
|
bool bIsWidgetMode = false;
|
||||||
|
|
||||||
|
ImGuiID InputTextId = 0;
|
||||||
|
|
||||||
|
bool WidgetMode_OpenCommandList = false;
|
||||||
|
|
||||||
|
ImVec2 WidgetMode_CommandListPosition = ImVec2(0, 0);
|
||||||
|
|
||||||
|
bool WidgetMode_IsTextInputActive = false;
|
||||||
|
|
||||||
TWeakObjectPtr<UCogEngineConfig_Console> Config;
|
TWeakObjectPtr<UCogEngineConfig_Console> Config;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -93,6 +99,9 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(Config)
|
UPROPERTY(Config)
|
||||||
bool UseClipper = false;
|
bool UseClipper = false;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
bool ShowHelp = true;
|
||||||
|
|
||||||
UPROPERTY(Config)
|
UPROPERTY(Config)
|
||||||
int32 NumHistoryCommands = 10;
|
int32 NumHistoryCommands = 10;
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void PreSaveConfig() override;
|
virtual void PreSaveConfig() override;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void PreSaveConfig() override;
|
virtual void PreSaveConfig() override;
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogWindow.h"
|
#include "CogWindow.h"
|
||||||
|
|
||||||
|
class UCogEngineWindowConfig_Stats;
|
||||||
|
|
||||||
class COGENGINE_API FCogEngineWindow_NetEmulation : public FCogWindow
|
class COGENGINE_API FCogEngineWindow_NetEmulation : public FCogWindow
|
||||||
{
|
{
|
||||||
typedef FCogWindow Super;
|
typedef FCogWindow Super;
|
||||||
@@ -11,12 +13,15 @@ protected:
|
|||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
|
virtual void Initialize() override;
|
||||||
|
|
||||||
|
virtual void RenderContextMenu() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
virtual void DrawStats();
|
virtual void DrawStats();
|
||||||
|
|
||||||
virtual void DrawControls();
|
virtual void DrawControls();
|
||||||
|
|
||||||
private:
|
TWeakObjectPtr<UCogEngineWindowConfig_Stats> Config;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,13 +27,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
virtual void RenderTick(float DeltaTime);
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|
||||||
void ConnectTo();
|
void ConnectTo();
|
||||||
|
|
||||||
@@ -41,8 +39,6 @@ protected:
|
|||||||
|
|
||||||
void Disconnect();
|
void Disconnect();
|
||||||
|
|
||||||
void TryStartup();
|
|
||||||
|
|
||||||
void RunServer();
|
void RunServer();
|
||||||
|
|
||||||
void CloseServer();
|
void CloseServer();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "Misc/OutputDevice.h"
|
#include "Misc/OutputDevice.h"
|
||||||
#include "CogEngineWindow_OutputLog.generated.h"
|
#include "CogEngineWindow_OutputLog.generated.h"
|
||||||
|
|
||||||
class FCogEngineWindow_OutputLog;
|
|
||||||
class UCogEngineConfig_OutputLog;
|
class UCogEngineConfig_OutputLog;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -17,7 +16,7 @@ public:
|
|||||||
friend class FCogEngineWindow_OutputLog;
|
friend class FCogEngineWindow_OutputLog;
|
||||||
|
|
||||||
FCogLogOutputDevice();
|
FCogLogOutputDevice();
|
||||||
~FCogLogOutputDevice();
|
virtual ~FCogLogOutputDevice() override;
|
||||||
|
|
||||||
virtual void Serialize(const TCHAR* Message, ELogVerbosity::Type Verbosity, const FName& Category) override;
|
virtual void Serialize(const TCHAR* Message, ELogVerbosity::Type Verbosity, const FName& Category) override;
|
||||||
|
|
||||||
@@ -37,12 +36,12 @@ public:
|
|||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
void Copy() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -66,7 +65,7 @@ private:
|
|||||||
|
|
||||||
FCogLogOutputDevice OutputDevice;
|
FCogLogOutputDevice OutputDevice;
|
||||||
|
|
||||||
TObjectPtr<UCogEngineConfig_OutputLog> Config = nullptr;
|
TWeakObjectPtr<UCogEngineConfig_OutputLog> Config = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -95,6 +94,15 @@ public:
|
|||||||
UPROPERTY(Config)
|
UPROPERTY(Config)
|
||||||
int32 VerbosityFilter = ELogVerbosity::VeryVerbose;
|
int32 VerbosityFilter = ELogVerbosity::VeryVerbose;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor DefaultColor = FColor::White;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor WarningColor = FColor::White;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor ErrorColor = FColor::White;
|
||||||
|
|
||||||
virtual void Reset() override
|
virtual void Reset() override
|
||||||
{
|
{
|
||||||
Super::Reset();
|
Super::Reset();
|
||||||
@@ -105,5 +113,8 @@ public:
|
|||||||
ShowVerbosity = false;
|
ShowVerbosity = false;
|
||||||
ShowAsTable = false;
|
ShowAsTable = false;
|
||||||
VerbosityFilter = ELogVerbosity::VeryVerbose;
|
VerbosityFilter = ELogVerbosity::VeryVerbose;
|
||||||
|
DefaultColor = FColor(200, 200, 200, 255);
|
||||||
|
WarningColor = FColor(255, 200, 0, 255);
|
||||||
|
ErrorColor = FColor(255, 0, 0, 255);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -35,8 +35,6 @@ protected:
|
|||||||
|
|
||||||
virtual void TryReapplySelection() const;
|
virtual void TryReapplySelection() const;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void PreSaveConfig() override;
|
virtual void PreSaveConfig() override;
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|||||||
@@ -2,32 +2,113 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogWindow.h"
|
#include "CogWindow.h"
|
||||||
|
#include "CogEngineWindow_Stats.generated.h"
|
||||||
|
|
||||||
|
class UCogEngineWindowConfig_Stats;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
class COGENGINE_API FCogEngineWindow_Stats : public FCogWindow
|
class COGENGINE_API FCogEngineWindow_Stats : public FCogWindow
|
||||||
{
|
{
|
||||||
typedef FCogWindow Super;
|
typedef FCogWindow Super;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static ImVec4 GetFpsColor(float Value, float Good = 50.0f, float Medium = 30.0f);
|
|
||||||
|
|
||||||
static ImVec4 GetPingColor(float Value, float Good = 100.0f, float Medium = 200.0f);
|
|
||||||
|
|
||||||
static ImVec4 GetPacketLossColor(float Value, float Good = 10.0f, float Medium = 20.0f);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
|
virtual void RenderContextMenu() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
virtual void RenderMainMenuWidget() override;
|
virtual void RenderMainMenuWidget() override;
|
||||||
|
|
||||||
virtual void RenderMainMenuWidgetPacketLoss(float Width);
|
virtual void RenderMainMenuWidgetPacketLoss();
|
||||||
|
|
||||||
virtual void RenderMainMenuWidgetPing(float Width);
|
virtual void RenderMainMenuWidgetPing();
|
||||||
|
|
||||||
virtual void RenderMainMenuWidgetFramerate(float Width);
|
virtual void RenderMainMenuWidgetFrameRate();
|
||||||
|
|
||||||
|
TWeakObjectPtr<UCogEngineWindowConfig_Stats> Config;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
UCLASS(Config = Cog)
|
||||||
|
class UCogEngineWindowConfig_Stats : public UCogCommonConfig
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Reset() override
|
||||||
|
{
|
||||||
|
UCogCommonConfig::Reset();
|
||||||
|
|
||||||
|
GoodColor = FColor(30, 255, 60, 255);
|
||||||
|
MediumColor = FColor(255, 200,0, 255);
|
||||||
|
BadColor = FColor(255, 80, 80, 255);
|
||||||
|
|
||||||
|
FrameRates = { 0, 10, 20, 30, 60, 120 };
|
||||||
|
Pings = { 0, 50, 100, 200, 500, 1000 };
|
||||||
|
PacketLosses = { 0, 5, 10, 20, 30, 40, 50 };
|
||||||
|
|
||||||
|
GoodFrameRate = 60;
|
||||||
|
MediumFrameRate = 30;
|
||||||
|
GoodPing = 100;
|
||||||
|
MediumPing = 200;
|
||||||
|
GoodPacketLoss = 5;
|
||||||
|
MediumPacketLoss = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImVec4 GetFpsColor(float Value) const;
|
||||||
|
|
||||||
|
ImVec4 GetPingColor(float Value) const;
|
||||||
|
|
||||||
|
ImVec4 GetPacketLossColor(float Value) const;
|
||||||
|
|
||||||
|
void RenderAllConfigs();
|
||||||
|
|
||||||
|
void RenderColorConfig();
|
||||||
|
|
||||||
|
void RenderFrameRateConfig();
|
||||||
|
|
||||||
|
void RenderPingConfig();
|
||||||
|
|
||||||
|
void RenderPacketLossConfig();
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
TArray<int> FrameRates;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int GoodFrameRate = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int MediumFrameRate = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
TArray<int> Pings;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int GoodPing = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int MediumPing = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
TArray<int> PacketLosses;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int GoodPacketLoss = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
int MediumPacketLoss = 0;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor GoodColor = FColor();
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor MediumColor = FColor();
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor BadColor = FColor();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,24 +1,62 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "CogEngineReplicator.h"
|
||||||
#include "CogWindow.h"
|
#include "CogWindow.h"
|
||||||
|
#include "CogEngineWindow_TimeScale.generated.h"
|
||||||
|
|
||||||
|
class UCogEngineWindowConfig_TimeScale;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
class COGENGINE_API FCogEngineWindow_TimeScale : public FCogWindow
|
class COGENGINE_API FCogEngineWindow_TimeScale : public FCogWindow
|
||||||
{
|
{
|
||||||
typedef FCogWindow Super;
|
typedef FCogWindow Super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void Initialize() override;
|
||||||
void Initialize();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
|
virtual void RenderContextMenu() override;
|
||||||
|
|
||||||
TArray<float> TimingScales;
|
virtual void RenderMainMenuWidget() override;
|
||||||
|
|
||||||
private:
|
virtual void RenderTimeScaleChoices(ACogEngineReplicator* Replicator);
|
||||||
|
|
||||||
|
TWeakObjectPtr<UCogEngineWindowConfig_TimeScale> Config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
UCLASS(Config = Cog)
|
||||||
|
class UCogEngineWindowConfig_TimeScale : public UCogCommonConfig
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Reset() override
|
||||||
|
{
|
||||||
|
UCogCommonConfig::Reset();
|
||||||
|
|
||||||
|
TimeScale = 1.0f;
|
||||||
|
Inline = true;
|
||||||
|
TimeScales = { 0.00f, 0.01f, 0.10f, 0.50f, 1.00f, 2.00f, 5.00f, 10.0f };
|
||||||
|
TimeScaleModifiedColor = FColor(255, 30, 210, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float TimeScale = 1.0f;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
TArray<float> TimeScales;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
bool Inline = true;
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
FColor TimeScaleModifiedColor = FColor();
|
||||||
|
};
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "Framework/Application/SlateUser.h"
|
#include "Framework/Application/SlateUser.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "GameFramework/PlayerInput.h"
|
#include "GameFramework/PlayerInput.h"
|
||||||
|
#include "HAL/PlatformApplicationMisc.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
#include "implot.h"
|
#include "implot.h"
|
||||||
@@ -31,7 +32,7 @@ FCogImGuiContextScope::FCogImGuiContextScope(FCogImguiContext& CogImguiContext)
|
|||||||
PrevContext = ImGui::GetCurrentContext();
|
PrevContext = ImGui::GetCurrentContext();
|
||||||
PrevPlotContext = ImPlot::GetCurrentContext();
|
PrevPlotContext = ImPlot::GetCurrentContext();
|
||||||
|
|
||||||
ImGui::SetCurrentContext(CogImguiContext.ImGuiContext);
|
ImGui::SetCurrentContext(CogImguiContext.Context);
|
||||||
ImPlot::SetCurrentContext(CogImguiContext.PlotContext);
|
ImPlot::SetCurrentContext(CogImguiContext.PlotContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ FCogImGuiContextScope::~FCogImGuiContextScope()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogImguiContext::bIsNetImguiInitialized = false;
|
bool FCogImguiContext::bIsNetImGuiInitialized = false;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::Initialize()
|
void FCogImguiContext::Initialize()
|
||||||
@@ -71,10 +72,10 @@ void FCogImguiContext::Initialize()
|
|||||||
GameViewport->AddViewportWidgetContent(InputCatcherWidget.ToSharedRef(), -TNumericLimits<int32>::Max());
|
GameViewport->AddViewportWidgetContent(InputCatcherWidget.ToSharedRef(), -TNumericLimits<int32>::Max());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiContext = ImGui::CreateContext();
|
Context = ImGui::CreateContext();
|
||||||
PlotContext = ImPlot::CreateContext();
|
PlotContext = ImPlot::CreateContext();
|
||||||
ImGui::SetCurrentContext(ImGuiContext);
|
ImGui::SetCurrentContext(Context);
|
||||||
ImPlot::SetImGuiContext(ImGuiContext);
|
ImPlot::SetImGuiContext(Context);
|
||||||
ImPlot::SetCurrentContext(PlotContext);
|
ImPlot::SetCurrentContext(PlotContext);
|
||||||
|
|
||||||
ImGuiIO& IO = ImGui::GetIO();
|
ImGuiIO& IO = ImGui::GetIO();
|
||||||
@@ -121,6 +122,11 @@ void FCogImguiContext::Initialize()
|
|||||||
PlatformIO.Platform_SetWindowTitle = ImGui_SetWindowTitle;
|
PlatformIO.Platform_SetWindowTitle = ImGui_SetWindowTitle;
|
||||||
PlatformIO.Platform_SetWindowAlpha = ImGui_SetWindowAlpha;
|
PlatformIO.Platform_SetWindowAlpha = ImGui_SetWindowAlpha;
|
||||||
PlatformIO.Platform_RenderWindow = ImGui_RenderWindow;
|
PlatformIO.Platform_RenderWindow = ImGui_RenderWindow;
|
||||||
|
|
||||||
|
PlatformIO.Platform_ClipboardUserData = &ClipboardBuffer;
|
||||||
|
PlatformIO.Platform_GetClipboardTextFn = ImGui_GetClipboardTextFn;
|
||||||
|
PlatformIO.Platform_SetClipboardTextFn = ImGui_SetClipboardTextFn;
|
||||||
|
PlatformIO.Platform_OpenInShellFn = ImGui_OpenInShell;
|
||||||
|
|
||||||
if (FSlateApplication::IsInitialized())
|
if (FSlateApplication::IsInitialized())
|
||||||
{
|
{
|
||||||
@@ -143,10 +149,10 @@ void FCogImguiContext::Initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if NETIMGUI_ENABLED
|
#if NETIMGUI_ENABLED
|
||||||
if (bIsNetImguiInitialized == false)
|
if (bIsNetImGuiInitialized == false)
|
||||||
{
|
{
|
||||||
NetImgui::Startup();
|
NetImgui::Startup();
|
||||||
bIsNetImguiInitialized = true;
|
bIsNetImGuiInitialized = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -154,16 +160,16 @@ void FCogImguiContext::Initialize()
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::Shutdown()
|
void FCogImguiContext::Shutdown()
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// NetImgui must be shutdown before imgui as it uses context hooks
|
// NetImgui must be shutdown before imgui as it uses context hooks
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
#if NETIMGUI_ENABLED
|
#if NETIMGUI_ENABLED
|
||||||
if (bIsNetImguiInitialized)
|
if (bIsNetImGuiInitialized)
|
||||||
{
|
{
|
||||||
NetImgui::Shutdown();
|
NetImgui::Shutdown();
|
||||||
bIsNetImguiInitialized = false;
|
bIsNetImGuiInitialized = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -196,17 +202,17 @@ void FCogImguiContext::Shutdown()
|
|||||||
PlotContext = nullptr;
|
PlotContext = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGuiContext)
|
if (Context)
|
||||||
{
|
{
|
||||||
ImGui::DestroyContext(ImGuiContext);
|
ImGui::DestroyContext(Context);
|
||||||
ImGuiContext = nullptr;
|
Context = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::OnDisplayMetricsChanged(const FDisplayMetrics& DisplayMetrics) const
|
void FCogImguiContext::OnDisplayMetricsChanged(const FDisplayMetrics& DisplayMetrics) const
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
ImGuiPlatformIO& PlatformIO = ImGui::GetPlatformIO();
|
ImGuiPlatformIO& PlatformIO = ImGui::GetPlatformIO();
|
||||||
PlatformIO.Monitors.resize(0);
|
PlatformIO.Monitors.resize(0);
|
||||||
@@ -234,7 +240,7 @@ void FCogImguiContext::OnDisplayMetricsChanged(const FDisplayMetrics& DisplayMet
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogImguiContext::BeginFrame(float InDeltaTime)
|
bool FCogImguiContext::BeginFrame(float InDeltaTime)
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
// Skip the first frame, to let the main widget update its TickSpaceGeometry which is returned by the
|
// Skip the first frame, to let the main widget update its TickSpaceGeometry which is returned by the
|
||||||
@@ -376,7 +382,7 @@ ImVec2 FCogImguiContext::GetImguiMousePos()
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::EndFrame()
|
void FCogImguiContext::EndFrame()
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
//NetImgui::EndFrame();
|
//NetImgui::EndFrame();
|
||||||
@@ -646,6 +652,36 @@ void FCogImguiContext::ImGui_RenderWindow(ImGuiViewport* Viewport, void* Data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
const char* FCogImguiContext::ImGui_GetClipboardTextFn(ImGuiContext* InImGuiContext)
|
||||||
|
{
|
||||||
|
TArray<char>* ClipboardBuffer = static_cast<TArray<char>*>(InImGuiContext->PlatformIO.Platform_ClipboardUserData);
|
||||||
|
if (ClipboardBuffer)
|
||||||
|
{
|
||||||
|
FString ClipboardText;
|
||||||
|
FPlatformApplicationMisc::ClipboardPaste(ClipboardText);
|
||||||
|
|
||||||
|
ClipboardBuffer->SetNumUninitialized(FPlatformString::ConvertedLength<UTF8CHAR>(*ClipboardText));
|
||||||
|
FPlatformString::Convert(reinterpret_cast<UTF8CHAR*>(ClipboardBuffer->GetData()), ClipboardBuffer->Num(), *ClipboardText, ClipboardText.Len() + 1);
|
||||||
|
|
||||||
|
return ClipboardBuffer->GetData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogImguiContext::ImGui_SetClipboardTextFn(ImGuiContext* InImGuiContext, const char* ClipboardText)
|
||||||
|
{
|
||||||
|
FPlatformApplicationMisc::ClipboardCopy(UTF8_TO_TCHAR(ClipboardText));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool FCogImguiContext::ImGui_OpenInShell(ImGuiContext* Context, const char* Path)
|
||||||
|
{
|
||||||
|
return FPlatformProcess::LaunchFileInDefaultExternalApplication(UTF8_TO_TCHAR(Path));
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
static APlayerController* GetLocalPlayerController(const UWorld* World)
|
static APlayerController* GetLocalPlayerController(const UWorld* World)
|
||||||
{
|
{
|
||||||
@@ -688,7 +724,7 @@ static UPlayerInput* GetPlayerInput(const UWorld* World)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::SetEnableInput(bool Value)
|
void FCogImguiContext::SetEnableInput(bool Value)
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
bEnableInput = Value;
|
bEnableInput = Value;
|
||||||
|
|
||||||
@@ -805,7 +841,7 @@ void FCogImguiContext::SetDPIScale(float Value)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::BuildFont()
|
void FCogImguiContext::BuildFont()
|
||||||
{
|
{
|
||||||
FCogImGuiContextScope ImGuiContextScope(ImGuiContext, PlotContext);
|
FCogImGuiContextScope ImGuiContextScope(Context, PlotContext);
|
||||||
|
|
||||||
if (FontAtlasTexture != nullptr)
|
if (FontAtlasTexture != nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -243,8 +243,14 @@ bool FCogImguiHelper::DragFVector2D(const char* Label, FVector2D& Vector, float
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogImguiHelper::ColorEdit4(const char* Label, FColor& Color, ImGuiColorEditFlags Flags)
|
bool FCogImguiHelper::ColorEdit4(const char* Label, FColor& Color, ImGuiColorEditFlags Flags)
|
||||||
{
|
{
|
||||||
FLinearColor Linear(Color);
|
ImColor c = ToImColor(Color);
|
||||||
const bool Result = ImGui::ColorEdit4(Label, &Linear.R, Flags);
|
const bool Result = ImGui::ColorEdit4(Label, &c.Value.x, Flags);
|
||||||
Color = Linear.ToFColor(true);
|
Color = ToFColor(c);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool FCogImguiHelper::ColorEdit4(const char* Label, FLinearColor& Color, ImGuiColorEditFlags Flags)
|
||||||
|
{
|
||||||
|
return ImGui::ColorEdit4(Label, &Color.R, Flags);
|
||||||
|
}
|
||||||
|
|||||||
@@ -287,17 +287,19 @@ EMouseCursor::Type FCogImguiInputHelper::ToSlateMouseCursor(ImGuiMouseCursor Mou
|
|||||||
{
|
{
|
||||||
switch (MouseCursor)
|
switch (MouseCursor)
|
||||||
{
|
{
|
||||||
case ImGuiMouseCursor_Arrow: return EMouseCursor::Default;
|
case ImGuiMouseCursor_Arrow: return EMouseCursor::Default;
|
||||||
case ImGuiMouseCursor_TextInput: return EMouseCursor::TextEditBeam;
|
case ImGuiMouseCursor_TextInput: return EMouseCursor::TextEditBeam;
|
||||||
case ImGuiMouseCursor_ResizeAll: return EMouseCursor::CardinalCross;
|
case ImGuiMouseCursor_ResizeAll: return EMouseCursor::CardinalCross;
|
||||||
case ImGuiMouseCursor_ResizeNS: return EMouseCursor::ResizeUpDown;
|
case ImGuiMouseCursor_ResizeNS: return EMouseCursor::ResizeUpDown;
|
||||||
case ImGuiMouseCursor_ResizeEW: return EMouseCursor::ResizeLeftRight;
|
case ImGuiMouseCursor_ResizeEW: return EMouseCursor::ResizeLeftRight;
|
||||||
case ImGuiMouseCursor_ResizeNESW: return EMouseCursor::ResizeSouthWest;
|
case ImGuiMouseCursor_ResizeNESW: return EMouseCursor::ResizeSouthWest;
|
||||||
case ImGuiMouseCursor_ResizeNWSE: return EMouseCursor::ResizeSouthEast;
|
case ImGuiMouseCursor_ResizeNWSE: return EMouseCursor::ResizeSouthEast;
|
||||||
|
case ImGuiMouseCursor_Hand: return EMouseCursor::Hand;
|
||||||
|
case ImGuiMouseCursor_NotAllowed: return EMouseCursor::SlashedCircle;
|
||||||
|
|
||||||
case ImGuiMouseCursor_None:
|
case ImGuiMouseCursor_None:
|
||||||
default:
|
default:
|
||||||
return EMouseCursor::None;
|
return EMouseCursor::None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
TSharedPtr<const SCogImguiWidget> GetMainWidget() const { return MainWidget; }
|
TSharedPtr<const SCogImguiWidget> GetMainWidget() const { return MainWidget; }
|
||||||
|
|
||||||
static bool GetIsNetImguiInitialized() { return bIsNetImguiInitialized; }
|
static bool GetIsNetImguiInitialized() { return bIsNetImGuiInitialized; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -127,7 +127,12 @@ private:
|
|||||||
|
|
||||||
static void ImGui_RenderWindow(ImGuiViewport* Viewport, void* Data);
|
static void ImGui_RenderWindow(ImGuiViewport* Viewport, void* Data);
|
||||||
|
|
||||||
UPROPERTY()
|
static const char* ImGui_GetClipboardTextFn(ImGuiContext* InImGuiContext);
|
||||||
|
|
||||||
|
static void ImGui_SetClipboardTextFn(ImGuiContext* InImGuiContext, const char* Arg);
|
||||||
|
|
||||||
|
static bool ImGui_OpenInShell(ImGuiContext* Context, const char* Path);
|
||||||
|
|
||||||
UTexture2D* FontAtlasTexture = nullptr;
|
UTexture2D* FontAtlasTexture = nullptr;
|
||||||
|
|
||||||
TMap<TWeakPtr<SWindow>, ImGuiID> WindowToViewportMap;
|
TMap<TWeakPtr<SWindow>, ImGuiID> WindowToViewportMap;
|
||||||
@@ -144,12 +149,14 @@ private:
|
|||||||
|
|
||||||
TObjectPtr<UGameViewportClient> GameViewport = nullptr;
|
TObjectPtr<UGameViewportClient> GameViewport = nullptr;
|
||||||
|
|
||||||
ImGuiContext* ImGuiContext = nullptr;
|
ImGuiContext* Context = nullptr;
|
||||||
|
|
||||||
ImPlotContext* PlotContext = nullptr;
|
ImPlotContext* PlotContext = nullptr;
|
||||||
|
|
||||||
char IniFilename[512] = {};
|
char IniFilename[512] = {};
|
||||||
|
|
||||||
|
TArray<char> ClipboardBuffer;
|
||||||
|
|
||||||
bool bEnableInput = false;
|
bool bEnableInput = false;
|
||||||
|
|
||||||
bool bShareMouse = false;
|
bool bShareMouse = false;
|
||||||
@@ -174,6 +181,6 @@ private:
|
|||||||
|
|
||||||
bool bSkipRendering = false;
|
bool bSkipRendering = false;
|
||||||
|
|
||||||
static bool bIsNetImguiInitialized;
|
static bool bIsNetImGuiInitialized;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -73,4 +73,6 @@ public:
|
|||||||
static bool DragFVector2D(const char* Label, FVector2D& Vector, float Speed = 1.0f, double Min = 0.0f, double Max = 0.0f, const char* Format = "%.3f", ImGuiSliderFlags Flags = 0);
|
static bool DragFVector2D(const char* Label, FVector2D& Vector, float Speed = 1.0f, double Min = 0.0f, double Max = 0.0f, const char* Format = "%.3f", ImGuiSliderFlags Flags = 0);
|
||||||
|
|
||||||
static bool ColorEdit4(const char* Label, FColor& Color, ImGuiColorEditFlags Flags = 0);
|
static bool ColorEdit4(const char* Label, FColor& Color, ImGuiColorEditFlags Flags = 0);
|
||||||
|
|
||||||
|
static bool ColorEdit4(const char* Label, FLinearColor& Color, ImGuiColorEditFlags Flags = 0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,6 +52,25 @@ bool FCogWindow::CheckEditorVisibility()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindow::RenderMainMenuWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindow::RenderContextMenu()
|
||||||
|
{
|
||||||
|
if (bHasMenu)
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Show Menu", &bShowMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Reset Settings", ImVec2(-1, 0)))
|
||||||
|
{
|
||||||
|
ResetConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogWindow::Render(float DeltaTime)
|
void FCogWindow::Render(float DeltaTime)
|
||||||
{
|
{
|
||||||
@@ -79,16 +98,7 @@ void FCogWindow::Render(float DeltaTime)
|
|||||||
|
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
if (bHasMenu)
|
RenderContextMenu();
|
||||||
{
|
|
||||||
ImGui::Checkbox("Show Menu", &bShowMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("Reset Settings"))
|
|
||||||
{
|
|
||||||
ResetConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +149,6 @@ void FCogWindow::SetSelection(AActor* NewSelection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void FCogWindow::SetIsVisible(const bool Value)
|
void FCogWindow::SetIsVisible(const bool Value)
|
||||||
{
|
{
|
||||||
if (bIsVisible == Value)
|
if (bIsVisible == Value)
|
||||||
@@ -189,9 +198,28 @@ ULocalPlayer* FCogWindow::GetLocalPlayer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
UCogCommonConfig* FCogWindow::GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass) const
|
UCogCommonConfig* FCogWindow::GetConfig(const TSubclassOf<UCogCommonConfig>& InConfigClass, bool InResetConfigOnRequest) const
|
||||||
{
|
{
|
||||||
return GetOwner()->GetConfig(ConfigClass);
|
UCogCommonConfig* Config = GetOwner()->GetConfig(InConfigClass);
|
||||||
|
|
||||||
|
if (Config != nullptr && InResetConfigOnRequest)
|
||||||
|
{
|
||||||
|
ConfigsToResetOnRequest.AddUnique(Config);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Config;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindow::ResetConfig()
|
||||||
|
{
|
||||||
|
for (auto& Config : ConfigsToResetOnRequest)
|
||||||
|
{
|
||||||
|
if (Config != nullptr)
|
||||||
|
{
|
||||||
|
Config->Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -211,3 +239,4 @@ bool FCogWindow::IsWindowRenderedInMainMenu()
|
|||||||
{
|
{
|
||||||
return Owner->IsRenderingMainMenu();
|
return Owner->IsRenderingMainMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ void UCogWindowManager::RenderWidgets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushStyleVarX(ImGuiStyleVar_CellPadding, 0.0f);
|
//ImGui::PushStyleVarX(ImGuiStyleVar_CellPadding, 0.0f);
|
||||||
|
|
||||||
if (ImGui::BeginTable("Widgets", NumColumns, Flags))
|
if (ImGui::BeginTable("Widgets", NumColumns, Flags))
|
||||||
{
|
{
|
||||||
@@ -501,9 +501,14 @@ void UCogWindowManager::RenderWidgets()
|
|||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < Widgets.Num(); ++i)
|
//---------------------------------------------------------------------
|
||||||
|
// Widgets
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
for (int column = 0; column < Widgets.Num(); ++column)
|
||||||
{
|
{
|
||||||
FCogWindow* Window = Widgets[i];
|
ImGui::PushID(column);
|
||||||
|
|
||||||
|
FCogWindow* Window = Widgets[column];
|
||||||
if (Window->GetIsWidgetVisible() == false)
|
if (Window->GetIsWidgetVisible() == false)
|
||||||
{ continue; }
|
{ continue; }
|
||||||
|
|
||||||
@@ -511,17 +516,17 @@ void UCogWindowManager::RenderWidgets()
|
|||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2);
|
||||||
Window->RenderMainMenuWidget();
|
Window->RenderMainMenuWidget();
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AddRightColumn)
|
if (AddRightColumn)
|
||||||
{
|
{
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
//ImGui::PopStyleVar();
|
||||||
ImGui::PopStyleVar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -801,6 +806,9 @@ UCogCommonConfig* UCogWindowManager::GetConfig(const TSubclassOf<UCogCommonConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
UCogCommonConfig* Config = NewObject<UCogCommonConfig>(this, Class);
|
UCogCommonConfig* Config = NewObject<UCogCommonConfig>(this, Class);
|
||||||
|
Config->Reset();
|
||||||
|
Config->ReloadConfig();
|
||||||
|
|
||||||
Configs.Add(Config);
|
Configs.Add(Config);
|
||||||
return Config;
|
return Config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,33 @@ void FCogWindowWidgets::EndTableTooltip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogWindowWidgets::ItemTooltipWrappedText(const char* InText)
|
bool FCogWindowWidgets::BeginItemTooltipWrappedText()
|
||||||
{
|
{
|
||||||
bool result = ImGui::BeginItemTooltip();
|
const bool result = ImGui::BeginItemTooltip();
|
||||||
if (result == false)
|
if (result == false)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
ImGui::TextUnformatted(InText);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindowWidgets::EndItemTooltipWrappedText()
|
||||||
|
{
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool FCogWindowWidgets::ItemTooltipWrappedText(const char* InText)
|
||||||
|
{
|
||||||
|
const bool result = BeginItemTooltipWrappedText();
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(InText);
|
||||||
|
EndItemTooltipWrappedText();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -647,7 +663,7 @@ bool FCogWindowWidgets::MultiChoiceButton(const char* Label, bool IsSelected, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogWindowWidgets::MultiChoiceButtonsInt(TArray<int32>& Values, int32& Value, const ImVec2& Size)
|
bool FCogWindowWidgets::MultiChoiceButtonsInt(TArray<int32>& InValues, int32& InCurrentValue, const ImVec2& InSize, bool InInline)
|
||||||
{
|
{
|
||||||
ImGuiStyle& Style = ImGui::GetStyle();
|
ImGuiStyle& Style = ImGui::GetStyle();
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
||||||
@@ -656,18 +672,18 @@ bool FCogWindowWidgets::MultiChoiceButtonsInt(TArray<int32>& Values, int32& Valu
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
||||||
|
|
||||||
bool IsPressed = false;
|
bool IsPressed = false;
|
||||||
for (int32 i = 0; i < Values.Num(); ++i)
|
for (int32 i = 0; i < InValues.Num(); ++i)
|
||||||
{
|
{
|
||||||
int32 ButtonValue = Values[i];
|
int32 ButtonValue = InValues[i];
|
||||||
|
|
||||||
const auto Text = StringCast<ANSICHAR>(*FString::Printf(TEXT("%d"), ButtonValue));
|
const auto Text = StringCast<ANSICHAR>(*FString::Printf(TEXT("%d"), ButtonValue));
|
||||||
if (MultiChoiceButton(Text.Get(), ButtonValue == Value, Size))
|
if (MultiChoiceButton(Text.Get(), ButtonValue == InCurrentValue, InSize))
|
||||||
{
|
{
|
||||||
IsPressed = true;
|
IsPressed = true;
|
||||||
Value = ButtonValue;
|
InCurrentValue = ButtonValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < Values.Num() - 1)
|
if (InInline && i < InValues.Num() - 1)
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
@@ -680,7 +696,19 @@ bool FCogWindowWidgets::MultiChoiceButtonsInt(TArray<int32>& Values, int32& Valu
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
bool FCogWindowWidgets::MultiChoiceButtonsFloat(TArray<float>& Values, float& Value, const ImVec2& Size)
|
FString FCogWindowWidgets::RemoveFirstZero(const FString& InText)
|
||||||
|
{
|
||||||
|
return InText.Replace(TEXT("0."), TEXT("."));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
FString FCogWindowWidgets::FormatSmallFloat(float InValue)
|
||||||
|
{
|
||||||
|
return RemoveFirstZero(FString::Printf(TEXT("%g"), InValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool FCogWindowWidgets::MultiChoiceButtonsFloat(TArray<float>& InValues, float& InValue, const ImVec2& InSize, bool InInline)
|
||||||
{
|
{
|
||||||
ImGuiStyle& Style = ImGui::GetStyle();
|
ImGuiStyle& Style = ImGui::GetStyle();
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(Style.WindowPadding.x * 0.40f, (float)(int)(Style.WindowPadding.y * 0.60f)));
|
||||||
@@ -689,18 +717,21 @@ bool FCogWindowWidgets::MultiChoiceButtonsFloat(TArray<float>& Values, float& Va
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(255, 255, 255, 180));
|
||||||
|
|
||||||
bool IsPressed = false;
|
bool IsPressed = false;
|
||||||
for (int32 i = 0; i < Values.Num(); ++i)
|
for (int32 i = 0; i < InValues.Num(); ++i)
|
||||||
{
|
{
|
||||||
float ButtonValue = Values[i];
|
float ButtonValue = InValues[i];
|
||||||
|
|
||||||
const auto Text = StringCast<ANSICHAR>(*FString::Printf(TEXT("%g"), ButtonValue).Replace(TEXT("0."), TEXT(".")));
|
const auto Text = StringCast<ANSICHAR>(*FormatSmallFloat(ButtonValue));
|
||||||
if (MultiChoiceButton(Text.Get(), ButtonValue == Value, Size))
|
|
||||||
|
ImGui::PushID(i);
|
||||||
|
if (MultiChoiceButton(Text.Get(), ButtonValue == InValue, InSize))
|
||||||
{
|
{
|
||||||
IsPressed = true;
|
IsPressed = true;
|
||||||
Value = ButtonValue;
|
InValue = ButtonValue;
|
||||||
}
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
if (i < Values.Num() - 1)
|
if (InInline && i < InValues.Num() - 1)
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
@@ -1278,7 +1309,19 @@ bool FCogWindowWidgets::OpenObjectAssetButton(const UObject* InObject, const ImV
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogWindowWidgets::RenderClosebutton(const ImVec2& InPos)
|
void FCogWindowWidgets::FloatArray(const char* InLabel, TArray<float>& InArray, int32 InMaxEntries, const ImVec2& Size)
|
||||||
|
{
|
||||||
|
ScalarArray(InLabel, ImGuiDataType_Float, InArray, InMaxEntries, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindowWidgets::IntArray(const char* InLabel, TArray<int>& InArray, int32 InMaxEntries, const ImVec2& Size)
|
||||||
|
{
|
||||||
|
ScalarArray(InLabel, ImGuiDataType_S32, InArray, InMaxEntries, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogWindowWidgets::RenderCloseButton(const ImVec2& InPos)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
@@ -1294,31 +1337,38 @@ void FCogWindowWidgets::RenderClosebutton(const ImVec2& InPos)
|
|||||||
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
window->DrawList->AddLine(cross_center + ImVec2(+cross_extent, -cross_extent), cross_center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// //--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
// bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
|
bool FCogWindowWidgets::PickButton(const char* InLabel, const ImVec2& InSize, ImGuiButtonFlags InFlags)
|
||||||
// {
|
{
|
||||||
// ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
// ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
// if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
// return false;
|
return false;
|
||||||
//
|
|
||||||
// const ImGuiID id = window->GetID(str_id);
|
const ImGuiID id = window->GetID(InLabel);
|
||||||
// const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + InSize);
|
||||||
// const float default_size = GetFrameHeight();
|
const float default_size = ImGui::GetFrameHeight();
|
||||||
// ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
|
ImGui::ItemSize(InSize, (InSize.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
|
||||||
// if (!ItemAdd(bb, id))
|
if (!ImGui::ItemAdd(bb, id))
|
||||||
// return false;
|
return false;
|
||||||
//
|
|
||||||
// bool hovered, held;
|
bool hovered, held;
|
||||||
// bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, InFlags);
|
||||||
//
|
|
||||||
// // Render
|
// Render
|
||||||
// const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 bg_col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
// const ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
const ImU32 text_col = ImGui::GetColorU32(ImGuiCol_Text);
|
||||||
// RenderNavCursor(bb, id);
|
ImGui::RenderNavCursor(bb, id);
|
||||||
// RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
|
ImGui::RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
|
||||||
// RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
|
|
||||||
//
|
ImVec2 pos = bb.Min + ImVec2(ImMax(0.0f, (InSize.x - g.FontSize) * 0.5f), ImMax(0.0f, (InSize.y - g.FontSize) * 0.5f));
|
||||||
// IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
|
float scale = 1.0f;
|
||||||
// return pressed;
|
|
||||||
// }
|
const float h = window->DrawList->_Data->FontSize * 1.00f;
|
||||||
|
float r = h * 0.40f * scale;
|
||||||
|
ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);
|
||||||
|
window->DrawList->AddCircle(center, r, text_col, 0, 1);
|
||||||
|
window->DrawList->AddCircleFilled(center, r * 0.3f, text_col);
|
||||||
|
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
@@ -49,14 +49,6 @@ void FCogWindow_Settings::PreSaveConfig()
|
|||||||
Config->bShareMouseWithGameplay = Context.GetShareMouseWithGameplay();
|
Config->bShareMouseWithGameplay = Context.GetShareMouseWithGameplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogWindow_Settings::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogWindow_Settings::RenderContent()
|
void FCogWindow_Settings::RenderContent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
virtual void Shutdown() {}
|
virtual void Shutdown() {}
|
||||||
|
|
||||||
virtual void ResetConfig() {}
|
virtual void ResetConfig();
|
||||||
|
|
||||||
virtual void PreSaveConfig() {}
|
virtual void PreSaveConfig() {}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
virtual void GameTick(float DeltaTime);
|
virtual void GameTick(float DeltaTime);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
virtual void RenderMainMenuWidget() {}
|
virtual void RenderMainMenuWidget();
|
||||||
|
|
||||||
ImGuiID GetID() const { return ID; }
|
ImGuiID GetID() const { return ID; }
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ public:
|
|||||||
UCogWindowManager* GetOwner() const { return Owner; }
|
UCogWindowManager* GetOwner() const { return Owner; }
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T* GetConfig() const { return Cast<T>(GetConfig(T::StaticClass())); }
|
T* GetConfig(bool InResetConfigOnRequest = true) const { return Cast<T>(GetConfig(T::StaticClass(), InResetConfigOnRequest)); }
|
||||||
|
|
||||||
UCogCommonConfig* GetConfig(const TSubclassOf<UCogCommonConfig> ConfigClass) const;
|
UCogCommonConfig* GetConfig(const TSubclassOf<UCogCommonConfig>& InConfigClass, bool InResetConfigOnRequest = true) const;
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
const T* GetAsset() const { return Cast<T>(GetAsset(T::StaticClass())); }
|
const T* GetAsset() const { return Cast<T>(GetAsset(T::StaticClass())); }
|
||||||
@@ -100,6 +100,8 @@ protected:
|
|||||||
|
|
||||||
virtual bool CheckEditorVisibility();
|
virtual bool CheckEditorVisibility();
|
||||||
|
|
||||||
|
virtual void RenderContextMenu();
|
||||||
|
|
||||||
virtual void OnWindowVisibilityChanged(bool NewVisibility) { }
|
virtual void OnWindowVisibilityChanged(bool NewVisibility) { }
|
||||||
|
|
||||||
virtual void OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) {}
|
virtual void OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) {}
|
||||||
@@ -141,5 +143,7 @@ protected:
|
|||||||
TWeakObjectPtr<AActor> CurrentSelection;
|
TWeakObjectPtr<AActor> CurrentSelection;
|
||||||
|
|
||||||
TWeakObjectPtr<AActor> OverridenSelection;
|
TWeakObjectPtr<AActor> OverridenSelection;
|
||||||
|
|
||||||
|
mutable TArray<TWeakObjectPtr<UCogCommonConfig>> ConfigsToResetOnRequest;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ public:
|
|||||||
static void EndTableTooltip();
|
static void EndTableTooltip();
|
||||||
|
|
||||||
static bool ItemTooltipWrappedText(const char* InText);
|
static bool ItemTooltipWrappedText(const char* InText);
|
||||||
|
|
||||||
|
static bool BeginItemTooltipWrappedText();
|
||||||
|
|
||||||
|
static void EndItemTooltipWrappedText();
|
||||||
|
|
||||||
static bool BeginItemTableTooltip();
|
static bool BeginItemTableTooltip();
|
||||||
|
|
||||||
@@ -47,9 +51,9 @@ public:
|
|||||||
|
|
||||||
static bool MultiChoiceButton(const char* Label, bool IsSelected, const ImVec2& Size = ImVec2(0, 0));
|
static bool MultiChoiceButton(const char* Label, bool IsSelected, const ImVec2& Size = ImVec2(0, 0));
|
||||||
|
|
||||||
static bool MultiChoiceButtonsInt(TArray<int32>& Values, int32& Value, const ImVec2& Size = ImVec2(0, 0));
|
static bool MultiChoiceButtonsInt(TArray<int32>& Values, int32& Value, const ImVec2& Size = ImVec2(0, 0), bool InInline = true);
|
||||||
|
|
||||||
static bool MultiChoiceButtonsFloat(TArray<float>& Values, float& Value, const ImVec2& Size = ImVec2(0, 0));
|
static bool MultiChoiceButtonsFloat(TArray<float>& InValues, float& InValue, const ImVec2& InSize = ImVec2(0, 0), bool InInline = true);
|
||||||
|
|
||||||
static void SliderWithReset(const char* Name, float* Value, float Min, float Max, const float& ResetValue, const char* Format);
|
static void SliderWithReset(const char* Name, float* Value, float Min, float Max, const float& ResetValue, const char* Format);
|
||||||
|
|
||||||
@@ -135,8 +139,20 @@ public:
|
|||||||
|
|
||||||
static bool OpenObjectAssetButton(const UObject* InObject, const ImVec2& InSize = ImVec2(0, 0));
|
static bool OpenObjectAssetButton(const UObject* InObject, const ImVec2& InSize = ImVec2(0, 0));
|
||||||
|
|
||||||
static void RenderClosebutton(const ImVec2& InPos);
|
static void RenderCloseButton(const ImVec2& InPos);
|
||||||
|
|
||||||
|
static bool PickButton(const char* InLabel, const ImVec2& InSize, ImGuiButtonFlags InFlags = ImGuiButtonFlags_None);
|
||||||
|
|
||||||
|
static FString RemoveFirstZero(const FString& InText);
|
||||||
|
|
||||||
|
static FString FormatSmallFloat(float InValue);
|
||||||
|
|
||||||
|
static void FloatArray(const char* InLabel, TArray<float>& InArray, int32 InMaxEntries = 0, const ImVec2& Size = ImVec2(0, 0));
|
||||||
|
|
||||||
|
static void IntArray(const char* InLabel, TArray<int>& InArray, int32 InMaxEntries = 0, const ImVec2& Size = ImVec2(0, 0));
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static bool ScalarArray(const char* InLabel, ImGuiDataType InDataType, TArray<T>& InArray, int32 InMaxEntries = 0, const ImVec2& Size = ImVec2(0, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename EnumType>
|
template<typename EnumType>
|
||||||
@@ -156,4 +172,44 @@ template<typename EnumType>
|
|||||||
bool FCogWindowWidgets::ComboboxEnum(const char* Label, EnumType& Value)
|
bool FCogWindowWidgets::ComboboxEnum(const char* Label, EnumType& Value)
|
||||||
{
|
{
|
||||||
return ComboboxEnum(Label, Value, Value);
|
return ComboboxEnum(Label, Value, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
bool FCogWindowWidgets::ScalarArray(const char* InLabel, ImGuiDataType InDataType, TArray<T>& InArray, int32 InMaxEntries, const ImVec2& Size)
|
||||||
|
{
|
||||||
|
bool Result = false;
|
||||||
|
ImGui::PushID(InLabel);
|
||||||
|
|
||||||
|
if (ImGui::BeginChild("##Entries", Size, ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY, ImGuiWindowFlags_MenuBar))
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenuBar())
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(InLabel);
|
||||||
|
|
||||||
|
int32 NumEntries = InArray.Num();
|
||||||
|
SetNextItemToShortWidth();
|
||||||
|
if (ImGui::SliderInt("##Size", &NumEntries, 0, InMaxEntries))
|
||||||
|
{
|
||||||
|
InArray.SetNum(NumEntries);
|
||||||
|
Result = true;
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32 i = 0; i < InArray.Num(); i++)
|
||||||
|
{
|
||||||
|
ImGui::PushID(i);
|
||||||
|
ImGui::SetNextItemWidth(-1);
|
||||||
|
if (ImGui::InputScalar("##Entry", InDataType, &InArray[i]))
|
||||||
|
{
|
||||||
|
Result = true;
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
|
return Result;
|
||||||
}
|
}
|
||||||
@@ -30,8 +30,6 @@ protected:
|
|||||||
|
|
||||||
virtual void PreSaveConfig() override;
|
virtual void PreSaveConfig() override;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderShortcut(const char* Label, FCogImGuiKeyInfo& KeyInfo);
|
virtual void RenderShortcut(const char* Label, FCogImGuiKeyInfo& KeyInfo);
|
||||||
|
|
||||||
TObjectPtr<UCogWindowConfig_Settings> Config = nullptr;
|
TObjectPtr<UCogWindowConfig_Settings> Config = nullptr;
|
||||||
|
|||||||
@@ -25,14 +25,6 @@ void FCogAIWindow_Blackboard::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAIWindow_Blackboard::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAIWindow_Blackboard::RenderContent()
|
void FCogAIWindow_Blackboard::RenderContent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -36,14 +36,6 @@ void FCogAbilityWindow_Abilities::RenderHelp()
|
|||||||
, TCHAR_TO_ANSI(*GetNameSafe(Asset.Get())));
|
, TCHAR_TO_ANSI(*GetNameSafe(Asset.Get())));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Abilities::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Abilities::RenderTick(float DeltaTime)
|
void FCogAbilityWindow_Abilities::RenderTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,14 +35,6 @@ void FCogAbilityWindow_Attributes::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Attributes::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Attributes::RenderTick(float DeltaTime)
|
void FCogAbilityWindow_Attributes::RenderTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,15 +38,6 @@ void FCogAbilityWindow_Cheats::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Cheats::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
AlignmentConfig->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Cheats::GameTick(float DeltaTime)
|
void FCogAbilityWindow_Cheats::GameTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,15 +32,6 @@ void FCogAbilityWindow_Effects::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Effects::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
AlignmentConfig->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Effects::RenderTick(float DeltaTime)
|
void FCogAbilityWindow_Effects::RenderTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ void FCogAbilityWindow_Tags::Initialize()
|
|||||||
bNoPadding = true;
|
bNoPadding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Tags::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Tags::RenderHelp()
|
void FCogAbilityWindow_Tags::RenderHelp()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,14 +26,6 @@ void FCogAbilityWindow_Tasks::RenderHelp()
|
|||||||
"This window displays the gameplay tasks. ");
|
"This window displays the gameplay tasks. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogAbilityWindow_Tasks::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogAbilityWindow_Tasks::RenderTick(float DetlaTime)
|
void FCogAbilityWindow_Tasks::RenderTick(float DetlaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderTick(float DeltaTime) override;
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|||||||
@@ -24,11 +24,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderTick(float DeltaTime);
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void GameTick(float DeltaTime);
|
virtual void GameTick(float DeltaTime) override;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
virtual void TryReapplyCheats();
|
virtual void TryReapplyCheats();
|
||||||
|
|
||||||
APawn* GetCheatInstigator();
|
APawn* GetCheatInstigator();
|
||||||
|
|
||||||
virtual bool AddCheat(AActor* ControlledActor, AActor* TargetActor, const FCogAbilityCheat& CheatEffect, bool IsPersistent);
|
virtual bool AddCheat(AActor* ControlledActor, AActor* TargetActor, const FCogAbilityCheat& CheatEffect, bool IsPersistent);
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ protected:
|
|||||||
|
|
||||||
virtual void RenderTick(float DeltaTime) override;
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderEffectsTable();
|
virtual void RenderEffectsTable();
|
||||||
|
|
||||||
virtual void RenderEffectRow(UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected);
|
virtual void RenderEffectRow(UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected);
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ protected:
|
|||||||
|
|
||||||
virtual void GetTagContainer(FGameplayTagContainer& TagContainer) {}
|
virtual void GetTagContainer(FGameplayTagContainer& TagContainer) {}
|
||||||
|
|
||||||
virtual void ResetConfig();
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderTick(float DetlaTime) override;
|
virtual void RenderTick(float DetlaTime) override;
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ void FCogInputWindow_Actions::RenderHelp()
|
|||||||
"It can also be used to inject inputs to help debugging.");
|
"It can also be used to inject inputs to help debugging.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogInputWindow_Actions::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogInputWindow_Actions::RenderContent()
|
void FCogInputWindow_Actions::RenderContent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,17 +29,6 @@ void FCogInputWindow_Gamepad::PreRender(ImGuiWindowFlags& WindowFlags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogInputWindow_Gamepad::ResetConfig()
|
|
||||||
{
|
|
||||||
Super::ResetConfig();
|
|
||||||
|
|
||||||
if (Config != nullptr)
|
|
||||||
{
|
|
||||||
Config->Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogInputWindow_Gamepad::RenderButtonContextMenu(const FKey& Key, FCogInputActionInfo* ActionInfoButton)
|
void FCogInputWindow_Gamepad::RenderButtonContextMenu(const FKey& Key, FCogInputActionInfo* ActionInfoButton)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void RenderHelp() override;
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ResetConfig() override;
|
|
||||||
|
|
||||||
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user