mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-04 22:58:45 +00:00
remove generated files
This commit is contained in:
@@ -1,102 +0,0 @@
|
|||||||
#include "CogWindow_Settings.h"
|
|
||||||
|
|
||||||
#include "CogImguiModule.h"
|
|
||||||
#include "InputCoreTypes.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
UCogWindow_Settings::UCogWindow_Settings()
|
|
||||||
{
|
|
||||||
bHasMenu = false;
|
|
||||||
ToggleInputKey.Key = EKeys::Tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow_Settings::PostInitProperties()
|
|
||||||
{
|
|
||||||
Super::PostInitProperties();
|
|
||||||
|
|
||||||
if (ToggleInputKey.Key != EKeys::Invalid)
|
|
||||||
{
|
|
||||||
FCogImguiModule::Get().SetToggleInputKey(ToggleInputKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow_Settings::RenderContent()
|
|
||||||
{
|
|
||||||
ImGui::Checkbox("Compact Mode", &GetOwner()->bCompactMode);
|
|
||||||
|
|
||||||
ImGui::Checkbox("Show Windows In Main Menu", &GetOwner()->bShowWindowsInMainMenu);
|
|
||||||
|
|
||||||
ImGui::Checkbox("Show Window Help", &GetOwner()->bShowHelp);
|
|
||||||
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
ImGui::SliderFloat("DPI Scale", &GetOwner()->DPIScale, 0.5f, 2.0f, "%.1f");
|
|
||||||
if (ImGui::IsItemDeactivatedAfterEdit())
|
|
||||||
{
|
|
||||||
GetOwner()->bRefreshDPIScale = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::TextUnformatted("Change DPi Scale [Mouse Wheel]");
|
|
||||||
ImGui::TextUnformatted("Reset DPi Scale [Middle Mouse]");
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
ImGui::Text("Toggle Input Key");
|
|
||||||
|
|
||||||
TArray<FKey> Keys;
|
|
||||||
EKeys::GetAllKeys(Keys);
|
|
||||||
|
|
||||||
bool HasKeyChanged = false;
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
if (ImGui::BeginCombo("Key", TCHAR_TO_ANSI(*ToggleInputKey.Key.ToString())))
|
|
||||||
{
|
|
||||||
for (int32 i = 0; i < Keys.Num(); ++i)
|
|
||||||
{
|
|
||||||
const FKey Key = Keys[i];
|
|
||||||
if (Key.IsDigital() == false || Key.IsDeprecated())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsSelected = ToggleInputKey.Key == Key;
|
|
||||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*Key.ToString()), IsSelected))
|
|
||||||
{
|
|
||||||
ToggleInputKey.Key = Key;
|
|
||||||
HasKeyChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
HasKeyChanged |= FCogWindowWidgets::ComboboxEnum("Ctrl", ToggleInputKey.Ctrl);
|
|
||||||
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
HasKeyChanged |= FCogWindowWidgets::ComboboxEnum("Shift", ToggleInputKey.Shift);
|
|
||||||
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
HasKeyChanged |= FCogWindowWidgets::ComboboxEnum("Alt", ToggleInputKey.Alt);
|
|
||||||
|
|
||||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
|
||||||
HasKeyChanged |= FCogWindowWidgets::ComboboxEnum("Cmd", ToggleInputKey.Cmd);
|
|
||||||
|
|
||||||
if (HasKeyChanged)
|
|
||||||
{
|
|
||||||
FCogImguiModule::Get().SetToggleInputKey(ToggleInputKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
|
||||||
ImGui::Spacing();
|
|
||||||
if (ImGui::Button("Reset All Windows Config"))
|
|
||||||
{
|
|
||||||
GetOwner()->ResetAllWindowsConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
#include "CogWindow.h"
|
|
||||||
|
|
||||||
#include "CogDebugDraw.h"
|
|
||||||
#include "CogDebugSettings.h"
|
|
||||||
#include "CogWindowManager.h"
|
|
||||||
#include "CogWindowWidgets.h"
|
|
||||||
#include "Engine/World.h"
|
|
||||||
#include "imgui_internal.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::SetFullName(const FString& InFullName)
|
|
||||||
{
|
|
||||||
FullName = InFullName;
|
|
||||||
|
|
||||||
TArray<FString> Path;
|
|
||||||
int CharIndex = 0;
|
|
||||||
if (FullName.FindLastChar(TEXT('.'), CharIndex))
|
|
||||||
{
|
|
||||||
Name = FullName.RightChop(CharIndex + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Name = FullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
ID = ImHashStr(TCHAR_TO_ANSI(*FullName));
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool UCogWindow::CheckEditorVisibility()
|
|
||||||
{
|
|
||||||
const UWorld* World = GetWorld();
|
|
||||||
if (World == nullptr)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (World->WorldType != EWorldType::Game)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (World->WorldType == EWorldType::PIE)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::Render(float DeltaTime)
|
|
||||||
{
|
|
||||||
ImGuiWindowFlags WindowFlags = 0;
|
|
||||||
PreRender(WindowFlags);
|
|
||||||
|
|
||||||
const FString WindowTitle = GetTitle() + "##" + Name;
|
|
||||||
|
|
||||||
if (bHasMenu && bHideMenu == false)
|
|
||||||
{
|
|
||||||
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Begin(TCHAR_TO_ANSI(*WindowTitle), &bIsVisible, WindowFlags))
|
|
||||||
{
|
|
||||||
if (Owner->GetShowHelp())
|
|
||||||
{
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, IM_COL32(29, 42, 62, 240));
|
|
||||||
const float HelpWidth = FCogWindowWidgets::GetFontWidth() * 80;
|
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(HelpWidth / 2.0f, 0.0f),
|
|
||||||
ImVec2(HelpWidth, FLT_MAX));
|
|
||||||
if (ImGui::BeginTooltip())
|
|
||||||
{
|
|
||||||
ImGui::PushTextWrapPos(HelpWidth - 1 * FCogWindowWidgets::GetFontWidth());
|
|
||||||
RenderHelp();
|
|
||||||
ImGui::PopTextWrapPos();
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextWindow())
|
|
||||||
{
|
|
||||||
if (bHasMenu)
|
|
||||||
{
|
|
||||||
ImGui::Checkbox("Hide Menu", &bHideMenu);
|
|
||||||
|
|
||||||
if (ImGui::Button("Reset"))
|
|
||||||
{
|
|
||||||
ResetConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderContent();
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
PostRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::RenderHelp()
|
|
||||||
{
|
|
||||||
ImGui::Text("No help available.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::RenderTick(float DeltaTime)
|
|
||||||
{
|
|
||||||
SetSelection(FCogDebugSettings::GetSelection());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::GameTick(float DeltaTime)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void UCogWindow::SetSelection(AActor* NewSelection)
|
|
||||||
{
|
|
||||||
if (CurrentSelection == NewSelection)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AActor* OldActor = CurrentSelection.Get();
|
|
||||||
|
|
||||||
CurrentSelection = NewSelection;
|
|
||||||
OnSelectionChanged(OldActor, NewSelection);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
APawn* UCogWindow::GetLocalPlayerPawn()
|
|
||||||
{
|
|
||||||
APlayerController* LocalPlayerController = GetLocalPlayerController();
|
|
||||||
|
|
||||||
if (LocalPlayerController == nullptr)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
APawn* Pawn = LocalPlayerController->GetPawn();
|
|
||||||
|
|
||||||
return Pawn;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
APlayerController* UCogWindow::GetLocalPlayerController()
|
|
||||||
{
|
|
||||||
ULocalPlayer* LocalPlayer = GetLocalPlayer();
|
|
||||||
if (LocalPlayer == nullptr)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LocalPlayer->PlayerController;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
ULocalPlayer* UCogWindow::GetLocalPlayer()
|
|
||||||
{
|
|
||||||
const UWorld* World = GetWorld();
|
|
||||||
if (World == nullptr)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return World->GetFirstLocalPlayerFromController();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user