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;
#else
mpRunMode = new Editor;
LogGui::GetInstance().SetStickToWindow(false);
LuaConsole::GetInstance().SetStickToWindow(false);
#endif
}

@ -21,13 +21,10 @@ namespace lunarium
OpRes Editor::Initialize()
{
//Core::MainWindow().Hide();
mLogCat = Logger::RegisterCategory("EDITOR");
mpMainPanel = &MainPanel::GetInstance();
mpMainPanel->SetEditor(this);
Core::MainWindow().GetPosition(&sx, &sy);
return OpRes::OK();
}
@ -38,26 +35,7 @@ namespace lunarium
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)

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

@ -20,13 +20,13 @@ namespace lunarium
: Panel(PT_MAIN, true), mpEditor(nullptr), mSetFocus(false)
{
Core::MainWindow().GetFramebufferSize(&mStartWidth, &mStartHeight);
Core::MainWindow().GetPosition(&mStartX, &mStartY);
Core::MainWindow().GetFramebufferSize(&mWidth, &mHeight);
Core::MainWindow().GetPosition(&mX, &mY);
// 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
// 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)
return false;
if (mSetFocus)
{
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();
ImGui::BeginMainMenuBar();
// File
if (ImGui::BeginMenu("File"))
@ -92,7 +79,27 @@ namespace lunarium
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!
Panel::UpdateMetaInfo();

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

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

Loading…
Cancel
Save