@ -172,7 +172,6 @@ void ImGuiManager::Initialize()
// Broadcast ImGui Ready to Listeners
ImGuiUpdateListenerBus : : Broadcast ( & IImGuiUpdateListener : : OnImGuiInitialize ) ;
m_currentControllerIndex = - 1 ;
m_button1Pressed = m_button2Pressed = false ;
m_menuBarStatusChanged = false ;
@ -227,6 +226,7 @@ void ImGui::ImGuiManager::RestoreRenderWindowSizeToDefault()
void ImGui : : ImGuiManager : : SetDpiScalingFactor ( float dpiScalingFactor )
{
ImGui : : ImGuiContextScope contextScope ( m_imguiContext ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
// Set the global font scale to size our UI to the scaling factor
// Note: Currently we use the default, 13px fixed-size IMGUI font, so this can get somewhat blurry
@ -235,6 +235,7 @@ void ImGui::ImGuiManager::SetDpiScalingFactor(float dpiScalingFactor)
float ImGui : : ImGuiManager : : GetDpiScalingFactor ( ) const
{
ImGui : : ImGuiContextScope contextScope ( m_imguiContext ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
return io . FontGlobalScale ;
}
@ -406,7 +407,7 @@ bool ImGuiManager::OnInputChannelEventFiltered(const InputChannel& inputChannel)
// Cycle through ImGui Menu Bar States on Home button press
if ( inputChannelId = = InputDeviceKeyboard : : Key : : NavigationHome )
{
ToggleThroughImGuiVisibleState ( - 1 ) ;
ToggleThroughImGuiVisibleState ( ) ;
}
// Cycle through Standalone Editor Window States
@ -453,19 +454,10 @@ bool ImGuiManager::OnInputChannelEventFiltered(const InputChannel& inputChannel)
}
// Handle Controller Inputs
int inputControllerIndex = - 1 ;
bool controllerInput = false ;
if ( InputDeviceGamepad : : IsGamepadDevice ( inputDeviceId ) )
{
inputControllerIndex = inputDeviceId . GetIndex ( ) ;
controllerInput = true ;
}
if ( controllerInput )
{
// Only pipe in Controller Nav Inputs if we are the current Controller Index and at least 1 of the two controller modes are enabled.
if ( m_currentControllerIndex = = inputControllerIndex & & m_controllerModeFlags )
// Only pipe in Controller Nav Inputs when at least 1 of the two controller modes are enabled.
if ( m_controllerModeFlags )
{
const auto lyButtonToImGuiNav = s_lyInputToImGuiNavIndexMap . find ( inputChannelId ) ;
if ( lyButtonToImGuiNav ! = s_lyInputToImGuiNavIndexMap . end ( ) )
@ -476,7 +468,7 @@ bool ImGuiManager::OnInputChannelEventFiltered(const InputChannel& inputChannel)
}
//Switch menu bar display only if two buttons are pressed at the same time
if ( inputChannelId = = InputDeviceGamepad : : Button : : L 3 )
if ( inputChannelId = = InputDeviceGamepad : : Button : : L 1 )
{
if ( inputChannel . IsStateBegan ( ) )
{
@ -488,7 +480,7 @@ bool ImGuiManager::OnInputChannelEventFiltered(const InputChannel& inputChannel)
m_menuBarStatusChanged = false ;
}
}
if ( inputChannelId = = InputDeviceGamepad : : Button : : R 3 )
if ( inputChannelId = = InputDeviceGamepad : : Button : : R 1 )
{
if ( inputChannel . IsStateBegan ( ) )
{
@ -502,7 +494,7 @@ bool ImGuiManager::OnInputChannelEventFiltered(const InputChannel& inputChannel)
}
if ( ! m_menuBarStatusChanged & & m_button1Pressed & & m_button2Pressed )
{
ToggleThroughImGuiVisibleState ( inputControllerIndex ) ;
ToggleThroughImGuiVisibleState ( ) ;
}
// If we have the Discrete Input Mode Enabled.. and we are in the Visible State, then consume input here
@ -627,14 +619,13 @@ bool ImGuiManager::OnInputTextEventFiltered(const AZStd::string& textUTF8)
return io . WantTextInput & & m_clientMenuBarState = = DisplayState : : Visible ; ;
}
void ImGuiManager : : ToggleThroughImGuiVisibleState ( int controllerIndex )
void ImGuiManager : : ToggleThroughImGuiVisibleState ( )
{
ImGui : : ImGuiContextScope contextScope ( m_imguiContext ) ;
switch ( m_clientMenuBarState )
{
case DisplayState : : Hidden :
m_currentControllerIndex = controllerIndex ;
m_clientMenuBarState = DisplayState : : Visible ;
// Draw the ImGui Mouse cursor if either the hardware mouse is connected, or the controller mouse is enabled.
@ -669,7 +660,6 @@ void ImGuiManager::ToggleThroughImGuiVisibleState(int controllerIndex)
default :
m_clientMenuBarState = DisplayState : : Hidden ;
m_currentControllerIndex = - 1 ;
// Enable system cursor if it's in editor and it's not editor game mode
if ( gEnv - > IsEditor ( ) & & ! gEnv - > IsEditorGameMode ( ) )
@ -686,12 +676,6 @@ void ImGuiManager::ToggleThroughImGuiVisibleState(int controllerIndex)
m_setEnabledEvent . Signal ( m_clientMenuBarState = = DisplayState : : Hidden ) ;
}
void ImGuiManager : : ToggleThroughImGuiVisibleState ( )
{
ToggleThroughImGuiVisibleState ( - 1 ) ;
}
void ImGuiManager : : RenderImGuiBuffers ( const ImVec2 & scaleRects )
{
ImGui : : ImGuiContextScope contextScope ( m_imguiContext ) ;