Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FrostEd.h"
- #include "Modules/ModuleManager.h"
- #include "Logging/LogMacros.h"
- #include "Windows/WindowsApplication.h"
- #include "HierarchyModule.h"
- #include "imgui.h"
- void FFrostEd::Initialize()
- {
- FROST_LOG_INFO("Initializing FrostEd...");
- // Editor initialization
- // ...
- FHierarchyModule& HierarchyModule = FModuleManager::Get().LoadModule<FHierarchyModule>("Hierarchy");
- FWindowsApplication::Get()->GetLayerStack()->PushOverlay(new FFrostEd());
- FROST_LOG_INFO("Initialized FrostEd!");
- }
- void FFrostEd::OnAttach()
- {
- // Setup the editor
- // ...
- }
- void FFrostEd::OnImGuiRender()
- {
- static bool OptFullscreen = true;
- static bool OptPadding = false;
- static ImGuiDockNodeFlags DockspaceFlags = ImGuiDockNodeFlags_None;
- ImGuiWindowFlags WindowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
- if (OptFullscreen)
- {
- const ImGuiViewport* Viewport = ImGui::GetMainViewport();
- ImGui::SetNextWindowPos(Viewport->WorkPos);
- ImGui::SetNextWindowSize(Viewport->WorkSize);
- ImGui::SetNextWindowViewport(Viewport->ID);
- ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
- ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
- WindowFlags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
- WindowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
- }
- else
- {
- DockspaceFlags &= ~ImGuiDockNodeFlags_PassthruCentralNode;
- }
- if (DockspaceFlags & ImGuiDockNodeFlags_PassthruCentralNode)
- {
- WindowFlags |= ImGuiWindowFlags_NoBackground;
- }
- if (!OptPadding)
- {
- ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
- }
- ImGui::Begin("FrostEd", (bool*)true, WindowFlags);
- if (!OptPadding)
- {
- ImGui::PopStyleVar();
- }
- if (OptFullscreen)
- {
- ImGui::PopStyleVar(2);
- }
- ImGuiIO& IO = ImGui::GetIO();
- if (IO.ConfigFlags & ImGuiConfigFlags_DockingEnable)
- {
- ImGuiID DockspaceID = ImGui::GetID("FrostEd");
- ImGui::DockSpace(DockspaceID, ImVec2(0.0f, 0.0f), DockspaceFlags);
- }
- // Render the editor
- // ...
- ImGui::End();
- }
- void FFrostEd::OnDetach()
- {
- // Cleanup the editor
- // ...
- FModuleManager::Get().UnloadModule("Hierarchy");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement