void CMainFrame::OnFileOpenProject() { using namespace engine; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); CFileDialog dlg(TRUE, L"gp", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, L"Game Project Files (*.gp)|*.gp||"); if(IDOK != dlg.DoModal()) { return; } ProjectPtr pProject = Project::Instance(); pProject->Close(); CString file = dlg.GetPathName(); if(pProject->Load(file) == false) { MessageBox(L"Fialed to load project.", L"error", MB_ICONERROR); pProject->Close(); return; } util_update_object_view(pProject->Root()); }
void CMainFrame::OnFileNewProject() { using namespace engine; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); if(IDYES != MessageBox(L"All unsaved data will be lost, are you sure?", L"error", MB_YESNO)) { util_update_object_view(Project::Instance()->Root()); return; } CFileDialog dlg(FALSE, L"gp", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, L"Game Project Files (*.gp)|*.gp||"); if(IDOK != dlg.DoModal()) { util_update_object_view(Project::Instance()->Root()); return; } ProjectPtr pProject = Project::Instance(); pProject->Close(); CString file = dlg.GetPathName(); if(pProject->New(file) == false) { MessageBox(L"Fialed to create project, file or directory already exist.", L"error", MB_ICONERROR); pProject->Close(); return; } util_update_object_view(pProject->Root()); //util_output_info(L"Project created."); }