various bug fix, serialization, adding shapes

This commit is contained in:
Erris
2026-03-05 01:22:41 +01:00
parent f45091349e
commit ecf27eae73
8 changed files with 215 additions and 92 deletions

View File

@@ -25,7 +25,8 @@ namespace OpenEngine {
RegisterDrawer<MeshComponent>("Mesh", &MeshOnImGuiRender);
RegisterDrawer<MaterialComponent>("Material", &MaterialOnImGuiRender);
RegisterDrawer<PhysicsBodyComponent>("Physics Body", &BodyOnImGuiRender);
RegisterDrawer<PhysicsShapeComponent>("Physics Shape", &ShapeOnImGuiRender);
RegisterDrawer<SphereShapeComponent>("Sphere Shape", &SphereShapeOnImGuiRender);
RegisterDrawer<BoxShapeComponent>("Box Shape", &BoxShapeOnImGuiRender);
scene = context;
selected_context = {};
@@ -64,9 +65,14 @@ namespace OpenEngine {
selected_context.AddComponent<PhysicsBodyComponent>();
ImGui::CloseCurrentPopup();
}
if (!selected_context.HasComponent<PhysicsShapeComponent>())
if (ImGui::MenuItem("Physics shape")) {
selected_context.AddComponent<PhysicsShapeComponent>();
if (!selected_context.HasComponent<SphereShapeComponent>())
if (ImGui::MenuItem("Sphere shape")) {
selected_context.AddComponent<SphereShapeComponent>();
ImGui::CloseCurrentPopup();
}
if (!selected_context.HasComponent<BoxShapeComponent>())
if (ImGui::MenuItem("Box shape")) {
selected_context.AddComponent<BoxShapeComponent>();
ImGui::CloseCurrentPopup();
}
}