| 199 | if ( m_windows[i].m_typeID == s_controllerWindowTypeID ) |
| 200 | { |
| 201 | m_windows.erase_unsorted( m_windows.begin() + i ); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | // Create controller windows |
| 206 | TInlineString<100> str; |
| 207 | for ( int32_t i = 0; i < numControllers; i++ ) |
| 208 | { |
| 209 | auto DrawControllerStateLambda = [this] ( EntityWorldUpdateContext const& context, bool isFocused, uint64_t userData ) |
| 210 | { |
| 211 | auto pControllerDevice = m_pInputSystem->GetController( (uint32_t) userData ); |
| 212 | DrawControllerState( context, *pControllerDevice ); |
| 213 | }; |
| 214 | |
| 215 | str.sprintf( "Controller State: Controller %d", i ); |
| 216 | m_windows.emplace_back( str.c_str(), DrawControllerStateLambda ); |
| 217 | m_windows.back().m_typeID = s_controllerWindowTypeID; |
| 218 | m_windows.back().m_userData = i; |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | void InputDebugView::DrawControllerState( EntityWorldUpdateContext const& context, ControllerDevice const& controller ) |
| 224 | { |
| 225 | ImDrawList* pDrawList = ImGui::GetWindowDrawList(); |
| 226 | Float2 const FirstRowTopLeft = ImGui::GetCursorScreenPos(); |
| 227 | Float2 const triggerButtonDimensions( g_buttonWidth, ( g_analogStickRangeRadius * 2 ) + ( g_buttonWidth * 2 ) + 8 ); |
| 228 | |
| 229 | Float2 totalSize; |
| 230 | Float2 drawPosition; |
| 231 | |
| 232 | // Left Shoulder and trigger buttons |
| 233 | drawPosition = FirstRowTopLeft; |
| 234 | DrawButton( pDrawList, drawPosition, g_buttonDimensions, "LB", controller.IsHeldDown( Input::InputID::Controller_LeftShoulder ) ); |
| 235 | drawPosition.m_y += g_buttonDimensions.m_y; |
| 236 | DrawTriggerButton( pDrawList, drawPosition, triggerButtonDimensions, "LT", controller, true ); |
| 237 | |
| 238 | // Left analog stick |
| 239 | drawPosition = Float2( drawPosition.m_x + g_buttonDimensions.m_x + 9, FirstRowTopLeft.m_y ); |
| 240 | DrawAnalogStick( pDrawList, drawPosition, controller, true ); |
| 241 | |
| 242 | // Right analog stick |
| 243 | drawPosition = Float2( drawPosition.m_x + 26 + g_analogStickRangeRadius * 2, FirstRowTopLeft.m_y ); |
| 244 | DrawAnalogStick( pDrawList, drawPosition, controller, false ); |
| 245 | |
| 246 | // Right Shoulder and trigger buttons |
| 247 | drawPosition = Float2( drawPosition.m_x + g_analogStickRangeRadius * 2 + 9, FirstRowTopLeft.m_y ); |
nothing calls this directly
no test coverage detected