| 33 | static void DrawButton( ImDrawList* pDrawList, Float2 const& position, Float2 const& dimensions, char const* const pLabel, bool IsHeldDown, uint32_t buttonColor = g_controlOutlineColor, uint32_t pressedColor = g_controlFillColor ) |
| 34 | { |
| 35 | EE_ASSERT( pDrawList != nullptr ); |
| 36 | Float2 const buttonTopLeft = position; |
| 37 | Float2 const buttonBottomRight = buttonTopLeft + dimensions; |
| 38 | pDrawList->AddRect( buttonTopLeft, buttonBottomRight, buttonColor, g_buttonBorderRounding, g_buttonBorderThickness, ImDrawFlags_RoundCornersAll ); |
| 39 | |
| 40 | if ( IsHeldDown ) |
| 41 | { |
| 42 | pDrawList->AddRectFilled( buttonTopLeft + g_buttonBorderOffset, buttonTopLeft + dimensions - g_buttonBorderOffset, pressedColor, g_buttonBorderRounding - 1, ImDrawFlags_RoundCornersAll ); |
| 43 | } |
| 44 | |
| 45 | if ( pLabel != nullptr ) |
| 46 | { |
| 47 | Float2 const textDimensions = ImGui::CalcTextSize( pLabel ); |
| 48 | Float2 const textPos = Float2( buttonTopLeft.m_x + ( dimensions.m_x / 2 ) - ( textDimensions.m_x / 2 ) + 1, buttonTopLeft.m_y + ( dimensions.m_y / 2 ) - ( textDimensions.m_y / 2 ) ); |
| 49 | pDrawList->AddText( textPos, 0xFFFFFFFF, pLabel ); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | static void DrawTriggerButton( ImDrawList* pDrawList, Float2 const& position, Float2 const& dimensions, char const* const pLabel, ControllerDevice const& controller, bool isLeftTrigger ) |
| 54 | { |
| 55 | EE_ASSERT( pDrawList != nullptr ); |
| 56 |
no test coverage detected