54 lines
1.4 KiB
ActionScript
54 lines
1.4 KiB
ActionScript
class AddComponentRender {
|
|
Entity entity;
|
|
|
|
AddComponentRender(Entity _entity) {
|
|
entity = _entity;
|
|
}
|
|
|
|
void addComponentPopup() {
|
|
ImGui::textCenter("Add Component");
|
|
ImGui::separator();
|
|
|
|
ImGui::subMenu(
|
|
"Rendering",
|
|
SimpleFunction(this.addComponentRendering)
|
|
);
|
|
|
|
if (ImGui::menuItem("Script Component")) {
|
|
ImGui::closePopup();
|
|
}
|
|
}
|
|
|
|
void addComponentRendering() {
|
|
// Mesh
|
|
if (entity.hasComponent<MeshComponent>()) {
|
|
ImGui::menuItemDisabled("\uf248 Mesh Component");
|
|
} else {
|
|
if (ImGui::menuItem("\uf248 Mesh Component")) {
|
|
entity.addComponent<MeshComponent>();
|
|
ImGui::closePopup();
|
|
}
|
|
}
|
|
|
|
// Shader
|
|
if (entity.hasComponent<ShaderComponent>()) {
|
|
ImGui::menuItemDisabled("\uf042 Shader Component");
|
|
} else {
|
|
if (ImGui::menuItem("\uf042 Shader Component")) {
|
|
entity.addComponent<ShaderComponent>();
|
|
ImGui::closePopup();
|
|
}
|
|
}
|
|
|
|
// Camera
|
|
if (entity.hasComponent<CameraComponent>()) {
|
|
ImGui::menuItemDisabled("\uf030 Camera Component");
|
|
} else {
|
|
if (ImGui::menuItem("\uf030 Camera Component")) {
|
|
entity.addComponent<CameraComponent>();
|
|
ImGui::closePopup();
|
|
}
|
|
}
|
|
}
|
|
}
|