Impl editor object names

This commit is contained in:
MegaMech
2025-03-07 23:27:37 -07:00
parent 882f14e91a
commit c44682b702
43 changed files with 76 additions and 30 deletions
+18 -5
View File
@@ -14,7 +14,7 @@
namespace EditorNamespace {
ToolsWindow::~ToolsWindow() {
SPDLOG_TRACE("destruct editor window");
SPDLOG_TRACE("destruct tools window");
}
void ToolsWindow::InitElement() {
@@ -22,13 +22,14 @@ namespace EditorNamespace {
}
void ToolsWindow::DrawElement() {
static bool toggleState = false;
static bool toggleState = CVarGetInteger("gEditorSnapToGround", 0);
static int selectedTool = 0; // 0: Move, 1: Rotate, 2: Scale
ImVec4 defaultColor = ImGui::GetStyle().Colors[ImGuiCol_Button];
// Function to check and highlight the selected button
auto ToolButton = [&](const char* label, int id) {
bool isSelected = (selectedTool == id);
ImGui::PushStyleColor(ImGuiCol_Button, isSelected ? ImVec4(0.2f, 0.8f, 0.2f, 1.0f) : ImVec4(0.8f, 0.2f, 0.2f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Button, isSelected ? ImVec4(0.4f, 0.7f, 0.9f, 1.0f) : defaultColor);
if (ImGui::Button(label, ImVec2(125, 25))) {
selectedTool = id; // Set the selected tool
@@ -44,12 +45,24 @@ namespace EditorNamespace {
ImGui::SameLine();
ToolButton("Scale", 2);
ImGui::PushStyleColor(ImGuiCol_Button, toggleState ? ImVec4(0.2f, 0.8f, 0.2f, 1.0f) : ImVec4(0.8f, 0.2f, 0.2f, 1.0f));
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, toggleState ? ImVec4(0.4f, 0.7f, 0.9f, 1.0f) : defaultColor);
if (ImGui::Button(toggleState ? "SNAP TO GROUND" : "SNAP TO GROUND", ImVec2(125, 25))) {
toggleState = !toggleState;
CVarSetInteger("gEditorSnapToGround", toggleState);
}
ImGui::PopStyleColor();
ImGui::SameLine();
if (ImGui::Button("Player One AI/Human", ImVec2(160, 25))) {
if (gPlayerOne->type & PLAYER_KART_AI) {
gPlayerOne->type &= ~PLAYER_KART_AI;
} else {
gPlayerOne->type |= PLAYER_KART_AI;
}
}
}
}