Added ImGuiFileDialog to the project for opening ROMs

This commit is contained in:
scawful
2022-06-08 23:51:21 -04:00
parent 9069d7729f
commit 1fc487c283
5 changed files with 28 additions and 0 deletions

View File

@@ -36,11 +36,25 @@ void Editor::DrawYazeMenu() const {
}
ImGui::EndMenuBar();
}
// display
if (ImGuiFileDialog::Instance()->Display("ChooseFileDlgKey")) {
// action if OK
if (ImGuiFileDialog::Instance()->IsOk()) {
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
}
// close
ImGuiFileDialog::Instance()->Close();
}
}
void Editor::DrawFileMenu() const {
if (ImGui::MenuItem("Open", "Ctrl+O")) {
// TODO: Add the ability to open ALTTP ROM
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM", ".sfc,.smc", ".");
}
if (ImGui::BeginMenu("Open Recent")) {
ImGui::MenuItem("alttp.sfc");

View File

@@ -6,6 +6,7 @@
#include "imgui/backends/imgui_impl_sdl.h"
#include "imgui/backends/imgui_impl_sdlrenderer.h"
#include "imgui/misc/cpp/imgui_stdlib.h"
#include "ImGuiFileDialog/ImGuiFileDialog.h"
namespace yaze {
namespace Application {