summaryrefslogtreecommitdiff
path: root/src/editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor.cpp')
-rw-r--r--src/editor.cpp18
1 files changed, 17 insertions, 1 deletions
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() &&