mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 19:29:58 +01:00
Improve Input Mapping GUI
This commit is contained in:
@@ -106,7 +106,7 @@ Target InputMappingWindow::ComboSelectTarget(const Target ¤t)
|
|||||||
selected = *sit;
|
selected = *sit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t b = 0; b < Mixer::manager().session()->numBatch(); ++b){
|
for (size_t b = 0; b < ses->numBatch(); ++b){
|
||||||
label = std::string("Batch #") + std::to_string(b);
|
label = std::string("Batch #") + std::to_string(b);
|
||||||
if (ImGui::Selectable( label.c_str() )) {
|
if (ImGui::Selectable( label.c_str() )) {
|
||||||
selected = b;
|
selected = b;
|
||||||
@@ -705,28 +705,6 @@ void InputMappingWindow::Render()
|
|||||||
if ( ImGui::MenuItem( ICON_FA_BACKSPACE " Clear all" ) )
|
if ( ImGui::MenuItem( ICON_FA_BACKSPACE " Clear all" ) )
|
||||||
S->clearInputCallbacks();
|
S->clearInputCallbacks();
|
||||||
|
|
||||||
// Gamepad selection
|
|
||||||
ImGui::Separator();
|
|
||||||
float combo_width = ImGui::GetTextLineHeightWithSpacing() * 7.f;
|
|
||||||
ImGui::SetNextItemWidth(combo_width);
|
|
||||||
char text_buf[256];
|
|
||||||
if ( glfwJoystickPresent( Settings::application.gamepad_id ) )
|
|
||||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", glfwGetJoystickName(Settings::application.gamepad_id));
|
|
||||||
else
|
|
||||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "Joystick %d", Settings::application.gamepad_id);
|
|
||||||
|
|
||||||
if (ImGui::BeginCombo("Gamepad", text_buf, ImGuiComboFlags_None)) {
|
|
||||||
for( int g = GLFW_JOYSTICK_1; g < GLFW_JOYSTICK_LAST; ++g) {
|
|
||||||
if ( glfwJoystickPresent( g ) ) {
|
|
||||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", glfwGetJoystickName(g));
|
|
||||||
if (ImGui::Selectable(text_buf, Settings::application.gamepad_id == g) ) {
|
|
||||||
Settings::application.gamepad_id = g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
|
|
||||||
// output manager menu
|
// output manager menu
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
bool pinned = Settings::application.widget.inputs_view == Settings::application.current_view;
|
bool pinned = Settings::application.widget.inputs_view == Settings::application.current_view;
|
||||||
@@ -1321,9 +1299,33 @@ void InputMappingWindow::Render()
|
|||||||
{
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.f, g.Style.ItemSpacing.y * 2.f) );
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.f, g.Style.ItemSpacing.y * 2.f) );
|
||||||
ImGui::BeginChild("InputsMappingInterfacePanel", ImVec2(0, 0), false);
|
ImGui::BeginChild("InputsMappingInterfacePanel", ImVec2(0, 0), false);
|
||||||
|
|
||||||
float w = ImGui::GetWindowWidth() *0.25f;
|
float w = ImGui::GetWindowWidth() *0.25f;
|
||||||
|
|
||||||
|
// selection of device for joystick mode
|
||||||
|
if ( Settings::application.mapping.mode == 3 ){
|
||||||
|
char text_buf[512];
|
||||||
|
if ( glfwJoystickPresent( Settings::application.gamepad_id ) )
|
||||||
|
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", glfwGetJoystickName(Settings::application.gamepad_id));
|
||||||
|
else
|
||||||
|
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "Joystick %d", Settings::application.gamepad_id);
|
||||||
|
|
||||||
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
|
if (ImGui::BeginCombo("Device", text_buf, ImGuiComboFlags_None)) {
|
||||||
|
for( int g = GLFW_JOYSTICK_1; g < GLFW_JOYSTICK_LAST; ++g) {
|
||||||
|
if ( glfwJoystickPresent( g ) ) {
|
||||||
|
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", glfwGetJoystickName(g));
|
||||||
|
if (ImGui::Selectable(text_buf, Settings::application.gamepad_id == g) ) {
|
||||||
|
Settings::application.gamepad_id = g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// adding actions is possible only if there are sources in the session
|
||||||
|
if (!Mixer::manager().session()->empty()) {
|
||||||
|
|
||||||
///
|
///
|
||||||
/// list of input callbacks for the current input
|
/// list of input callbacks for the current input
|
||||||
///
|
///
|
||||||
@@ -1398,6 +1400,8 @@ void InputMappingWindow::Render()
|
|||||||
///
|
///
|
||||||
/// Add a new interface
|
/// Add a new interface
|
||||||
///
|
///
|
||||||
|
///
|
||||||
|
|
||||||
static bool temp_new_input = false;
|
static bool temp_new_input = false;
|
||||||
static Target temp_new_target;
|
static Target temp_new_target;
|
||||||
static uint temp_new_callback = 0;
|
static uint temp_new_callback = 0;
|
||||||
@@ -1448,6 +1452,10 @@ void InputMappingWindow::Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGui::Text("No source to perform an action.");
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Sync info lower right corner
|
/// Sync info lower right corner
|
||||||
|
|||||||
Reference in New Issue
Block a user