/****************************************************************************** * File - mainPanel.cpp * Author - Joey Pollack * Date - 2021/11/01 (y/m/d) * Mod Date - 2021/11/01 (y/m/d) * Description - The main window for the editor. ******************************************************************************/ #include "mainPanel.h" #include "../editor.h" #include #include #include namespace lunarium { MainPanel* MainPanel::mpInstance = nullptr; MainPanel::MainPanel() : Panel(PT_MAIN, true), mpEditor(nullptr) { Core::MainWindow().GetFramebufferSize(&mStartWidth, &mStartHeight); Core::MainWindow().GetPosition(&mStartX, &mStartY); } MainPanel& MainPanel::GetInstance() { if (!mpInstance) { mpInstance = new MainPanel; } return *mpInstance; } void MainPanel::FreeInstance() { delete mpInstance; mpInstance = nullptr; } void MainPanel::SetEditor(Editor* e) { mpEditor = e; } bool MainPanel::DoFrame() { if (!mIsOpen) return false; ImGui::SetNextWindowSize(ImVec2(mStartWidth, mStartHeight), ImGuiCond_Appearing); ImGui::SetNextWindowPos(ImVec2(mStartX, mStartY), ImGuiCond_Appearing); if (!ImGui::Begin("Lunarium Editor", &mIsOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_DockNodeHost)) { ImGui::End(); return false; } // Logger::Log(mpEditor->GetLogCat(), LogLevel::INFO, "EDITOR WINDOW SHOWING"); // NOTE: Must always update these values! Panel::UpdateMetaInfo(); ImGui::End(); return true; } }