Quake Map Component reflected

This commit is contained in:
WiggleWizard
2024-09-15 00:11:12 +01:00
parent 0dcd383dbb
commit 7846a667a2
4 changed files with 89 additions and 71 deletions

View File

@@ -13,67 +13,67 @@ public:
void Draw(Nuake::Entity entity) override
{
using namespace Nuake;
if (!entity.HasComponent<Nuake::QuakeMapComponent>())
return;
Nuake::QuakeMapComponent& component = entity.GetComponent<Nuake::QuakeMapComponent>();
BeginComponentTable(QUAKEMAP, Nuake::QuakeMapComponent);
{
{
ImGui::Text("Map");
ImGui::TableNextColumn();
std::string path = component.Path;
ImGui::Button(component.Path.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
if (ImGui::BeginDragDropTarget())
{
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))
{
char* file = (char*)payload->Data;
std::string fullPath = std::string(file, 256);
path = Nuake::FileSystem::AbsoluteToRelative(fullPath);
component.Path = path;
}
ImGui::EndDragDropTarget();
}
ImGui::TableNextColumn();
ComponentTableReset(component.Path, "");
}
ImGui::TableNextColumn();
{
ImGui::Text("Collision");
ImGui::TableNextColumn();
ImGui::Checkbox("##Collison", &component.HasCollisions);
ImGui::TableNextColumn();
ComponentTableReset(component.HasCollisions, true);
}
ImGui::TableNextColumn();
{
ImGui::Text("Auto Rebuild");
ImGui::TableNextColumn();
ImGui::Checkbox("##AutoRebuild", &component.AutoRebuild);
ImGui::TableNextColumn();
ComponentTableReset(component.AutoRebuild, false);
}
ImGui::TableNextColumn();
{
ImGui::Text("Build");
ImGui::TableNextColumn();
if (UI::SecondaryButton("Build Geometry"))
{
Nuake::QuakeMapBuilder builder;
builder.BuildQuakeMap(entity, component.HasCollisions);
}
}
}
EndComponentTable();
// using namespace Nuake;
//
// if (!entity.HasComponent<Nuake::QuakeMapComponent>())
// return;
//
// Nuake::QuakeMapComponent& component = entity.GetComponent<Nuake::QuakeMapComponent>();
// BeginComponentTable(QUAKEMAP, Nuake::QuakeMapComponent);
// {
// {
// ImGui::Text("Map");
// ImGui::TableNextColumn();
//
// std::string path = component.Path;
// ImGui::Button(component.Path.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
// if (ImGui::BeginDragDropTarget())
// {
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))
// {
// char* file = (char*)payload->Data;
// std::string fullPath = std::string(file, 256);
// path = Nuake::FileSystem::AbsoluteToRelative(fullPath);
//
// component.Path = path;
// }
// ImGui::EndDragDropTarget();
// }
//
// ImGui::TableNextColumn();
//
// ComponentTableReset(component.Path, "");
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Collision");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##Collison", &component.HasCollisions);
// ImGui::TableNextColumn();
// ComponentTableReset(component.HasCollisions, true);
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Auto Rebuild");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##AutoRebuild", &component.AutoRebuild);
// ImGui::TableNextColumn();
// ComponentTableReset(component.AutoRebuild, false);
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Build");
// ImGui::TableNextColumn();
//
// if (UI::SecondaryButton("Build Geometry"))
// {
// Nuake::QuakeMapBuilder builder;
// builder.BuildQuakeMap(entity, component.HasCollisions);
// }
// }
// }
// EndComponentTable();
}
};