452 {
453 if (entity.HasComponent<NameComponent>())
454 {
455 auto&
name = entity.GetComponent<NameComponent>().Name;
456
461 {
463 }
464 }
465
466 ImGui::SameLine();
467 ImGui::PushItemWidth(-1);
468
469 if (ImGui::Button("Add Component"))
470 ImGui::OpenPopup("AddComponent");
471
472 if (ImGui::BeginPopup("AddComponent"))
473 {
475
480
481 ImGui::EndPopup();
482 }
483
484 ImGui::PopItemWidth();
485
487 {
493 });
494
496 {
498
499 ImGui::Checkbox(
"Primary", &
component.Primary);
500
504 {
505 for (
int i = 0;
i < 2;
i++)
506 {
509 {
512 }
513
515 ImGui::SetItemDefaultFocus();
516 }
517
518 ImGui::EndCombo();
519 }
520
522 {
526
530
534 }
535
537 {
538 float orthoSize = camera.GetOrthographicSize();
539 if (ImGui::DragFloat(
"Size", &
orthoSize))
541
542 float orthoNear = camera.GetOrthographicNearClip();
543 if (ImGui::DragFloat(
"Near", &
orthoNear))
544 camera.SetOrthographicNearClip(
orthoNear);
545
546 float orthoFar = camera.GetOrthographicFarClip();
547 if (ImGui::DragFloat(
"Far", &
orthoFar))
548 camera.SetOrthographicFarClip(
orthoFar);
549
550 ImGui::Checkbox(
"Fixed Aspect Ratio", &
component.FixedAspectRatio);
551 }
552 });
553
555 {
556 ImGui::ColorEdit4(
"Color", glm::value_ptr(
component.Color));
557
558
559 ImGui::Checkbox(
"Texture Enabled", &
component.TextureEnabled);
560 ImGui::SameLine();
561
562
564 {
565 ImGui::TextUnformatted(
component.Texture->GetName().c_str());
566 ImGui::SameLine();
567 if (ImGui::Button("Change Texture"))
568 {
569 std::string
filePath =
FileDialogs::OpenFile(
"Image Files (*.png;*.jpg;*.jpeg;*.bmp;*.tga)\0*.png;*.jpg;*.jpeg;*.bmp;*.tga\0All Files (*.*)\0*.*\0");
571 {
574 {
577 if (
ent.HasComponent<SubTextureComponent>()) {
578 auto&
stc =
ent.GetComponent<SubTextureComponent>();
580
581 if (
ent.HasComponent<TextureAnimationComponent>()) {
582 auto&
texAnim =
ent.GetComponent<TextureAnimationComponent>();
583
587 glm::vec2(
static_cast<float>(
tex->GetWidth()) *
stc.TilingFactor.x,
588 static_cast<float>(
tex->GetHeight()) *
stc.TilingFactor.y)
589 ));
591 texAnim.TimeAccumulator = 0.0f;
592 }
593 }
594 }
595 else
596 {
598 }
599 }
600 }
601 ImGui::SameLine();
602 if (ImGui::Button("Clear Texture"))
603 {
606 }
607 }
608 else
609 {
610 ImGui::SameLine();
611 if (ImGui::Button("Set Texture"))
612 {
613 std::string
filePath =
FileDialogs::OpenFile(
"Image Files (*.png;*.jpg;*.jpeg;*.bmp;*.tga)\0*.png;*.jpg;*.jpeg;*.bmp;*.tga\0All Files (*.*)\0*.*\0");
615 {
618 {
621 }
622 else
623 {
625 }
626 }
627 }
628 }
629
630 ImGui::DragFloat(
"Tiling Factor", &
component.TilingFactor, 0.1f, 0.0f, 100.0f);
631
632 });
633
635 {
638 });
639
641 {
642 ImGui::DragFloat(
"Frame Time", &
component.FrameTime, 0.01f, 0.01f, 10.0f);
644
647 ImGui::SliderInt(
"Frame Count", &
component.CurrentFrame, 0,
component.SubTextures.size() - 1);
648 }
649 else
650 ImGui::Text("No frames in animation.");
651
652 ImGui::Checkbox(
"Play Animation", &
component.IsLooping);
653 auto&
stc =
ent.GetOrAddComponent<SubTextureComponent>();
654
655 std::string
texName = (
stc.SubTexture &&
stc.SubTexture->GetTexture()) ?
stc.SubTexture->GetTexture()->GetName() : std::string();
657 });
658
660 {
662 ParticleProps&
psp =
ps.m_Props;
663 ImGui::DragFloat(
"Lifetime", &
psp.Lifetime, 0.1f, 0.0f, 10000.0f);
664 ImGui::DragFloat(
"Lifetime Variation", &
psp.LifetimeVariation, 0.1f, 0.0f, 10000.0f);
665 ImGui::Separator();
666
667 ImGui::DragFloat(
"Start Size", &
psp.SizeBegin, 0.1f, 0.0f, 10000.0f);
668 ImGui::DragFloat(
"Size Variation", &
psp.SizeVariation, 0.1f, 0.0f, 10000.0f);
669 ImGui::DragFloat(
"End Size", &
psp.SizeEnd, 0.1f, 0.0f, 10000.0f);
670 ImGui::Separator();
671
672 ImGui::ColorEdit4(
"Start Color", glm::value_ptr(
psp.ColorBegin));
673 ImGui::ColorEdit4(
"End Color", glm::value_ptr(
psp.ColorEnd));
674 ImGui::Separator();
675
676 ImGui::DragFloat2(
"Velocity", glm::value_ptr(
psp.Velocity), 0.1f);
677 ImGui::DragFloat2(
"Velocity Variation", glm::value_ptr(
psp.VelocityVariation), 0.1f);
678 ImGui::DragFloat3(
"Position Variation", glm::value_ptr(
psp.PositionVariation), 0.1f);
679 ImGui::Separator();
680
681 ImGui::DragFloat(
"Rotation Speed", &
psp.Rotation, 0.1f, -360.0f, 360.0f);
682 ImGui::DragFloat(
"Rotation Speed Variation", &
psp.RotationVariation, 0.1f, 0.0f, 360.0f);
683 ImGui::Separator();
684
685 if (ImGui::Button("Reset System")) {
687 }
688 ImGui::SameLine();
689 if (ImGui::Button("Emit")) {
691 }
692 ImGui::SameLine();
693 if (ImGui::Checkbox(
"Loop", &
ps.m_Loop)) {
694
695 }
696
697 });
698
699
700 }
#define MU_WARN(...)
warn: indicates a potential issue or important event
Definition Log.h:51
static std::string OpenFile(const char *filter)
Opens a file dialog to select a file to open.
Definition LinuxPlatformUtils.cpp:160
ProjectionType
Definition SceneCamera.h:14
static Ref< SubTexture2D > CreateFromCoords(const Ref< Texture2D > &texture, const glm::vec2 &coords, const glm::vec2 &cellSize, const glm::vec2 &spriteSize={1, 1})
Creates a SubTexture2D from a grid of cells within the given texture.
Definition SubTexture2D.cpp:17
static Ref< Texture2D > Create(uint32_t width, uint32_t height)
Definition Texture.cpp:10
static void SubTextureEdit(Entity entity, const std::string &label, SubTextureComponent &subTexture)
Definition SceneHierarchyPanel.cpp:298
static void TextureAnimationEdit(const std::string &label, SubTextureComponent &subTexture, TextureAnimationComponent &texAnim)
Definition SceneHierarchyPanel.cpp:343
static void DrawVec3Control(const std::string &label, glm::vec3 &values, float resetValue=0.0f, float columnWidth=100.0f)
Definition SceneHierarchyPanel.cpp:156