Implemented Input Binding Panel via Editor #318

Merged
mushgunAX merged 8 commits from SP3-10-input-management into main 2023-01-30 15:00:58 +08:00
1 changed files with 49 additions and 5 deletions
Showing only changes of commit ac10b95b01 - Show all commits

View File

@ -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))