mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Refact editor UI and logger
This commit is contained in:
@@ -132,7 +132,9 @@ void EditorInterface::DrawViewport()
|
||||
ImGui::End();
|
||||
*/
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
if(ImGui::Begin("Viewport"))
|
||||
|
||||
std::string name = ICON_FA_GAMEPAD + std::string(" Scene");
|
||||
if(ImGui::Begin(name.c_str()))
|
||||
{
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
@@ -291,7 +293,8 @@ void EditorInterface::DrawSceneTree()
|
||||
|
||||
if (!scene)
|
||||
return;
|
||||
if (ImGui::Begin("Environnement"))
|
||||
|
||||
if (ImGui::Begin(" Environnement"))
|
||||
{
|
||||
auto env = Engine::GetCurrentScene()->GetEnvironment();
|
||||
if (ImGui::CollapsingHeader("Procedural Sky"))
|
||||
@@ -314,7 +317,9 @@ void EditorInterface::DrawSceneTree()
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
if(ImGui::Begin("Scene"))
|
||||
|
||||
std::string title = ICON_FA_TREE + std::string(" Hierarchy");
|
||||
if(ImGui::Begin(title.c_str()))
|
||||
{
|
||||
// Buttons to add and remove entity.
|
||||
ImGui::BeginChild("Buttons", ImVec2(300, 20), false);
|
||||
@@ -333,10 +338,10 @@ void EditorInterface::DrawSceneTree()
|
||||
// Unselect delted entity.
|
||||
m_SelectedEntity = scene->GetAllEntities().at(0);
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
// Draw a tree of entities.
|
||||
for (Entity e : scene->GetAllEntities())
|
||||
{
|
||||
@@ -482,6 +487,16 @@ void EditorInterface::DrawEntityPropreties()
|
||||
|
||||
if (ImGui::InputText("##ScriptPath", pathBuffer, sizeof(pathBuffer)))
|
||||
path = FileSystem::AbsoluteToRelative(std::string(pathBuffer));
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script"))
|
||||
{
|
||||
char* file = (char*)payload->Data;
|
||||
std::string fullPath = std::string(file, 256);
|
||||
path = FileSystem::AbsoluteToRelative(fullPath);
|
||||
}
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -600,12 +615,26 @@ void EditorInterface::DrawEntityPropreties()
|
||||
{
|
||||
path = std::string(pathBuffer);
|
||||
}
|
||||
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))
|
||||
{
|
||||
char* file = (char*)payload->Data;
|
||||
std::string fullPath = std::string(file, 256);
|
||||
path = FileSystem::AbsoluteToRelative(fullPath);
|
||||
}
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Browse"))
|
||||
{
|
||||
path = FileDialog::OpenFile(".map");
|
||||
}
|
||||
|
||||
|
||||
|
||||
component.Path = path;
|
||||
|
||||
ImGui::Checkbox("Build collisions?", &component.HasCollisions);
|
||||
@@ -800,14 +829,57 @@ void EditorInterface::DrawDirectoryExplorer()
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool LogErrors = true;
|
||||
bool LogWarnings = true;
|
||||
bool LogDebug = true;
|
||||
void EditorInterface::DrawLogger()
|
||||
{
|
||||
if (ImGui::Begin("Logger"))
|
||||
{
|
||||
for (auto l : Logger::GetLogs())
|
||||
{
|
||||
ImGui::TextWrapped(l.c_str());
|
||||
}
|
||||
ImGui::Checkbox("Errors", &LogErrors);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Warning", &LogWarnings);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Debug", &LogDebug);
|
||||
|
||||
//ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
//if (ImGui::BeginChild("Log window", ImGui::GetContentRegionAvail(), false))
|
||||
//{
|
||||
//ImGui::PopStyleVar();
|
||||
ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;
|
||||
|
||||
if (ImGui::BeginTable("LogTable", 3, flags))
|
||||
{
|
||||
ImGui::TableSetupScrollFreeze(0, 1);
|
||||
ImGui::TableSetupColumn("Severity");
|
||||
ImGui::TableSetupColumn("Time");
|
||||
ImGui::TableSetupColumn("Message");
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextColumn();
|
||||
for (auto& l : Logger::GetLogs())
|
||||
{
|
||||
if (l.type == LOG_TYPE::VERBOSE && !LogDebug)
|
||||
continue;
|
||||
if (l.type == LOG_TYPE::WARNING && !LogWarnings)
|
||||
continue;
|
||||
if (l.type == LOG_TYPE::CRITICAL && !LogErrors)
|
||||
continue;
|
||||
ImGui::Text("-");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(l.time.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextWrapped(l.message.c_str());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
|
||||
//ImGui::EndChild();
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
@@ -1010,19 +1082,20 @@ void NewProject()
|
||||
void OpenProject()
|
||||
{
|
||||
// Parse the project and load it.
|
||||
std::string projectPath = "C:/Dev/Nuake/Editor/resources/test.project";//FileDialog::OpenFile(".project");
|
||||
std::string projectPath = FileDialog::OpenFile(".project");
|
||||
|
||||
FileSystem::SetRootDirectory(projectPath + "/../");
|
||||
Ref<Project> project = Project::New();
|
||||
if (!project->Deserialize(FileSystem::ReadFile(projectPath, true)))
|
||||
{
|
||||
Logger::Log("Error loading project: " + projectPath);
|
||||
Logger::Log("Error loading project: " + projectPath, CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
project->FullPath = projectPath;
|
||||
Engine::LoadProject(project);
|
||||
|
||||
|
||||
// Create new interface named test.
|
||||
//userInterface = UI::UserInterface::New("test");
|
||||
|
||||
@@ -1038,7 +1111,7 @@ void OpenScene()
|
||||
|
||||
Ref<Scene> scene = Scene::New();
|
||||
if (!scene->Deserialize(FileSystem::ReadFile(projectPath, true))) {
|
||||
Logger::Log("Error failed loading scene: " + projectPath);
|
||||
Logger::Log("Error failed loading scene: " + projectPath, CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1066,8 +1139,11 @@ void EditorInterface::Draw()
|
||||
NewProject();
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Open a project"))
|
||||
if (ImGui::Button("Open a project")) {
|
||||
OpenProject();
|
||||
filesystem.m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
@@ -1,44 +1,17 @@
|
||||
#include "FileSystemUI.h"
|
||||
|
||||
#include <src/Vendors/imgui/imgui.h>
|
||||
|
||||
#include <src/Vendors/imgui/imgui_internal.h>
|
||||
#include <src/Resource/FontAwesome5.h>
|
||||
#include "src/Scene/Components/ParentComponent.h"
|
||||
#include <src/Rendering/Textures/Texture.h>
|
||||
#include <src/Core/TextureManager.h>
|
||||
#include "EditorInterface.h"
|
||||
|
||||
// TODO: add filetree in same panel
|
||||
void FileSystemUI::Draw()
|
||||
{
|
||||
Ref<Directory> rootDirectory = FileSystem::GetFileTree();
|
||||
if (!rootDirectory)
|
||||
return;
|
||||
if (ImGui::Begin("Tree browser"))
|
||||
{
|
||||
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||
{
|
||||
if (ImGui::Selectable("Set to zero"));
|
||||
if (ImGui::Selectable("Set to PI"));
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + rootDirectory->name).c_str(), base_flags);
|
||||
if (ImGui::IsItemClicked())
|
||||
{
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
if (open)
|
||||
{
|
||||
EditorInterfaceDrawFiletree(rootDirectory);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
}
|
||||
|
||||
void FileSystemUI::DrawDirectoryContent()
|
||||
@@ -54,7 +27,7 @@ void FileSystemUI::EditorInterfaceDrawFiletree(Ref<Directory> dir)
|
||||
{
|
||||
for (auto d : dir->Directories)
|
||||
{
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
bool is_selected = m_CurrentDirectory == d;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
@@ -135,16 +108,27 @@ void FileSystemUI::DrawFile(Ref<File> file)
|
||||
icon = ICON_FA_BROOM;
|
||||
if (file->Type == ".ogg" || file->Type == ".mp3" || file->Type == ".wav" || file->Type == ".flac")
|
||||
icon = ICON_FA_FILE_AUDIO;
|
||||
if (file->Type == ".cpp" || file->Type == ".h" || file->Type == ".cs" || file->Type == ".py" || file->Type == ".lua")
|
||||
if (file->Type == ".wren")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (ImGui::Button(icon, ImVec2(100, 100)))
|
||||
|
||||
std::string fullName = icon + std::string("##") + file->fullPath;
|
||||
if (ImGui::Button(fullName.c_str(), ImVec2(100, 100)))
|
||||
{
|
||||
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||
{
|
||||
if (ImGui::Selectable("Set to zero"));
|
||||
if (ImGui::Selectable("Set to PI"));
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ImGui::BeginDragDropSource())
|
||||
{
|
||||
char pathBuffer[256];
|
||||
std::strncpy(pathBuffer, file->fullPath.c_str(), sizeof(pathBuffer));
|
||||
std::string dragType;
|
||||
if (file->Type == ".wren")
|
||||
dragType = "_Script";
|
||||
else if (file->Type == ".map")
|
||||
dragType = "_Map";
|
||||
ImGui::SetDragDropPayload(dragType.c_str(), (void*)(pathBuffer), sizeof(pathBuffer));
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
}
|
||||
ImGui::Text(file->name.c_str());
|
||||
@@ -152,110 +136,205 @@ void FileSystemUI::DrawFile(Ref<File> file)
|
||||
|
||||
}
|
||||
|
||||
bool Splitter(bool split_vertically, float thickness, float* size1, float* size2, float min_size1, float min_size2, float splitter_long_axis_size = -1.0f)
|
||||
{
|
||||
using namespace ImGui;
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImGuiID id = window->GetID("##Splitter");
|
||||
ImRect bb;
|
||||
bb.Min = window->DC.CursorPos + (split_vertically ? ImVec2(*size1, 0.0f) : ImVec2(0.0f, *size1));
|
||||
bb.Max = bb.Min + CalcItemSize(split_vertically ? ImVec2(thickness, splitter_long_axis_size) : ImVec2(splitter_long_axis_size, thickness), 0.0f, 0.0f);
|
||||
return SplitterBehavior(bb, id, split_vertically ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, min_size1, min_size2, 0.0f);
|
||||
}
|
||||
float h = 200;
|
||||
static float sz1 = 300;
|
||||
static float sz2 = 300;
|
||||
void FileSystemUI::DrawDirectoryExplorer()
|
||||
{
|
||||
if (ImGui::Begin("File browser"))
|
||||
{
|
||||
// Wrapping.
|
||||
int width = ImGui::GetWindowWidth();
|
||||
ImVec2 buttonSize = ImVec2(100, 100);
|
||||
int amount = (width / 100); // -2 because button overflow width + ... button.
|
||||
int i = 1; // current amount of item per row.
|
||||
if (ImGui::BeginTable("ssss", amount))
|
||||
Ref<Directory> rootDirectory = FileSystem::GetFileTree();
|
||||
if (!rootDirectory)
|
||||
return;
|
||||
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
Splitter(true, 4.0f, &sz1, &sz2, 100, 8, avail.y);
|
||||
|
||||
if (ImGui::BeginChild("Tree browser", ImVec2(sz1, avail.y)))
|
||||
{
|
||||
// Button to go up a level.
|
||||
if (m_CurrentDirectory != FileSystem::RootDirectory)
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Button("..", ImVec2(100, 100)))
|
||||
m_CurrentDirectory = m_CurrentDirectory->Parent;
|
||||
ImGui::TableNextColumn();
|
||||
// Increment item per row tracker.
|
||||
i++;
|
||||
}
|
||||
|
||||
// Exit if no current directory.
|
||||
if (!m_CurrentDirectory) {
|
||||
ImGui::EndTable();
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_CurrentDirectory && m_CurrentDirectory->Directories.size() > 0)
|
||||
{
|
||||
for (auto d : m_CurrentDirectory->Directories)
|
||||
{
|
||||
DrawDirectory(d);
|
||||
if (i - 1 % amount != 0)
|
||||
ImGui::TableNextColumn();
|
||||
else
|
||||
ImGui::TableNextRow();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (m_CurrentDirectory && m_CurrentDirectory->Files.size() > 0)
|
||||
{
|
||||
for (auto f : m_CurrentDirectory->Files)
|
||||
{
|
||||
DrawFile(f);
|
||||
if (i - 1 % amount != 0)
|
||||
ImGui::TableNextColumn();
|
||||
else
|
||||
ImGui::TableNextRow();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||
{
|
||||
float value;
|
||||
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
||||
if (ImGui::Selectable("Set to PI")) value = 3.1415f;
|
||||
if (ImGui::Selectable("Set to zero"));
|
||||
if (ImGui::Selectable("Set to PI"));
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::DragFloat("##Value", &value, 0.1f, 0.0f, 0.0f);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
if (ImGui::Button("New Wren script"))
|
||||
{
|
||||
ImGui::OpenPopup("CreateNewFile");
|
||||
|
||||
}
|
||||
if (ImGui::MenuItem("New interface script"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New Scene"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New folder"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New interface"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New stylesheet"))
|
||||
{
|
||||
}
|
||||
if (ImGui::BeginPopup("CreateNewFile"))
|
||||
{
|
||||
static char name[32] = "Label1";
|
||||
char buf[64];
|
||||
sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
|
||||
ImGui::Text("Edit name:");
|
||||
ImGui::InputText("##edit", name, IM_ARRAYSIZE(name));
|
||||
if (ImGui::Button("Close"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
if(ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)))
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected | ImGuiTreeNodeFlags_DefaultOpen;
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + rootDirectory->name).c_str(), base_flags);
|
||||
if (ImGui::IsItemClicked())
|
||||
{
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
if (open)
|
||||
{
|
||||
EditorInterfaceDrawFiletree(rootDirectory);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::SameLine();
|
||||
|
||||
avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
std::vector<Ref<Directory>> paths = std::vector<Ref<Directory>>();
|
||||
|
||||
Ref<Directory> currentParent = m_CurrentDirectory;
|
||||
paths.push_back(m_CurrentDirectory);
|
||||
while (currentParent != nullptr) {
|
||||
paths.push_back(currentParent);
|
||||
currentParent = currentParent->Parent;
|
||||
}
|
||||
|
||||
|
||||
avail = ImGui::GetContentRegionAvail();
|
||||
if (ImGui::BeginChild("Wrapper", avail))
|
||||
{
|
||||
avail.y = 30;
|
||||
if (ImGui::BeginChild("ariane", avail))
|
||||
{
|
||||
for (int i = paths.size() - 1; i > 0; i--) {
|
||||
if (i != paths.size())
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(paths[i]->name.c_str())) {
|
||||
m_CurrentDirectory = paths[i];
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("/");
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
if (ImGui::BeginChild("Content", avail))
|
||||
{
|
||||
// Wrapping.
|
||||
int width = ImGui::GetWindowWidth() * 0.8f;
|
||||
ImVec2 buttonSize = ImVec2(80, 80);
|
||||
int amount = (width / 100); // -2 because button overflow width + ... button.
|
||||
int i = 1; // current amount of item per row.
|
||||
if (ImGui::BeginTable("ssss", amount))
|
||||
{
|
||||
// Button to go up a level.
|
||||
if (m_CurrentDirectory != FileSystem::RootDirectory)
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Button("..", ImVec2(100, 100)))
|
||||
m_CurrentDirectory = m_CurrentDirectory->Parent;
|
||||
ImGui::TableNextColumn();
|
||||
// Increment item per row tracker.
|
||||
i++;
|
||||
}
|
||||
|
||||
// Exit if no current directory.
|
||||
if (!m_CurrentDirectory) {
|
||||
ImGui::EndTable();
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_CurrentDirectory && m_CurrentDirectory->Directories.size() > 0)
|
||||
{
|
||||
for (auto d : m_CurrentDirectory->Directories)
|
||||
{
|
||||
DrawDirectory(d);
|
||||
if (i - 1 % amount != 0)
|
||||
ImGui::TableNextColumn();
|
||||
else
|
||||
ImGui::TableNextRow();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (m_CurrentDirectory && m_CurrentDirectory->Files.size() > 0)
|
||||
{
|
||||
for (auto f : m_CurrentDirectory->Files)
|
||||
{
|
||||
DrawFile(f);
|
||||
if (i - 1 % amount != 0)
|
||||
ImGui::TableNextColumn();
|
||||
else
|
||||
ImGui::TableNextRow();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||
{
|
||||
float value;
|
||||
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
||||
if (ImGui::Selectable("Set to PI")) value = 3.1415f;
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
ImGui::DragFloat("##Value", &value, 0.1f, 0.0f, 0.0f);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
if (ImGui::Button("New Wren script"))
|
||||
{
|
||||
ImGui::OpenPopup("CreateNewFile");
|
||||
|
||||
}
|
||||
if (ImGui::MenuItem("New interface script"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New Scene"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New folder"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New interface"))
|
||||
{
|
||||
}
|
||||
if (ImGui::MenuItem("New stylesheet"))
|
||||
{
|
||||
}
|
||||
if (ImGui::BeginPopup("CreateNewFile"))
|
||||
{
|
||||
static char name[32] = "Label1";
|
||||
char buf[64];
|
||||
sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label
|
||||
|
||||
ImGui::Text("Edit name:");
|
||||
ImGui::InputText("##edit", name, IM_ARRAYSIZE(name));
|
||||
if (ImGui::Button("Close"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)))
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
class FileSystemUI
|
||||
{
|
||||
private:
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
|
||||
|
||||
public:
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
FileSystemUI() {
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
void Draw();
|
||||
void DrawDirectoryContent();
|
||||
void DrawFiletree();
|
||||
|
||||
Reference in New Issue
Block a user