From ac10b95b0175ff95e567fea18a2621ecd8e89871 Mon Sep 17 00:00:00 2001 From: mushgunAX Date: Wed, 25 Jan 2023 23:54:04 +0800 Subject: [PATCH] Tooltips --- .../InputBindings/SHInputBindingsPanel.cpp | 54 +++++++++++++++++-- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/InputBindings/SHInputBindingsPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/InputBindings/SHInputBindingsPanel.cpp index c304c1b0..d3fa33fa 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/InputBindings/SHInputBindingsPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/InputBindings/SHInputBindingsPanel.cpp @@ -58,7 +58,7 @@ namespace SHADE { ImGui::BeginTooltip(); ImGui::Text(".SHConfig will be appeneded to file name"); - ImGui::Text("If no name is provided, saves to \"Assets/Bindings.SHConfig\""); + ImGui::Text("If no name is provided, saves to or loads from \"Assets/Bindings.SHConfig\""); ImGui::EndTooltip(); } @@ -258,6 +258,12 @@ namespace SHADE //Positive key codes ImGui::Separator(); ImGui::Text("Positive Key Codes:"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Text("When this keyboard or mouse button is held, causes the value to go positive, or negative when inverted"); + ImGui::EndTooltip(); + } ImGui::SameLine(); //Button to ask for inputs @@ -274,7 +280,12 @@ namespace SHADE if (positiveKeyListeningFor == entryNumber) { //Listening for inputs - ImGui::Button(labelConcat("Press##positiveKeyCode", entryNumber).c_str()); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.4f, 0.4f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.5f, 0.5f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.3f, 0.3f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + ImGui::Button(labelConcat("PRESS##positiveKeyCode", entryNumber).c_str()); + ImGui::PopStyleColor(4); SHInputManager::SH_KEYCODE k; if (SHInputManager::AnyKey(&k)) @@ -317,6 +328,12 @@ namespace SHADE //Negative key codes ImGui::Separator(); ImGui::Text("Negative Key Codes:"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Text("When this keyboard or mouse button is held, causes the value to go negative, or positive when inverted"); + ImGui::EndTooltip(); + } ImGui::SameLine(); //Button to ask for inputs @@ -333,7 +350,12 @@ namespace SHADE if (negativeKeyListeningFor == entryNumber) { //Listening for inputs - ImGui::Button(labelConcat("Press##negativeKeyCode", entryNumber).c_str()); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.4f, 0.4f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.5f, 0.5f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.3f, 0.3f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + ImGui::Button(labelConcat("PRESS##negativeKeyCode", entryNumber).c_str()); + ImGui::PopStyleColor(4); SHInputManager::SH_KEYCODE k; if (SHInputManager::AnyKey(&k)) @@ -375,6 +397,12 @@ namespace SHADE //Positive controller codes ImGui::Separator(); ImGui::Text("Positive Controller Codes:"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Text("When this controller button is held, causes the value to go positive, or negative when inverted"); + ImGui::EndTooltip(); + } ImGui::SameLine(); //Button to ask for inputs @@ -391,7 +419,12 @@ namespace SHADE if (positiveControllerListeningFor == entryNumber) { //Listening for inputs - ImGui::Button(labelConcat("Press##positiveControllerCode", entryNumber).c_str()); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.4f, 0.4f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.5f, 0.5f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.3f, 0.3f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + ImGui::Button(labelConcat("PRESS##positiveControllerCode", entryNumber).c_str()); + ImGui::PopStyleColor(4); SHInputManager::SH_CONTROLLERCODE c; if (SHInputManager::AnyControllerInput(&c)) @@ -433,6 +466,12 @@ namespace SHADE //Negative controller codes ImGui::Separator(); ImGui::Text("Negative Controller Codes:"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Text("When this controller button is pressed, causes the value to go negative, or positive when inverted"); + ImGui::EndTooltip(); + } ImGui::SameLine(); //Button to ask for inputs @@ -449,7 +488,12 @@ namespace SHADE if (negativeControllerListeningFor == entryNumber) { //Listening for inputs - ImGui::Button(labelConcat("Press##negativeControllerCode", entryNumber).c_str()); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.4f, 0.4f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.5f, 0.5f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.3f, 0.3f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + ImGui::Button(labelConcat("PRESS##negativeControllerCode", entryNumber).c_str()); + ImGui::PopStyleColor(4); SHInputManager::SH_CONTROLLERCODE c; if (SHInputManager::AnyControllerInput(&c))