summaryrefslogtreecommitdiff
path: root/src/port/ui/Properties.cpp
diff options
context:
space:
mode:
authorKiritoDv <36680385+KiritoDv@users.noreply.github.com>2025-05-16 02:44:40 +0000
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2025-05-16 02:44:40 +0000
commitb53a5dbcfa24ef2aa4860b6d9512709976686de8 (patch)
tree441f2bb9c0bc8f955eb9289d19b13beab5c239c5 /src/port/ui/Properties.cpp
parentbdf5ca8d603ae56ac275bebf9fde58ae72484d76 (diff)
clang formatclang-format
Diffstat (limited to 'src/port/ui/Properties.cpp')
-rw-r--r--src/port/ui/Properties.cpp136
1 files changed, 67 insertions, 69 deletions
diff --git a/src/port/ui/Properties.cpp b/src/port/ui/Properties.cpp
index 0368231d9..86d32fd43 100644
--- a/src/port/ui/Properties.cpp
+++ b/src/port/ui/Properties.cpp
@@ -17,91 +17,89 @@
namespace Editor {
- PropertiesWindow::~PropertiesWindow() {
- SPDLOG_TRACE("destruct properties window");
+PropertiesWindow::~PropertiesWindow() {
+ SPDLOG_TRACE("destruct properties window");
+}
+
+void PropertiesWindow::DrawElement() {
+ GameObject* selected = gEditor.eObjectPicker.eGizmo._selected;
+
+ if (nullptr == selected) {
+ return;
}
- void PropertiesWindow::DrawElement() {
- GameObject* selected = gEditor.eObjectPicker.eGizmo._selected;
+ ImGui::Begin("Properties");
+
+ if (selected->Pos) {
+ ImGui::Text("Location");
+ ImGui::SameLine();
+
+ bool positionChanged = ImGui::DragFloat3("##Location", &selected->Pos->x, 0.1f);
- if (nullptr == selected) {
- return;
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetPos")) {
+ selected->Pos->x = 0.0f;
+ selected->Pos->y = 0.0f;
+ selected->Pos->z = 0.0f;
+ positionChanged = true; // also counts as a change
}
- ImGui::Begin("Properties");
+ if (positionChanged) {
+ gEditor.eObjectPicker.eGizmo.Pos = *selected->Pos;
+ }
+ }
- if (selected->Pos) {
- ImGui::Text("Location");
- ImGui::SameLine();
+ if (selected->Rot) {
+ ImGui::Text("Rotation");
+ ImGui::SameLine();
- bool positionChanged = ImGui::DragFloat3("##Location", &selected->Pos->x, 0.1f);
+ // Convert to temporary int values (to prevent writing 32bit values to 16bit variables)
+ int rot[3] = { selected->Rot->pitch, selected->Rot->yaw, selected->Rot->roll };
- ImGui::SameLine();
- if (ImGui::Button(ICON_FA_UNDO "##ResetPos")) {
- selected->Pos->x = 0.0f;
- selected->Pos->y = 0.0f;
- selected->Pos->z = 0.0f;
- positionChanged = true; // also counts as a change
+ if (ImGui::DragInt3("##Rotation", rot, 5.0f)) {
+ for (int i = 0; i < 3; i++) {
+ // Wrap around 0–65535
+ rot[i] = (rot[i] % 65536 + 65536) % 65536;
}
- if (positionChanged) {
- gEditor.eObjectPicker.eGizmo.Pos = *selected->Pos;
- }
+ selected->Rot->pitch = static_cast<uint16_t>(rot[0]);
+ selected->Rot->yaw = static_cast<uint16_t>(rot[1]);
+ selected->Rot->roll = static_cast<uint16_t>(rot[2]);
}
- if (selected->Rot) {
- ImGui::Text("Rotation");
- ImGui::SameLine();
-
- // Convert to temporary int values (to prevent writing 32bit values to 16bit variables)
- int rot[3] = {
- selected->Rot->pitch,
- selected->Rot->yaw,
- selected->Rot->roll
- };
-
- if (ImGui::DragInt3("##Rotation", rot, 5.0f)) {
- for (int i = 0; i < 3; i++) {
- // Wrap around 0–65535
- rot[i] = (rot[i] % 65536 + 65536) % 65536;
- }
-
- selected->Rot->pitch = static_cast<uint16_t>(rot[0]);
- selected->Rot->yaw = static_cast<uint16_t>(rot[1]);
- selected->Rot->roll = static_cast<uint16_t>(rot[2]);
- }
-
- ImGui::SameLine();
- if (ImGui::Button(ICON_FA_UNDO "##ResetRot")) {
- selected->Rot->pitch = 0;
- selected->Rot->yaw = 0;
- selected->Rot->roll = 0;
- }
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetRot")) {
+ selected->Rot->pitch = 0;
+ selected->Rot->yaw = 0;
+ selected->Rot->roll = 0;
}
+ }
- if (selected->Scale) {
- ImGui::Text("Scale ");
- ImGui::SameLine();
+ if (selected->Scale) {
+ ImGui::Text("Scale ");
+ ImGui::SameLine();
- ImGui::DragFloat3("##Scale", &selected->Scale->x, 0.1f);
- ImGui::SameLine();
- if (ImGui::Button(ICON_FA_UNDO "##ResetScale")) {
- selected->Scale->x = 1.0f;
- selected->Scale->y = 1.0f;
- selected->Scale->z = 1.0f;
- }
+ ImGui::DragFloat3("##Scale", &selected->Scale->x, 0.1f);
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetScale")) {
+ selected->Scale->x = 1.0f;
+ selected->Scale->y = 1.0f;
+ selected->Scale->z = 1.0f;
}
+ }
- if (selected->Collision == GameObject::CollisionType::BOUNDING_BOX) {
- ImGui::Separator();
- ImGui::Text("Editor Bounding Box Size:");
- ImGui::PushID("BoundingBoxSize");
- ImGui::DragFloat("##BoundingBoxSize", &selected->BoundingBoxSize, 0.1f);
- ImGui::SameLine();
- if (ImGui::Button(ICON_FA_UNDO)) { selected->BoundingBoxSize = 2.0f; }
- ImGui::PopID();
+ if (selected->Collision == GameObject::CollisionType::BOUNDING_BOX) {
+ ImGui::Separator();
+ ImGui::Text("Editor Bounding Box Size:");
+ ImGui::PushID("BoundingBoxSize");
+ ImGui::DragFloat("##BoundingBoxSize", &selected->BoundingBoxSize, 0.1f);
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO)) {
+ selected->BoundingBoxSize = 2.0f;
}
-
- ImGui::End();
+ ImGui::PopID();
}
-} \ No newline at end of file
+
+ ImGui::End();
+}
+} // namespace Editor