mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Major cleanup.
Moved to namespace Cleanup includes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,43 +4,47 @@
|
||||
#include <src/Vendors/imgui/ImGuizmo.h>
|
||||
#include "src/Core/FileSystem.h"
|
||||
#include "FileSystemUI.h"
|
||||
class Material;
|
||||
|
||||
class EditorInterface
|
||||
{
|
||||
private:
|
||||
FileSystemUI filesystem = FileSystemUI();
|
||||
Entity m_SelectedEntity;
|
||||
bool m_IsEntitySelected = false;
|
||||
bool m_DrawGrid = false;
|
||||
bool m_ShowImGuiDemo = false;
|
||||
bool m_DebugCollisions = false;
|
||||
bool m_ShowOverlay = true;
|
||||
ImGuizmo::OPERATION CurrentOperation = ImGuizmo::TRANSLATE;
|
||||
ImGuizmo::MODE CurrentMode = ImGuizmo::WORLD;
|
||||
Ref<Material> m_SelectedMaterial;
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
|
||||
bool m_IsMaterialSelected = false;
|
||||
|
||||
public:
|
||||
static ImFont* bigIconFont;
|
||||
void BuildFonts();
|
||||
void Init();
|
||||
void Draw();
|
||||
void DrawViewport();
|
||||
void DrawEntityTree(Entity ent);
|
||||
void DrawSceneTree();
|
||||
void DrawEntityPropreties();
|
||||
void DrawGizmos();
|
||||
void DrawFileSystem();
|
||||
void DrawDirectoryExplorer();
|
||||
void DrawLogger();
|
||||
void DrawDirectory(Ref<Directory> directory);
|
||||
bool EntityContainsItself(Entity ent1, Entity ent2);
|
||||
void DrawFile(Ref<File> file);
|
||||
void DrawRessourceWindow();
|
||||
void DrawInit();
|
||||
void EditorInterfaceDrawFiletree(Ref<Directory> dir);
|
||||
void Overlay();
|
||||
};
|
||||
namespace Nuake {
|
||||
class Material;
|
||||
class EditorInterface
|
||||
{
|
||||
private:
|
||||
FileSystemUI filesystem = FileSystemUI();
|
||||
Entity m_SelectedEntity;
|
||||
bool m_IsEntitySelected = false;
|
||||
bool m_DrawGrid = false;
|
||||
bool m_ShowImGuiDemo = false;
|
||||
bool m_DebugCollisions = false;
|
||||
bool m_ShowOverlay = true;
|
||||
ImGuizmo::OPERATION CurrentOperation = ImGuizmo::TRANSLATE;
|
||||
ImGuizmo::MODE CurrentMode = ImGuizmo::WORLD;
|
||||
Ref<Material> m_SelectedMaterial;
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
|
||||
bool m_IsMaterialSelected = false;
|
||||
|
||||
public:
|
||||
static ImFont* bigIconFont;
|
||||
void BuildFonts();
|
||||
void Init();
|
||||
void Draw();
|
||||
void DrawViewport();
|
||||
void DrawEntityTree(Entity ent);
|
||||
void DrawSceneTree();
|
||||
void DrawEntityPropreties();
|
||||
void DrawGizmos();
|
||||
void DrawFileSystem();
|
||||
void DrawDirectoryExplorer();
|
||||
void DrawLogger();
|
||||
void DrawDirectory(Ref<Directory> directory);
|
||||
bool EntityContainsItself(Entity ent1, Entity ent2);
|
||||
void DrawFile(Ref<File> file);
|
||||
void DrawRessourceWindow();
|
||||
void DrawInit();
|
||||
void EditorInterfaceDrawFiletree(Ref<Directory> dir);
|
||||
void Overlay();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,344 +8,339 @@
|
||||
#include <src/Rendering/Textures/Texture.h>
|
||||
#include <src/Core/TextureManager.h>
|
||||
#include "EditorInterface.h"
|
||||
// TODO: add filetree in same panel
|
||||
void FileSystemUI::Draw()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FileSystemUI::DrawDirectoryContent()
|
||||
{
|
||||
}
|
||||
|
||||
void FileSystemUI::DrawFiletree()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FileSystemUI::EditorInterfaceDrawFiletree(Ref<Directory> dir)
|
||||
{
|
||||
for (auto d : dir->Directories)
|
||||
namespace Nuake {
|
||||
// TODO: add filetree in same panel
|
||||
void FileSystemUI::Draw()
|
||||
{
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
bool is_selected = m_CurrentDirectory == d;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
|
||||
if (d->Directories.size() == 0)
|
||||
{
|
||||
base_flags = ImGuiTreeNodeFlags_Leaf;
|
||||
}
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
if (is_selected)
|
||||
icon = ICON_FA_FOLDER_OPEN;
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + d->name).c_str(), base_flags);
|
||||
|
||||
if (ImGui::IsItemClicked())
|
||||
m_CurrentDirectory = d;
|
||||
if (open)
|
||||
{
|
||||
if (d->Directories.size() > 0)
|
||||
EditorInterfaceDrawFiletree(d);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FileSystemUI::DrawDirectory(Ref<Directory> directory)
|
||||
{
|
||||
ImGui::PushFont(EditorInterface::bigIconFont);
|
||||
std::string id = ICON_FA_FOLDER + std::string("##") + directory->name;
|
||||
if (ImGui::Button(id.c_str(), ImVec2(100, 100)))
|
||||
m_CurrentDirectory = directory;
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
void FileSystemUI::DrawDirectoryContent()
|
||||
{
|
||||
if (ImGui::MenuItem("Htest"));
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::Text(directory->name.c_str());
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
bool FileSystemUI::EntityContainsItself(Entity source, Entity target)
|
||||
{
|
||||
ParentComponent& targeParentComponent = target.GetComponent<ParentComponent>();
|
||||
if (!targeParentComponent.HasParent)
|
||||
return false;
|
||||
|
||||
Entity currentParent = target.GetComponent<ParentComponent>().Parent;
|
||||
while (currentParent != source)
|
||||
void FileSystemUI::DrawFiletree()
|
||||
{
|
||||
if (currentParent.GetComponent<ParentComponent>().HasParent)
|
||||
currentParent = currentParent.GetComponent<ParentComponent>().Parent;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (currentParent == source)
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileSystemUI::DrawFile(Ref<File> file)
|
||||
{
|
||||
ImGui::PushFont(EditorInterface::bigIconFont);
|
||||
if (file->Type == ".png" || file->Type == ".jpg")
|
||||
{
|
||||
Ref<Texture> texture = TextureManager::Get()->GetTexture(file->fullPath);
|
||||
ImGui::ImageButton((void*)texture->GetID(), ImVec2(100, 100), ImVec2(0, 1), ImVec2(1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* icon = ICON_FA_FILE;
|
||||
if (file->Type == ".shader")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (file->Type == ".map")
|
||||
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 == ".wren")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (file->Type == ".md3" || file->Type == ".obj")
|
||||
icon = ICON_FA_FILE_IMAGE;
|
||||
|
||||
std::string fullName = icon + std::string("##") + file->fullPath;
|
||||
if (ImGui::Button(fullName.c_str(), ImVec2(100, 100)))
|
||||
void FileSystemUI::EditorInterfaceDrawFiletree(Ref<Directory> dir)
|
||||
{
|
||||
for (auto d : dir->Directories)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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";
|
||||
else if (file->Type == ".obj" || file->Type == ".mdl" || file->Type == ".gltf" || file->Type == ".md3" || file->Type == "fbx")
|
||||
dragType = "_Model";
|
||||
|
||||
ImGui::SetDragDropPayload(dragType.c_str(), (void*)(pathBuffer), sizeof(pathBuffer));
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
}
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
}
|
||||
|
||||
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"))
|
||||
{
|
||||
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)))
|
||||
{
|
||||
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_SpanAvailWidth;
|
||||
|
||||
bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory;
|
||||
bool is_selected = m_CurrentDirectory == d;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected | ImGuiTreeNodeFlags_DefaultOpen;
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + rootDirectory->name).c_str(), base_flags);
|
||||
if (ImGui::IsItemClicked())
|
||||
if (d->Directories.size() == 0)
|
||||
{
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
base_flags = ImGuiTreeNodeFlags_Leaf;
|
||||
}
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
if (is_selected)
|
||||
icon = ICON_FA_FOLDER_OPEN;
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + d->name).c_str(), base_flags);
|
||||
|
||||
if (ImGui::IsItemClicked())
|
||||
m_CurrentDirectory = d;
|
||||
if (open)
|
||||
{
|
||||
EditorInterfaceDrawFiletree(rootDirectory);
|
||||
if (d->Directories.size() > 0)
|
||||
EditorInterfaceDrawFiletree(d);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
}
|
||||
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))
|
||||
|
||||
void FileSystemUI::DrawDirectory(Ref<Directory> directory)
|
||||
{
|
||||
ImGui::PushFont(EditorInterface::bigIconFont);
|
||||
std::string id = ICON_FA_FOLDER + std::string("##") + directory->name;
|
||||
if (ImGui::Button(id.c_str(), ImVec2(100, 100)))
|
||||
m_CurrentDirectory = directory;
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
avail.y = 30;
|
||||
if (ImGui::BeginChild("ariane", avail))
|
||||
if (ImGui::MenuItem("Htest"));
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::Text(directory->name.c_str());
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
bool FileSystemUI::EntityContainsItself(Entity source, Entity target)
|
||||
{
|
||||
ParentComponent& targeParentComponent = target.GetComponent<ParentComponent>();
|
||||
if (!targeParentComponent.HasParent)
|
||||
return false;
|
||||
|
||||
Entity currentParent = target.GetComponent<ParentComponent>().Parent;
|
||||
while (currentParent != source)
|
||||
{
|
||||
if (currentParent.GetComponent<ParentComponent>().HasParent)
|
||||
currentParent = currentParent.GetComponent<ParentComponent>().Parent;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (currentParent == source)
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileSystemUI::DrawFile(Ref<File> file)
|
||||
{
|
||||
ImGui::PushFont(EditorInterface::bigIconFont);
|
||||
if (file->Type == ".png" || file->Type == ".jpg")
|
||||
{
|
||||
Ref<Texture> texture = TextureManager::Get()->GetTexture(file->fullPath);
|
||||
ImGui::ImageButton((void*)texture->GetID(), ImVec2(100, 100), ImVec2(0, 1), ImVec2(1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* icon = ICON_FA_FILE;
|
||||
if (file->Type == ".shader")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (file->Type == ".map")
|
||||
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 == ".wren")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (file->Type == ".md3" || file->Type == ".obj")
|
||||
icon = ICON_FA_FILE_IMAGE;
|
||||
|
||||
std::string fullName = icon + std::string("##") + file->fullPath;
|
||||
if (ImGui::Button(fullName.c_str(), ImVec2(100, 100)))
|
||||
{
|
||||
if (ImGui::Button("Refresh"))
|
||||
FileSystem::Scan();
|
||||
ImGui::SameLine();
|
||||
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("/");
|
||||
|
||||
}
|
||||
|
||||
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";
|
||||
else if (file->Type == ".obj" || file->Type == ".mdl" || file->Type == ".gltf" || file->Type == ".md3" || file->Type == "fbx")
|
||||
dragType = "_Model";
|
||||
|
||||
ImGui::SetDragDropPayload(dragType.c_str(), (void*)(pathBuffer), sizeof(pathBuffer));
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
}
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
}
|
||||
|
||||
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"))
|
||||
{
|
||||
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)))
|
||||
{
|
||||
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_SpanAvailWidth;
|
||||
|
||||
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::EndChild();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::SameLine();
|
||||
|
||||
avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
if (ImGui::BeginChild("Content", avail))
|
||||
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))
|
||||
{
|
||||
// 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))
|
||||
avail.y = 30;
|
||||
if (ImGui::BeginChild("ariane", avail))
|
||||
{
|
||||
// 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++;
|
||||
if (ImGui::Button("Refresh"))
|
||||
FileSystem::Scan();
|
||||
ImGui::SameLine();
|
||||
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("/");
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <src/Core/FileSystem.h>
|
||||
|
||||
#include <src/Scene/Entities/Entity.h>
|
||||
class FileSystemUI
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
public:
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
FileSystemUI() {
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
void Draw();
|
||||
void DrawDirectoryContent();
|
||||
void DrawFiletree();
|
||||
void EditorInterfaceDrawFiletree(Ref<Directory> dir);
|
||||
void DrawDirectory(Ref<Directory> directory);
|
||||
bool EntityContainsItself(Entity source, Entity target);
|
||||
void DrawFile(Ref<File> file);
|
||||
void DrawDirectoryExplorer();
|
||||
};
|
||||
namespace Nuake {
|
||||
class FileSystemUI
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
public:
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
FileSystemUI() {
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
}
|
||||
void Draw();
|
||||
void DrawDirectoryContent();
|
||||
void DrawFiletree();
|
||||
void EditorInterfaceDrawFiletree(Ref<Directory> dir);
|
||||
void DrawDirectory(Ref<Directory> directory);
|
||||
bool EntityContainsItself(Entity source, Entity target);
|
||||
void DrawFile(Ref<File> file);
|
||||
void DrawDirectoryExplorer();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,11 +3,25 @@
|
||||
#include "Engine.h"
|
||||
#include "ImGuiTextHelper.h"
|
||||
|
||||
void ProjectInterface::DrawProjectSettings()
|
||||
{
|
||||
if (ImGui::Begin("Project settings"))
|
||||
{
|
||||
|
||||
namespace Nuake {
|
||||
void ProjectInterface::DrawProjectSettings()
|
||||
{
|
||||
if (ImGui::Begin("Project settings"))
|
||||
{
|
||||
|
||||
char buffer[256];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer));
|
||||
if (ImGui::InputText("##Name", buffer, sizeof(buffer)))
|
||||
{
|
||||
Engine::GetProject()->Name = std::string(buffer);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ProjectInterface::DrawCreatePointEntity()
|
||||
{
|
||||
char buffer[256];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer));
|
||||
@@ -15,242 +29,230 @@ void ProjectInterface::DrawProjectSettings()
|
||||
{
|
||||
Engine::GetProject()->Name = std::string(buffer);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ProjectInterface::DrawCreatePointEntity()
|
||||
{
|
||||
char buffer[256];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer));
|
||||
if (ImGui::InputText("##Name", buffer, sizeof(buffer)))
|
||||
{
|
||||
Engine::GetProject()->Name = std::string(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
FGDPointEntity newEntity;
|
||||
FGDPointEntity newEntity;
|
||||
|
||||
const char* items[] = { "String", "Integer", "Float", "Boolean"};
|
||||
void ProjectInterface::DrawEntitySettings()
|
||||
{
|
||||
if (!m_CurrentProject)
|
||||
return;
|
||||
|
||||
if (ImGui::Begin("Entity definitions"))
|
||||
const char* items[] = { "String", "Integer", "Float", "Boolean" };
|
||||
void ProjectInterface::DrawEntitySettings()
|
||||
{
|
||||
ImGui::Text("This is the entity definition used by trenchbroom. This files allows you to see your entities inside Trenchbroom");
|
||||
|
||||
ImGui::Text("Trenchbroom path:");
|
||||
ImGui::SameLine();
|
||||
ImGuiTextSTD("", m_CurrentProject->TrenchbroomPath);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Browse"))
|
||||
if (!m_CurrentProject)
|
||||
return;
|
||||
|
||||
if (ImGui::Begin("Entity definitions"))
|
||||
{
|
||||
std::string path = FileDialog::OpenFile("*.exe");
|
||||
if (path != "")
|
||||
{
|
||||
path += "/../";
|
||||
m_CurrentProject->TrenchbroomPath = path;
|
||||
}
|
||||
}
|
||||
ImGui::Text("This is the entity definition used by trenchbroom. This files allows you to see your entities inside Trenchbroom");
|
||||
|
||||
Ref<FGDFile> file = Engine::GetProject()->EntityDefinitionsFile;
|
||||
|
||||
auto flags = ImGuiWindowFlags_NoTitleBar;
|
||||
if (ImGui::BeginPopupModal("Create new point entity", NULL, flags))
|
||||
{
|
||||
ImGuiTextSTD("Name", newEntity.Name);
|
||||
ImGuiTextMultiline("Description", newEntity.Description);
|
||||
|
||||
if (ImGui::BeginTable("DictCreate", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
{
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Type");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
int idx = 0;
|
||||
for (auto& p : newEntity.Properties)
|
||||
{
|
||||
ImGuiTextSTD("Name", p.name);
|
||||
ImGui::TableNextColumn();
|
||||
std::string current_item = NULL;
|
||||
if(ImGui::BeginCombo(("TypeSelection" + std::to_string(idx)).c_str(), current_item.c_str()))
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||
{
|
||||
bool is_selected = (p.type == (ClassPropertyType)n); // You can store your selection however you want, outside or inside your objects
|
||||
if (ImGui::Selectable(items[n], is_selected))
|
||||
if (is_selected)
|
||||
{
|
||||
p.type = (ClassPropertyType)n;
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
idx++;
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
if (ImGui::Button("Add new property"))
|
||||
{
|
||||
newEntity.Properties.push_back(ClassProperty());
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::Button("Create");
|
||||
ImGui::Text("Trenchbroom path:");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Cancel"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
|
||||
if (ImGui::Button("Export"))
|
||||
{
|
||||
file->Export();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Save"))
|
||||
{
|
||||
file->Save();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 100));
|
||||
if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Point entities"))
|
||||
ImGuiTextSTD("", m_CurrentProject->TrenchbroomPath);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Browse"))
|
||||
{
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
avail.y *= .8;
|
||||
std::string path = FileDialog::OpenFile("*.exe");
|
||||
if (path != "")
|
||||
{
|
||||
path += "/../";
|
||||
m_CurrentProject->TrenchbroomPath = path;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::BeginChild("table_child", avail, false);
|
||||
if (ImGui::BeginTable("nested1", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
Ref<FGDFile> file = Engine::GetProject()->EntityDefinitionsFile;
|
||||
|
||||
auto flags = ImGuiWindowFlags_NoTitleBar;
|
||||
if (ImGui::BeginPopupModal("Create new point entity", NULL, flags))
|
||||
{
|
||||
ImGuiTextSTD("Name", newEntity.Name);
|
||||
ImGuiTextMultiline("Description", newEntity.Description);
|
||||
|
||||
if (ImGui::BeginTable("DictCreate", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
{
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Desciption");
|
||||
ImGui::TableSetupColumn("Settings");
|
||||
ImGui::TableSetupColumn("Prefab");
|
||||
ImGui::TableSetupColumn("Type");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
for (auto& pE : file->PointEntities)
|
||||
int idx = 0;
|
||||
for (auto& p : newEntity.Properties)
|
||||
{
|
||||
ImGui::Text(pE.Name.c_str());
|
||||
ImGuiTextSTD("Name", p.name);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(pE.Description.c_str());
|
||||
std::string current_item = NULL;
|
||||
if (ImGui::BeginCombo(("TypeSelection" + std::to_string(idx)).c_str(), current_item.c_str()))
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||
{
|
||||
bool is_selected = (p.type == (ClassPropertyType)n); // You can store your selection however you want, outside or inside your objects
|
||||
if (ImGui::Selectable(items[n], is_selected))
|
||||
if (is_selected)
|
||||
{
|
||||
p.type = (ClassPropertyType)n;
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
idx++;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Button("Edit");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(pE.Prefab.c_str());
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Browse");
|
||||
}
|
||||
if (ImGui::Button("Add new property"))
|
||||
{
|
||||
newEntity.Properties.push_back(ClassProperty());
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
|
||||
ImGui::Button("Create");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Cancel"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Brush entities"))
|
||||
|
||||
if (ImGui::Button("Export"))
|
||||
{
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
avail.y *= .8;
|
||||
ImGui::BeginChild("table_child", avail, false);
|
||||
if (ImGui::BeginTable("nested1", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
file->Export();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Save"))
|
||||
{
|
||||
file->Save();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 100));
|
||||
if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Point entities"))
|
||||
{
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Desciption");
|
||||
ImGui::TableSetupColumn("Settings");
|
||||
ImGui::TableSetupColumn("Script");
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
avail.y *= .8;
|
||||
|
||||
int i = 0;
|
||||
for (auto& pE : file->BrushEntities)
|
||||
ImGui::BeginChild("table_child", avail, false);
|
||||
if (ImGui::BeginTable("nested1", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
{
|
||||
ImGuiTextSTD("##Name" + std::to_string(i), pE.Name);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Desciption");
|
||||
ImGui::TableSetupColumn("Settings");
|
||||
ImGui::TableSetupColumn("Prefab");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
ImGuiTextSTD("Desc" + std::to_string(i), pE.Description);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Checkbox(std::string("Visible##" + std::to_string(i)).c_str(), &pE.Visible);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(std::string("Solid##" + std::to_string(i)).c_str(), &pE.Solid);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(std::string("Trigger##" + std::to_string(i)).c_str(), &pE.IsTrigger);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiTextSTD("Script##" + std::to_string(i), pE.Script);
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
for (auto& pE : file->PointEntities)
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script"))
|
||||
ImGui::Text(pE.Name.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(pE.Description.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Button("Edit");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(pE.Prefab.c_str());
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Browse");
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Brush entities"))
|
||||
{
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
avail.y *= .8;
|
||||
ImGui::BeginChild("table_child", avail, false);
|
||||
if (ImGui::BeginTable("nested1", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||
{
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Desciption");
|
||||
ImGui::TableSetupColumn("Settings");
|
||||
ImGui::TableSetupColumn("Script");
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
int i = 0;
|
||||
for (auto& pE : file->BrushEntities)
|
||||
{
|
||||
ImGuiTextSTD("##Name" + std::to_string(i), pE.Name);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiTextSTD("Desc" + std::to_string(i), pE.Description);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Checkbox(std::string("Visible##" + std::to_string(i)).c_str(), &pE.Visible);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(std::string("Solid##" + std::to_string(i)).c_str(), &pE.Solid);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(std::string("Trigger##" + std::to_string(i)).c_str(), &pE.IsTrigger);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiTextSTD("Script##" + std::to_string(i), pE.Script);
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
{
|
||||
char* file = (char*)payload->Data;
|
||||
std::string fullPath = std::string(file, 256);
|
||||
pE.Script = FileSystem::AbsoluteToRelative(fullPath);
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script"))
|
||||
{
|
||||
char* file = (char*)payload->Data;
|
||||
std::string fullPath = std::string(file, 256);
|
||||
pE.Script = FileSystem::AbsoluteToRelative(fullPath);
|
||||
}
|
||||
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
ImGuiTextSTD("Class##" + std::to_string(i), pE.Class);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::EndTable();
|
||||
|
||||
if (ImGui::BeginPopupModal("CreateBrush", NULL, flags))
|
||||
{
|
||||
ImGuiTextSTD("Name", newEntity.Name);
|
||||
ImGuiTextMultiline("Description", newEntity.Description);
|
||||
|
||||
bool isSolid = true;
|
||||
bool isTrigger = false;
|
||||
bool isVisible = true;
|
||||
ImGui::Checkbox("Is Solid", &isSolid);
|
||||
ImGui::Checkbox("Is Trigger", &isTrigger);
|
||||
ImGui::Checkbox("Is Visible", &isVisible);
|
||||
|
||||
if (ImGui::Button("Create"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ImGui::EndDragDropTarget();
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Cancel"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGuiTextSTD("Class##" + std::to_string(i), pE.Class);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::EndTable();
|
||||
|
||||
if (ImGui::BeginPopupModal("CreateBrush", NULL, flags))
|
||||
{
|
||||
ImGuiTextSTD("Name", newEntity.Name);
|
||||
ImGuiTextMultiline("Description", newEntity.Description);
|
||||
|
||||
bool isSolid = true;
|
||||
bool isTrigger = false;
|
||||
bool isVisible = true;
|
||||
ImGui::Checkbox("Is Solid", &isSolid);
|
||||
ImGui::Checkbox("Is Trigger", &isTrigger);
|
||||
ImGui::Checkbox("Is Visible", &isVisible);
|
||||
|
||||
if (ImGui::Button("Create"))
|
||||
if (ImGui::Button("Add new"))
|
||||
{
|
||||
|
||||
file->BrushEntities.push_back(FGDBrushEntity("New brush"));
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Cancel"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Add new"))
|
||||
{
|
||||
file->BrushEntities.push_back(FGDBrushEntity("New brush"));
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
#include "src/Core/Core.h"
|
||||
#include "src/Resource/Project.h"
|
||||
|
||||
namespace Nuake {
|
||||
class ProjectInterface
|
||||
{
|
||||
public:
|
||||
Ref<Project> m_CurrentProject;
|
||||
|
||||
class ProjectInterface
|
||||
{
|
||||
public:
|
||||
Ref<Project> m_CurrentProject;
|
||||
|
||||
|
||||
void DrawProjectSettings();
|
||||
|
||||
void DrawCreatePointEntity();
|
||||
void DrawEntitySettings();
|
||||
|
||||
|
||||
};
|
||||
void DrawProjectSettings();
|
||||
void DrawCreatePointEntity();
|
||||
void DrawEntitySettings();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user