2
3
4
5
10#include "Systems/SlateSystem.h"
11#include "World/World/World.h"
12#include "World/Entity.h"
13#include "Core/Library/ProcessLibrary.h"
17 void ImguiFloatingInfo::OnRender()
21 const ImVec2 work_pos = m_Owner->GetPanelPos();
22 const ImVec2 work_size = m_Owner->GetPanelSize();
24 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(4.0f, 4.0f));
25 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg));
27 static int location = 1;
28 const ImGuiIO& io = ImGui::GetIO();
29 ImGuiWindowFlags window_flags =
30 ImGuiWindowFlags_NoDecoration |
31 ImGuiWindowFlags_NoDocking |
32 ImGuiWindowFlags_AlwaysAutoResize |
33 ImGuiWindowFlags_NoSavedSettings |
34 ImGuiWindowFlags_NoFocusOnAppearing |
35 ImGuiWindowFlags_NoNav |
36 ImGuiWindowFlags_NoTitleBar;
40 const float PAD = ImGui::GetStyle().WindowPadding.x;
42 ImVec2 window_pos, window_pos_pivot;
43 window_pos.x = (location & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD);
44 window_pos.y = (location & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD + ImGuiH::GetLineItemSize().x * 1.5f + 2.0f + ImGui::GetStyle().WindowPadding.y);
45 window_pos_pivot.x = (location & 1) ? 1.0f : 0.0f;
46 window_pos_pivot.y = (location & 2) ? 1.0f : 0.0f;
48 ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
50 window_flags |= ImGuiWindowFlags_NoMove;
52 else if (location == -2)
55 ImGui::SetNextWindowPos(work_pos + work_size * 0.5, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
56 window_flags |= ImGuiWindowFlags_NoMove;
59 ImGui::SetNextWindowBgAlpha(0.7f);
64 if (ImGui::Begin(ss.str().c_str(), &open, window_flags))
66 ImGui::Text(
"FPS: %.2f | Frame time: %.2f ms", io.Framerate, 1000.0f / io.Framerate);
67 ImGui::Text(
"ViewPort Size: ( %d, %d )", (
int)work_size.x, (
int)work_size.y);
69 if (ImGui::IsMousePosValid())
71 ImGui::Text(
"Mouse Position: ( %d, %d )", (
int)io.MousePos.x, (
int)io.MousePos.y);
75 ImGui::Text(
"Mouse Position: <invalid>");
79 ImGui::Text(
"Memory in Used: %.2f GB", size);
81 if (ImGui::BeginPopupContextWindow())
83 if (ImGui::MenuItem(
"Custom", NULL, location == -1)) location = -1;
84 if (ImGui::MenuItem(
"Center", NULL, location == -2)) location = -2;
85 if (ImGui::MenuItem(
"Top-left", NULL, location == 0)) location = 0;
86 if (ImGui::MenuItem(
"Top-right", NULL, location == 1)) location = 1;
87 if (ImGui::MenuItem(
"Bottom-left", NULL, location == 2)) location = 2;
88 if (ImGui::MenuItem(
"Bottom-right", NULL, location == 3)) location = 3;
89 if (open && ImGui::MenuItem(
"Close")) open =
false;
94 ImGui::PopStyleColor();
#define SPICES_PROFILE_ZONE
std::string m_PanelName
This slate's name.
const std::string & GetName() const
Get this panel Name.
static float ProcessMemoryInUsed()
Get this Process Memory used( GB ).
Process Static Function Library.