mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Trenchbroom parser work with entities
Fixed lighting Fixed global position system Fixed child deletion system. editor work for custom entities registration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "ProjectInterface.h"
|
||||
#include <src/Vendors/imgui/imgui.h>
|
||||
#include "Engine.h"
|
||||
#include "ImGuiTextHelper.h"
|
||||
|
||||
void ProjectInterface::DrawProjectSettings()
|
||||
{
|
||||
@@ -20,6 +21,7 @@ void ProjectInterface::DrawProjectSettings()
|
||||
|
||||
void ProjectInterface::DrawCreatePointEntity()
|
||||
{
|
||||
|
||||
char buffer[256];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer));
|
||||
@@ -30,32 +32,81 @@ void ProjectInterface::DrawCreatePointEntity()
|
||||
}
|
||||
|
||||
|
||||
FGDPointEntity newEntity;
|
||||
|
||||
const char* items[] = { "String", "Integer", "Float", "Boolean"};
|
||||
void ProjectInterface::DrawEntitySettings()
|
||||
{
|
||||
if (ImGui::Begin("Entity definitions"))
|
||||
{
|
||||
ImGui::Text("This is the entity definition used by trenchbroom. This files allows you to see your entities inside Trenchbroom");
|
||||
ImGui::Text("Trenchbroom path:");
|
||||
// path here...
|
||||
|
||||
Ref<FGDFile> file = Engine::GetProject()->EntityDefinitionsFile;
|
||||
|
||||
|
||||
|
||||
auto flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize;
|
||||
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::SameLine();
|
||||
ImGui::Button("Cancel");
|
||||
if (ImGui::Button("Cancel"))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 100));
|
||||
if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Point 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");
|
||||
@@ -78,10 +129,10 @@ void ProjectInterface::DrawEntitySettings()
|
||||
ImGui::Button("Browse");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ImGui::EndTable();
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Brush entities"))
|
||||
@@ -91,9 +142,11 @@ void ProjectInterface::DrawEntitySettings()
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
if (ImGui::Button("Add new"))
|
||||
ImGui::OpenPopup("Create new point entity");
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
Reference in New Issue
Block a user