You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
/******************************************************************************
|
|
* 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 <core/core.h>
|
|
#include <dearimgui/imgui.h>
|
|
#include <utils/logger.h>
|
|
|
|
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;
|
|
}
|
|
} |