From 886305ec132663ec457c0af083cdc9c3c8f399a3 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 6 Feb 2022 23:37:11 +0100 Subject: [PATCH] Input Mapping support for Gamepad buttons Cleanup UI defines. --- ControlManager.cpp | 73 +++++++++++++------ ControlManager.h | 20 +++-- UserInterfaceManager.cpp | 154 +++++++++++++++++++++++++++++---------- UserInterfaceManager.h | 16 +++- defines.h | 9 --- 5 files changed, 193 insertions(+), 79 deletions(-) diff --git a/ControlManager.cpp b/ControlManager.cpp index 7895702..0a16bc4 100644 --- a/ControlManager.cpp +++ b/ControlManager.cpp @@ -48,7 +48,9 @@ #define CONTROL_OSC_MSG "OSC: " -bool Control::input_active[INPUT_MAX]{}; +bool Control::input_active[INPUT_MAX]{}; +float Control::input_values[INPUT_MAX]{}; +std::condition_variable Control::joystick_end_; void Control::RequestListener::ProcessMessage( const osc::ReceivedMessage& m, @@ -352,6 +354,12 @@ bool Control::init() glfwSetKeyCallback( main, Control::keyboardCalback); glfwSetKeyCallback( output, Control::keyboardCalback); + + // + // set joystick callback + // + std::thread(Control::joystickCallback).detach(); + // // load OSC Translator // @@ -395,6 +403,8 @@ void Control::listen() void Control::terminate() { + Control::joystick_end_.notify_all(); + if ( receiver_ != nullptr ) { // request termination of receiver @@ -411,6 +421,7 @@ void Control::terminate() delete receiver_; receiver_ = nullptr; } + } @@ -777,10 +788,14 @@ void Control::keyboardCalback(GLFWwindow* window, int key, int, int action, int { if (UserInterface::manager().keyboardAvailable() && !mods ) { - if (key >= GLFW_KEY_A && key <= GLFW_KEY_Z) + if (key >= GLFW_KEY_A && key <= GLFW_KEY_Z) { Control::input_active[INPUT_KEYBOARD_FIRST + key - GLFW_KEY_A] = action > GLFW_RELEASE; - else if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL) + Control::input_values[INPUT_KEYBOARD_FIRST + key - GLFW_KEY_A] = action > GLFW_RELEASE ? 1.f : 0.f; + } + else if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL) { Control::input_active[INPUT_NUMPAD_FIRST + key - GLFW_KEY_KP_0] = action > GLFW_RELEASE; + Control::input_values[INPUT_NUMPAD_FIRST + key - GLFW_KEY_KP_0] = action > GLFW_RELEASE ? 1.f : 0.f; + } else if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS ) { static GLFWwindow *output = Rendering::manager().outputWindow().window(); @@ -790,31 +805,41 @@ void Control::keyboardCalback(GLFWwindow* window, int key, int, int action, int } } +void Control::joystickCallback() +{ + // wait for the joystick_end_ notification + std::mutex mtx; + std::unique_lock lck(mtx); + while ( Control::joystick_end_.wait_for(lck,std::chrono::milliseconds(20) ) == std::cv_status::timeout ) { + + // read joystick buttons + int num_buttons = 0; + const unsigned char *state_buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &num_buttons ); + // map to Control input array + for (int b = 0; b < num_buttons; ++b) { + Control::input_active[INPUT_JOYSTICK_FIRST_BUTTON + b] = state_buttons[b] == GLFW_PRESS; + Control::input_values[INPUT_JOYSTICK_FIRST_BUTTON + b] = state_buttons[b] == GLFW_PRESS ? 1.f : 0.f; + } + + // read joystick axis + int num_axis = 0; + const float *state_axis = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &num_axis ); + for (int a = 0; a < num_axis; ++a) { + Control::input_active[INPUT_JOYSTICK_FIRST_AXIS + a] = ABS(state_axis[a]) > 0.01 ? true : false; + Control::input_values[INPUT_JOYSTICK_FIRST_AXIS + a] = state_axis[a]; + } + } +} bool Control::inputActive(uint id) { - return Control::input_active[MIN(id,INPUT_MAX)]; + return Control::input_active[MIN(id,INPUT_MAX)] && !Settings::application.mapping.disabled; } float Control::inputValue(uint id) { - float value = 0.f; - - if ( id >= INPUT_KEYBOARD_FIRST && id <= INPUT_NUMPAD_LAST ) - { - value = inputActive(id) ? 1.0f : 0.f; - } - else if ( id >= INPUT_JOYSTICK_FIRST && id <= INPUT_JOYSTICK_LAST ) - { - - } - else if ( id >= INPUT_CUSTOM_FIRST && id <= INPUT_CUSTOM_LAST ) - { - - } - - return value; + return Control::input_values[MIN(id,INPUT_MAX)]; } std::string Control::inputLabel(uint id) @@ -833,7 +858,13 @@ std::string Control::inputLabel(uint id) } else if ( id >= INPUT_JOYSTICK_FIRST && id <= INPUT_JOYSTICK_LAST ) { - + std::vector< std::string > joystick_labels = { "Button A", "Button B", "Button X", "Button Y", + "Left bumper", "Right bumper", "Back", "Start", + "Guide", "Left thumb", "Right thumb", + "Up", "Right", "Down", "Left", + "Left Axis X", "Left Axis Y", "Left Trigger", + "Right Axis X", "Right Axis Y", "Right Trigger" }; + label = joystick_labels[id - INPUT_JOYSTICK_FIRST]; } else if ( id >= INPUT_CUSTOM_FIRST && id <= INPUT_CUSTOM_LAST ) { diff --git a/ControlManager.h b/ControlManager.h index b670c8c..891399d 100644 --- a/ControlManager.h +++ b/ControlManager.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "SourceList.h" @@ -52,8 +53,12 @@ #define INPUT_NUMPAD_FIRST 27 #define INPUT_NUMPAD_LAST 43 #define INPUT_JOYSTICK_FIRST 44 -#define INPUT_JOYSTICK_LAST 65 -#define INPUT_CUSTOM_FIRST 66 +#define INPUT_JOYSTICK_LAST 64 +#define INPUT_JOYSTICK_FIRST_BUTTON 44 +#define INPUT_JOYSTICK_LAST_BUTTON 58 +#define INPUT_JOYSTICK_FIRST_AXIS 59 +#define INPUT_JOYSTICK_LAST_AXIS 64 +#define INPUT_CUSTOM_FIRST 65 #define INPUT_CUSTOM_LAST 99 #define INPUT_MAX 100 @@ -87,8 +92,8 @@ public: std::string translate (std::string addresspqattern); static bool inputActive(uint id); - float inputValue(uint id); - std::string inputLabel(uint id); + static float inputValue(uint id); + static std::string inputLabel(uint id); protected: @@ -123,8 +128,13 @@ private: void loadOscConfig(); void resetOscConfig(); - static bool input_active[INPUT_MAX]; + static bool input_active[INPUT_MAX]; + static float input_values[INPUT_MAX]; + static std::condition_variable joystick_end_; + static std::mutex access_; + static void keyboardCalback(GLFWwindow*, int, int, int, int); + static void joystickCallback(); }; #endif // CONTROL_H diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 56e8545..2d92358 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -349,7 +349,7 @@ void UserInterface::handleKeyboard() else if (ImGui::IsKeyPressed( GLFW_KEY_M )) { Settings::application.widget.stats = !Settings::application.widget.stats; } - else if (ImGui::IsKeyPressed( GLFW_KEY_K )) { + else if (ImGui::IsKeyPressed( GLFW_KEY_I )) { Settings::application.widget.inputs = !Settings::application.widget.inputs; } else if (ImGui::IsKeyPressed( GLFW_KEY_N ) && shift_modifier_active) { @@ -1714,21 +1714,26 @@ void HelperToolbox::Render() ImGui::SetColumnWidth(0, width_column0); ImGui::PushTextWrapPos(width_window ); + ImGui::Text(ICON_FA_DESKTOP " Output"); ImGui::NextColumn(); + ImGui::Text ("Preview the output displayed in the rendering window. Control video recording and sharing to other vimix in local network."); + ImGui::NextColumn(); + ImGui::Text(ICON_FA_PLAY_CIRCLE " Player"); ImGui::NextColumn(); + ImGui::Text ("Play, pause, rewind videos or dynamic sources. Control play duration, speed and synchronize multiple videos."); + ImGui::NextColumn(); + ImGui::Text(ICON_FA_CLOCK " Timer"); ImGui::NextColumn(); + ImGui::Text ("Keep track of time with a stopwatch or a metronome (Ableton Link)."); + ImGui::NextColumn(); + ImGui::Text(ICON_FA_HAND_PAPER " Inputs"); ImGui::NextColumn(); + ImGui::Text ("Define how user inputs (e.g. keyboard, joystick) are mapped to custom actions in the session."); + ImGui::NextColumn(); ImGui::Text(ICON_FA_STICKY_NOTE " Notes"); ImGui::NextColumn(); ImGui::Text ("Place sticky notes into your session."); ImGui::NextColumn(); ImGui::Text(ICON_FA_TACHOMETER_ALT " Metrics"); ImGui::NextColumn(); ImGui::Text ("Utility monitoring of metrics on the system (FPS, RAM), the runtime (session duration), or the current source."); ImGui::NextColumn(); - ImGui::Text(ICON_FA_PLAY_CIRCLE " Player"); ImGui::NextColumn(); - ImGui::Text ("Play, pause, rewind videos or dynamic sources. Control play duration, speed and synchronize multiple videos."); - ImGui::NextColumn(); - ImGui::Text(ICON_FA_DESKTOP " Output"); ImGui::NextColumn(); - ImGui::Text ("Preview the output displayed in the rendering window. Control video recording and sharing to other vimix in local network."); - ImGui::NextColumn(); - ImGui::Text(ICON_FA_CLOCK " Timer"); ImGui::NextColumn(); - ImGui::Text ("Keep track of time with a stopwatch or a metronome (Ableton Link)."); - ImGui::NextColumn(); + ImGui::Text(ICON_FA_COG " Settings"); ImGui::NextColumn(); + ImGui::Text ("Set user preferences and system settings."); ImGui::Columns(1); ImGui::PopTextWrapPos(); @@ -1825,19 +1830,21 @@ void HelperToolbox::Render() ImGui::Text("Switch Current source"); ImGui::NextColumn(); ImGui::Text(CTRL_MOD "TAB"); ImGui::NextColumn(); ImGui::Text("Switch view"); ImGui::NextColumn(); - ImGui::Separator(); ImGui::Text(SHORTCUT_FULLSCREEN); ImGui::NextColumn(); - ImGui::Text(ICON_FA_EXPAND_ALT TOOLTIP_FULLSCREEN "main window"); ImGui::NextColumn(); - ImGui::Text(SHORTCUT_NOTE); ImGui::NextColumn(); - ImGui::Text(ICON_FA_STICKY_NOTE TOOLTIP_NOTE); ImGui::NextColumn(); - ImGui::Text(SHORTCUT_PLAYER); ImGui::NextColumn(); - ImGui::Text(ICON_FA_PLAY_CIRCLE TOOLTIP_PLAYER "window" ); ImGui::NextColumn(); + ImGui::Text(ICON_FA_EXPAND_ALT " " TOOLTIP_FULLSCREEN "main window"); ImGui::NextColumn(); + ImGui::Separator(); ImGui::Text(SHORTCUT_OUTPUT); ImGui::NextColumn(); - ImGui::Text(ICON_FA_DESKTOP TOOLTIP_OUTPUT "window"); ImGui::NextColumn(); + ImGui::Text(ICON_FA_DESKTOP " " TOOLTIP_OUTPUT "window"); ImGui::NextColumn(); + ImGui::Text(SHORTCUT_PLAYER); ImGui::NextColumn(); + ImGui::Text(ICON_FA_PLAY_CIRCLE " " TOOLTIP_PLAYER "window" ); ImGui::NextColumn(); ImGui::Text(SHORTCUT_TIMER); ImGui::NextColumn(); - ImGui::Text(ICON_FA_CLOCK TOOLTIP_TIMER "window"); ImGui::NextColumn(); + ImGui::Text(ICON_FA_CLOCK " " TOOLTIP_TIMER "window"); ImGui::NextColumn(); + ImGui::Text(SHORTCUT_INPUTS); ImGui::NextColumn(); + ImGui::Text(ICON_FA_HAND_PAPER " " TOOLTIP_INPUTS "window"); ImGui::NextColumn(); + ImGui::Text(SHORTCUT_NOTE); ImGui::NextColumn(); + ImGui::Text(ICON_FA_STICKY_NOTE " " TOOLTIP_NOTE); ImGui::NextColumn(); ImGui::Text("ESC"); ImGui::NextColumn(); - ImGui::Text("Hide / Show windows"); ImGui::NextColumn(); + ImGui::Text(ICON_FA_WINDOW_MINIMIZE " Hide / " ICON_FA_WINDOW_MAXIMIZE " Show windows"); ImGui::NextColumn(); ImGui::Separator(); ImGui::Text(SHORTCUT_NEW_FILE); ImGui::NextColumn(); ImGui::Text(MENU_NEW_FILE " session"); ImGui::NextColumn(); @@ -1877,7 +1884,7 @@ void HelperToolbox::Render() ImGui::Text("Space"); ImGui::NextColumn(); ImGui::Text("Toggle Play/Pause selected videos"); ImGui::NextColumn(); ImGui::Text(CTRL_MOD "Space"); ImGui::NextColumn(); - ImGui::Text("Back restart selected videos"); ImGui::NextColumn(); + ImGui::Text("Restart selected videos"); ImGui::NextColumn(); ImGui::Text(ICON_FA_ARROW_DOWN " " ICON_FA_ARROW_UP " " ICON_FA_ARROW_DOWN " " ICON_FA_ARROW_RIGHT ); ImGui::NextColumn(); ImGui::Text("Move the selection in the canvas"); ImGui::NextColumn(); ImGui::Separator(); @@ -4281,8 +4288,8 @@ void TimerMetronome::Render() InputMappingInterface::InputMappingInterface() : WorkspaceWindow("InputMappingInterface") { - input_mode = { ICON_FA_KEYBOARD " Keyboard", ICON_FA_CALCULATOR " Numpad" }; - current_input_for_mode = { INPUT_KEYBOARD_FIRST, INPUT_NUMPAD_FIRST }; + input_mode = { ICON_FA_KEYBOARD " Keyboard", ICON_FA_CALCULATOR " Numpad" , ICON_FA_GAMEPAD " Gamepad" }; + current_input_for_mode = { INPUT_KEYBOARD_FIRST, INPUT_NUMPAD_FIRST, INPUT_JOYSTICK_FIRST }; current_input_ = current_input_for_mode[Settings::application.mapping.mode]; } @@ -4480,7 +4487,7 @@ void InputMappingInterface::Render() if (ImGui::BeginMenu(IMGUI_TITLE_INPUT_MAPPING)) { // Enable/Disable - ImGui::MenuItem( ICON_FA_BAN " Disable all", nullptr, &Settings::application.mapping.disabled); + ImGui::MenuItem( ICON_FA_BAN " Disable", nullptr, &Settings::application.mapping.disabled); // output manager menu ImGui::Separator(); @@ -4548,6 +4555,9 @@ void InputMappingInterface::Render() ImVec4 color = ImGui::GetStyle().Colors[ImGuiCol_Header]; color.w /= Settings::application.mapping.disabled ? 2.f : 0.9f; ImGui::PushStyleColor(ImGuiCol_Header, color); + color = ImGui::GetStyle().Colors[ImGuiCol_Text]; + color.w /= Settings::application.mapping.disabled ? 2.f : 1.0f; + ImGui::PushStyleColor(ImGuiCol_Text, color); for (uint ik = INPUT_KEYBOARD_FIRST; ik < INPUT_KEYBOARD_LAST; ++ik){ int i = ik - INPUT_KEYBOARD_FIRST; @@ -4573,7 +4583,7 @@ void InputMappingInterface::Render() draw_list->AddRect(pos, pos + keyLetterIconSize, ImGui::GetColorU32(ImGuiCol_Text), 6.f, ImDrawCornerFlags_All, 3.f); } } - ImGui::PopStyleColor(); + ImGui::PopStyleColor(2); ImGui::PopStyleVar(); ImGui::PopFont(); @@ -4594,6 +4604,9 @@ void InputMappingInterface::Render() ImVec4 color = ImGui::GetStyle().Colors[ImGuiCol_Header]; color.w /= Settings::application.mapping.disabled ? 2.f : 0.9f; ImGui::PushStyleColor(ImGuiCol_Header, color); + color = ImGui::GetStyle().Colors[ImGuiCol_Text]; + color.w /= Settings::application.mapping.disabled ? 2.f : 1.0f; + ImGui::PushStyleColor(ImGuiCol_Text, color); for (size_t p = 0; p < numpad_inputs.size(); ++p){ uint ik = numpad_inputs[p]; @@ -4622,7 +4635,70 @@ void InputMappingInterface::Render() draw_list->AddRect(pos, pos + iconsize, ImGui::GetColorU32(ImGuiCol_Text), 6.f, ImDrawCornerFlags_All, 3.f); } } - ImGui::PopStyleColor(); + ImGui::PopStyleColor(2); + ImGui::PopStyleVar(); + ImGui::PopFont(); + + } + // + // JOYSTICK + // + else if ( Settings::application.mapping.mode == 2 ) { + + // custom layout of gamepad buttons + std::vector gamepad_inputs = { INPUT_JOYSTICK_FIRST_BUTTON+11, INPUT_JOYSTICK_FIRST_BUTTON+13, + INPUT_JOYSTICK_FIRST_BUTTON+6, + INPUT_JOYSTICK_FIRST_BUTTON+2, INPUT_JOYSTICK_FIRST_BUTTON+3, + + INPUT_JOYSTICK_FIRST_BUTTON+14, INPUT_JOYSTICK_FIRST_BUTTON+12, + INPUT_JOYSTICK_FIRST_BUTTON+7, + INPUT_JOYSTICK_FIRST_BUTTON+0, INPUT_JOYSTICK_FIRST_BUTTON+1, + + INPUT_JOYSTICK_FIRST_BUTTON+4, INPUT_JOYSTICK_FIRST_BUTTON+9, + INPUT_JOYSTICK_FIRST_BUTTON+8, + INPUT_JOYSTICK_FIRST_BUTTON+10, INPUT_JOYSTICK_FIRST_BUTTON+5 }; + + std::vector< std::string > gamepad_labels = { ICON_FA_CARET_SQUARE_UP, ICON_FA_CARET_SQUARE_DOWN, + ICON_FA_CHEVRON_CIRCLE_LEFT, "X", "Y", + ICON_FA_CARET_SQUARE_LEFT, ICON_FA_CARET_SQUARE_RIGHT, + ICON_FA_CHEVRON_CIRCLE_RIGHT, "A", "B", + "L1", "LT", ICON_FA_DOT_CIRCLE, "RT", "R1" }; + + // Draw table of letter keys [A] to [Y] + ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); + ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f, 0.50f)); + ImVec4 color = ImGui::GetStyle().Colors[ImGuiCol_Header]; + color.w /= Settings::application.mapping.disabled ? 2.f : 0.9f; + ImGui::PushStyleColor(ImGuiCol_Header, color); + color = ImGui::GetStyle().Colors[ImGuiCol_Text]; + color.w /= Settings::application.mapping.disabled ? 2.f : 1.0f; + ImGui::PushStyleColor(ImGuiCol_Text, color); + + for (size_t b = 0; b < gamepad_inputs.size(); ++b ){ + uint ig = gamepad_inputs[b]; + // draw overlay on active keys + if ( Control::inputActive(ig) ) { + ImVec2 pos = frame_top + keyLetterItemSize * ImVec2( b % 5, b / 5); + draw_list->AddRectFilled(pos, pos + keyLetterIconSize, ImGui::GetColorU32(ImGuiCol_Border), 6.f); + // set current + current_input_ = ig; + } + // draw key button + ImGui::PushID(ig); + if (ImGui::Selectable(gamepad_labels[b].c_str(), input_assigned[ig], 0, keyLetterIconSize)) { + + current_input_ = ig; + } + ImGui::PopID(); + if ((b % 5) < 4) ImGui::SameLine(); + + // Draw frame around current keyboard letter + if (current_input_ == ig) { + ImVec2 pos = frame_top + keyLetterItemSize * ImVec2( b % 5, b / 5); + draw_list->AddRect(pos, pos + keyLetterIconSize, ImGui::GetColorU32(ImGuiCol_Text), 6.f, ImDrawCornerFlags_All, 3.f); + } + } + ImGui::PopStyleColor(2); ImGui::PopStyleVar(); ImGui::PopFont(); @@ -6324,18 +6400,19 @@ void Navigator::RenderMainPannelVimix() std::pair tooltip_; ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); + + ImGui::SameLine(0, 0.5f * ImGui::GetTextLineHeight()); + if ( ImGuiToolkit::IconButton( ICON_FA_DESKTOP ) ) + UserInterface::manager().outputcontrol.setVisible(!Settings::application.widget.preview); + if (ImGui::IsItemHovered()) + tooltip_ = { TOOLTIP_OUTPUT, SHORTCUT_OUTPUT}; + ImGui::SameLine(0, ImGui::GetTextLineHeight()); if ( ImGuiToolkit::IconButton( ICON_FA_PLAY_CIRCLE ) ) UserInterface::manager().sourcecontrol.setVisible(!Settings::application.widget.media_player); if (ImGui::IsItemHovered()) tooltip_ = { TOOLTIP_PLAYER, SHORTCUT_PLAYER}; - ImGui::SameLine(0, ImGui::GetTextLineHeight()); - if ( ImGuiToolkit::IconButton( ICON_FA_DESKTOP ) ) - UserInterface::manager().outputcontrol.setVisible(!Settings::application.widget.preview); - if (ImGui::IsItemHovered()) - tooltip_ = { TOOLTIP_OUTPUT, SHORTCUT_OUTPUT}; - ImGui::SameLine(0, ImGui::GetTextLineHeight()); if ( ImGuiToolkit::IconButton( ICON_FA_CLOCK ) ) UserInterface::manager().timercontrol.setVisible(!Settings::application.widget.timer); @@ -6343,25 +6420,17 @@ void Navigator::RenderMainPannelVimix() tooltip_ = { TOOLTIP_TIMER, SHORTCUT_TIMER}; ImGui::SameLine(0, ImGui::GetTextLineHeight()); - if ( ImGuiToolkit::IconButton( ICON_FA_CUBES ) ) + if ( ImGuiToolkit::IconButton( ICON_FA_HAND_PAPER ) ) UserInterface::manager().inputscontrol.setVisible(!Settings::application.widget.inputs); if (ImGui::IsItemHovered()) tooltip_ = { TOOLTIP_INPUTS, SHORTCUT_INPUTS}; - ImGui::PopFont(); - ImGui::Spacing(); - ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO); ImGui::SameLine(0, ImGui::GetTextLineHeight()); if ( ImGuiToolkit::IconButton( ICON_FA_STICKY_NOTE ) ) Mixer::manager().session()->addNote(); if (ImGui::IsItemHovered()) tooltip_ = { TOOLTIP_NOTE, SHORTCUT_NOTE}; - ImGui::SameLine(0, ImGui::GetTextLineHeight()); - if ( ImGuiToolkit::IconButton( ICON_FA_TACHOMETER_ALT ) ) - Settings::application.widget.stats = !Settings::application.widget.stats; - if (ImGui::IsItemHovered()) - tooltip_ = { TOOLTIP_METRICS, SHORTCUT_METRICS}; ImGui::PopFont(); if (!tooltip_.first.empty()) { @@ -6674,6 +6743,11 @@ void Navigator::RenderMainPannel() ImGui::SetCursorScreenPos( rightcorner - ImVec2(button_height, button_height)); const char *tooltip[2] = {"Settings", "Settings"}; ImGuiToolkit::IconToggle(13,5,12,5, &show_config_, tooltip); + // Metrics icon just above + ImGui::SetCursorScreenPos( rightcorner - ImVec2(button_height, 2.1 * button_height)); + if ( ImGuiToolkit::IconButton( 11, 3 , TOOLTIP_METRICS) ) + Settings::application.widget.stats = !Settings::application.widget.stats; + ImGui::End(); } diff --git a/UserInterfaceManager.h b/UserInterfaceManager.h index 2c0f12b..f6ac7ce 100644 --- a/UserInterfaceManager.h +++ b/UserInterfaceManager.h @@ -21,6 +21,14 @@ #define ALT_MOD "Alt+" #endif +#define IMGUI_TITLE_MEDIAPLAYER ICON_FA_PLAY_CIRCLE " Player" +#define IMGUI_TITLE_TIMER ICON_FA_CLOCK " Timer" +#define IMGUI_TITLE_INPUT_MAPPING ICON_FA_HAND_PAPER " Inputs Mapping" +#define IMGUI_TITLE_HELP ICON_FA_LIFE_RING " Help" +#define IMGUI_TITLE_TOOLBOX ICON_FA_HAMSA " Guru Toolbox" +#define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Code Editor" +#define IMGUI_TITLE_PREVIEW ICON_FA_DESKTOP " Ouput" + #define MENU_NEW_FILE ICON_FA_FILE " New" #define SHORTCUT_NEW_FILE CTRL_MOD "W" #define MENU_OPEN_FILE ICON_FA_FILE_UPLOAD " Open" @@ -62,7 +70,7 @@ #define SHORTCUT_OUTPUTFULLSCREEN CTRL_MOD "F" #define MENU_CLOSE ICON_FA_TIMES " Close" -#define TOOLTIP_NOTE "New note " +#define TOOLTIP_NOTE "New sticky note " #define SHORTCUT_NOTE CTRL_MOD "Shift+N" #define TOOLTIP_METRICS "Metrics " #define SHORTCUT_METRICS CTRL_MOD "M" @@ -72,7 +80,7 @@ #define SHORTCUT_OUTPUT CTRL_MOD "D" #define TOOLTIP_TIMER "Timer " #define SHORTCUT_TIMER CTRL_MOD "T" -#define TOOLTIP_INPUTS "Inputs mapping" +#define TOOLTIP_INPUTS "Inputs mapping " #define SHORTCUT_INPUTS CTRL_MOD "I" #define TOOLTIP_FULLSCREEN "Fullscreen " #define SHORTCUT_FULLSCREEN CTRL_MOD "Shift+F" @@ -358,8 +366,8 @@ public: class InputMappingInterface : public WorkspaceWindow { - std::array< std::string, 2 > input_mode; - std::array< uint, 2 > current_input_for_mode; + std::array< std::string, 3 > input_mode; + std::array< uint, 3 > current_input_for_mode; uint current_input_; diff --git a/defines.h b/defines.h index d2eaeca..887b680 100644 --- a/defines.h +++ b/defines.h @@ -71,16 +71,7 @@ #define SESSION_THUMBNAIL_HEIGHT 120.f #define RECORD_MAX_TIMEOUT 1200000 -#define IMGUI_TITLE_MAINWINDOW ICON_FA_CIRCLE_NOTCH " vimix" -#define IMGUI_TITLE_MEDIAPLAYER ICON_FA_PLAY_CIRCLE " Player" -#define IMGUI_TITLE_TIMER ICON_FA_CLOCK " Timer" -#define IMGUI_TITLE_INPUT_MAPPING ICON_FA_CUBES " Inputs Mapping" #define IMGUI_TITLE_LOGS ICON_FA_LIST_UL " Logs" -#define IMGUI_TITLE_HELP ICON_FA_LIFE_RING " Help" -#define IMGUI_TITLE_TOOLBOX ICON_FA_HAMSA " Guru Toolbox" -#define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Code Editor" -#define IMGUI_TITLE_PREVIEW ICON_FA_DESKTOP " Ouput" -#define IMGUI_TITLE_DELETE ICON_FA_BROOM " Delete?" #define IMGUI_LABEL_RECENT_FILES " Recent files" #define IMGUI_LABEL_RECENT_RECORDS " Recent recordings" #define IMGUI_RIGHT_ALIGN -3.5f * ImGui::GetTextLineHeightWithSpacing()