mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-07 02:15:33 -04:00
Impl editor object names
This commit is contained in:
+18
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user