Main editor panel now sits on-top of the application window again. But this time the it uses the application window title-bar.

Gui_Panel_Refactor
Joeyrp 4 years ago
parent 4be5aa04b2
commit 7c0eb5a77a

@ -237,6 +237,8 @@ namespace lunarium
return; return;
#else #else
mpRunMode = new Editor; mpRunMode = new Editor;
LogGui::GetInstance().SetStickToWindow(false);
LuaConsole::GetInstance().SetStickToWindow(false);
#endif #endif
} }

@ -21,13 +21,10 @@ namespace lunarium
OpRes Editor::Initialize() OpRes Editor::Initialize()
{ {
//Core::MainWindow().Hide();
mLogCat = Logger::RegisterCategory("EDITOR"); mLogCat = Logger::RegisterCategory("EDITOR");
mpMainPanel = &MainPanel::GetInstance(); mpMainPanel = &MainPanel::GetInstance();
mpMainPanel->SetEditor(this); mpMainPanel->SetEditor(this);
Core::MainWindow().GetPosition(&sx, &sy);
return OpRes::OK(); return OpRes::OK();
} }
@ -38,26 +35,7 @@ namespace lunarium
void Editor::OnTick(double delta) void Editor::OnTick(double delta)
{ {
//int x, y, w, h;
//mpMainPanel->GetPosition(x, y);
// mpMainPanel->GetSize(w, h);
// if (w > 0 && h > 0)
// {
// // NOTE: Should not be able to run in full screen while in editor mode
// // Unless testing the game maybe?
// Core::MainWindow().ChangeDisplayMode(false, x, y, w, h);
// }
// if (x > 0 && y > 0)
// {
// if (sx != x || sy != y)
// {
// Core::MainWindow().Hide();
// mpMainPanel->Focus();
// }
// }
} }
void Editor::OnRender(IGraphics* g) void Editor::OnRender(IGraphics* g)

@ -39,9 +39,6 @@ namespace lunarium
MainPanel* mpMainPanel; MainPanel* mpMainPanel;
std::vector<Panel*> mpPanels; std::vector<Panel*> mpPanels;
// TEST
int sx, sy;
private: // HELPERS private: // HELPERS
void CreatePanels(); void CreatePanels();
}; };

@ -20,13 +20,13 @@ namespace lunarium
: Panel(PT_MAIN, true), mpEditor(nullptr), mSetFocus(false) : Panel(PT_MAIN, true), mpEditor(nullptr), mSetFocus(false)
{ {
Core::MainWindow().GetFramebufferSize(&mStartWidth, &mStartHeight); Core::MainWindow().GetFramebufferSize(&mWidth, &mHeight);
Core::MainWindow().GetPosition(&mStartX, &mStartY); Core::MainWindow().GetPosition(&mX, &mY);
// Make the application window small so that the imgui window will start outside of // Make the application window small so that the imgui window will start outside of
// it's bounds and be detached from it. This prevents the window from disappearing // it's bounds and be detached from it. This prevents the window from disappearing
// and/or losing focus when the application window disappears. // and/or losing focus when the application window disappears.
Core::MainWindow().ChangeDisplayMode(false, mStartX + 10, mStartY + 10, 10, 10); // Core::MainWindow().ChangeDisplayMode(false, mX + 10, mY + 10, 10, 10);
} }
@ -62,20 +62,7 @@ namespace lunarium
if (!mIsOpen) if (!mIsOpen)
return false; return false;
if (mSetFocus) ImGui::BeginMainMenuBar();
{
ImGui::SetNextWindowFocus();
mSetFocus = false;
}
ImGui::SetNextWindowSize(ImVec2(mStartWidth, mStartHeight), ImGuiCond_Appearing);
ImGui::SetNextWindowPos(ImVec2(mStartX, mStartY), ImGuiCond_Appearing);
if (!ImGui::Begin("Lunarium Editor", &mIsOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking))
{
ImGui::End();
return false;
}
ImGui::BeginMenuBar();
// File // File
if (ImGui::BeginMenu("File")) if (ImGui::BeginMenu("File"))
@ -92,7 +79,27 @@ namespace lunarium
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::EndMenuBar(); ImGui::EndMainMenuBar();
if (mSetFocus)
{
ImGui::SetNextWindowFocus();
mSetFocus = false;
}
Core::MainWindow().GetFramebufferSize(&mWidth, &mHeight);
Core::MainWindow().GetPosition(&mX, &mY);
ImGui::SetNextWindowSize(ImVec2(mWidth, mHeight - ImGui::GetFrameHeight()), ImGuiCond_Always);
ImGui::SetNextWindowPos(ImVec2(mX, mY + ImGui::GetFrameHeight()), ImGuiCond_Always);
if (!ImGui::Begin("Lunarium Editor", &mIsOpen, ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_NoMove
| ImGuiWindowFlags_NoTitleBar ))
{
ImGui::End();
return false;
}
// NOTE: Must always update these values! // NOTE: Must always update these values!
Panel::UpdateMetaInfo(); Panel::UpdateMetaInfo();

@ -34,10 +34,10 @@ namespace lunarium
private: private:
Editor* mpEditor; Editor* mpEditor;
int mStartWidth; // int mStartWidth;
int mStartHeight; // int mStartHeight;
int mStartX; // int mStartX;
int mStartY; // int mStartY;
// Menu Items // Menu Items
bool mSetFocus; bool mSetFocus;

@ -59,8 +59,8 @@ namespace lunarium
if (state.Mode == RunMode::MODE_EDITOR) if (state.Mode == RunMode::MODE_EDITOR)
{ {
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); //glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
} }
mpWindow = glfwCreateWindow( state.Display.WindowedSize.Width, state.Display.WindowedSize.Height, "Lunarium", NULL, NULL ); mpWindow = glfwCreateWindow( state.Display.WindowedSize.Width, state.Display.WindowedSize.Height, "Lunarium", NULL, NULL );

Loading…
Cancel
Save