#pragma once #include "ComponentPanel.h" #include #include #include #include class SpritePanel : ComponentPanel { public: SpritePanel() = default; ~SpritePanel() = default; void Draw(Nuake::Entity entity) override { if (!entity.HasComponent()) { return; } auto& component = entity.GetComponent(); BeginComponentTable(SPRITE, Nuake::SpriteComponent); { { ImGui::Text("Sprite"); ImGui::TableNextColumn(); std::string path = component.SpritePath; ImGui::Button(path.empty() ? "Drag image" : component.SpritePath.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)); if (ImGui::BeginDragDropTarget()) { if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Image")) { char* file = (char*)payload->Data; std::string fullPath = std::string(file, 512); path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath)); component.SpritePath = path; component.LoadSprite(); } ImGui::EndDragDropTarget(); } ImGui::TableNextColumn(); ComponentTableReset(component.LockYRotation, false); } ImGui::TableNextColumn(); { ImGui::Text("Billboard"); ImGui::TableNextColumn(); ImGui::Checkbox("##billboard", &component.Billboard); ImGui::TableNextColumn(); ComponentTableReset(component.Billboard, false); } ImGui::TableNextColumn(); { ImGui::Text("Lock Y rotation"); ImGui::TableNextColumn(); ImGui::Checkbox("##lockYRotation", &component.LockYRotation); ImGui::TableNextColumn(); ComponentTableReset(component.LockYRotation, false); } } EndComponentTable(); } };