From 9362a01f6f8b6339944f5ddf8d2f597ca672f56e Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Mon, 3 Feb 2025 00:05:27 +0500 Subject: feat: import package --- src/editor.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/editor.cpp') diff --git a/src/editor.cpp b/src/editor.cpp index 5417a59..6d7e0d6 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -302,10 +302,26 @@ namespace silly::editor { if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("File")) { - if (ImGui::MenuItem("New package")) { + if (ImGui::MenuItem("New")) { createNewPackage(window); } + if (ImGui::MenuItem("Open...")) { + NFD::UniquePath outPath; + + nfdfilteritem_t filterItem[1] = {{"sillypackage text format", "txt"}}; + + nfdresult_t result = NFD::OpenDialog(outPath, filterItem, 1); + if (result == NFD_OKAY) { + this->newFloorState = std::nullopt; + this->newLevelState = std::nullopt; + this->newPackageState = std::nullopt; + this->newTileState = std::nullopt; + std::string path = outPath.get(); + this->package.load(PACKAGE_TXT, path); + } + } + ImGui::Separator(); if (!pkg.get_levels().empty() && -- cgit v1.2.3