@ -17,11 +17,16 @@ namespace lunarium
{
MainPanel * MainPanel : : mpInstance = nullptr ;
MainPanel : : MainPanel ( )
: Panel ( PT_MAIN , true ) , mpEditor ( nullptr )
: Panel ( PT_MAIN , true ) , mpEditor ( nullptr ) , mSetFocus ( false )
{
Core : : MainWindow ( ) . GetFramebufferSize ( & mStartWidth , & mStartHeight ) ;
Core : : MainWindow ( ) . GetPosition ( & mStartX , & mStartY ) ;
// 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 ) ;
}
@ -47,19 +52,47 @@ namespace lunarium
mpEditor = e ;
}
void MainPanel : : Focus ( )
{
mSetFocus = true ;
}
bool MainPanel : : DoFrame ( )
{
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_DockNodeHost ) )
if ( ! ImGui : : Begin ( " Lunarium Editor " , & mIsOpen , ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_ MenuBar | ImGuiWindowFlags_NoDocking ) )
{
ImGui : : End ( ) ;
return false ;
}
// Logger::Log(mpEditor->GetLogCat(), LogLevel::INFO, "EDITOR WINDOW SHOWING");
ImGui : : BeginMenuBar ( ) ;
// File
if ( ImGui : : BeginMenu ( " File " ) )
{
ImGui : : MenuItem ( " New Project " ) ;
ImGui : : MenuItem ( " Open Project " ) ;
ImGui : : MenuItem ( " Save Project " ) ;
ImGui : : MenuItem ( " Save Project As " ) ;
ImGui : : Separator ( ) ;
if ( ImGui : : MenuItem ( " Exit " ) )
{
Core : : GetInstance ( ) . SignalShutdown ( ) ;
}
ImGui : : EndMenu ( ) ;
}
ImGui : : EndMenuBar ( ) ;
// NOTE: Must always update these values!
Panel : : UpdateMetaInfo ( ) ;