| 2282 | } |
| 2283 | |
| 2284 | void EditorInterface::DrawMenuBar() |
| 2285 | { |
| 2286 | const ImRect menuBarRect = { ImGui::GetCursorPos(), { ImGui::GetContentRegionAvail().x + ImGui::GetCursorScreenPos().x, ImGui::GetFrameHeightWithSpacing() } }; |
| 2287 | ImGui::BeginGroup(); |
| 2288 | |
| 2289 | if (BeginMenubar(menuBarRect)) |
| 2290 | { |
| 2291 | if (ImGui::BeginMenu("File")) |
| 2292 | { |
| 2293 | if (ImGui::MenuItem("New project", "CTRL+N")) |
| 2294 | { |
| 2295 | NewProject(); |
| 2296 | |
| 2297 | Selection = EditorSelection(); |
| 2298 | } |
| 2299 | if (ImGui::MenuItem("Open...")) |
| 2300 | { |
| 2301 | OpenProject(); |
| 2302 | |
| 2303 | Selection = EditorSelection(); |
| 2304 | } |
| 2305 | if (ImGui::MenuItem("Save Project", "CTRL+S")) |
| 2306 | { |
| 2307 | PushCommand(SaveProjectCommand(Engine::GetProject())); |
| 2308 | |
| 2309 | Selection = EditorSelection(); |
| 2310 | |
| 2311 | SetStatusMessage("Project saved."); |
| 2312 | |
| 2313 | } |
| 2314 | if (ImGui::MenuItem("Save Project as...", "CTRL+SHIFT+S")) |
| 2315 | { |
| 2316 | std::string savePath = FileDialog::SaveFile("*.project"); |
| 2317 | Engine::GetProject()->SaveAs(savePath); |
| 2318 | |
| 2319 | Selection = EditorSelection(); |
| 2320 | } |
| 2321 | ImGui::Separator(); |
| 2322 | if (ImGui::MenuItem("Set Scene As Default")) |
| 2323 | { |
| 2324 | Engine::GetProject()->DefaultScene = Engine::GetCurrentScene(); |
| 2325 | SetStatusMessage("Current scene set as project default."); |
| 2326 | } |
| 2327 | ImGui::Separator(); |
| 2328 | if (ImGui::MenuItem("New Scene")) |
| 2329 | { |
| 2330 | Ref<Scene> newScene = Scene::New(); |
| 2331 | |
| 2332 | OpenSceneWindow(newScene); |
| 2333 | |
| 2334 | Selection = EditorSelection(); |
| 2335 | SetStatusMessage("New scene created."); |
| 2336 | } |
| 2337 | if (ImGui::MenuItem("Open Scene...", "CTRL+O")) |
| 2338 | { |
| 2339 | OpenScene(); |
| 2340 | Selection = EditorSelection(); |
| 2341 | } |
nothing calls this directly
no test coverage detected