mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-06-17 07:22:01 +00:00
Cleanups
This commit is contained in:
@@ -177,23 +177,23 @@ void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection,
|
||||
#ifdef TAP_DETECTION
|
||||
IUIScene_AbstractContainerMenu::ETapState IUIScene_AbstractContainerMenu::GetTapInputType( float fInputX, float fInputY )
|
||||
{
|
||||
if ( ( fabs( fInputX ) < 0.3f ) && ( fabs( fInputY ) < 0.3f ) )
|
||||
if ( ( std::abs( fInputX ) < 0.3f ) && ( std::abs( fInputY ) < 0.3f ) )
|
||||
{
|
||||
return eTapStateNoInput;
|
||||
}
|
||||
else if ( ( fInputX < -0.3f ) && ( fabs( fInputY ) < 0.3f ) )
|
||||
else if ( ( fInputX < -0.3f ) && ( std::abs( fInputY ) < 0.3f ) )
|
||||
{
|
||||
return eTapStateLeft;
|
||||
}
|
||||
else if ( ( fInputX > 0.3f ) && ( fabs( fInputY ) < 0.3f ) )
|
||||
else if ( ( fInputX > 0.3f ) && ( std::abs( fInputY ) < 0.3f ) )
|
||||
{
|
||||
return eTapStateRight;
|
||||
}
|
||||
else if ( ( fInputY < -0.3f ) && ( fabs( fInputX ) < 0.3f ) )
|
||||
else if ( ( fInputY < -0.3f ) && ( std::abs( fInputX ) < 0.3f ) )
|
||||
{
|
||||
return eTapStateDown;
|
||||
}
|
||||
else if ( ( fInputY > 0.3f ) && ( fabs( fInputX ) < 0.3f ) )
|
||||
else if ( ( fInputY > 0.3f ) && ( std::abs( fInputX ) < 0.3f ) )
|
||||
{
|
||||
return eTapStateUp;
|
||||
}
|
||||
@@ -353,10 +353,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
}
|
||||
|
||||
// Clamp to pointer extents.
|
||||
if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX;
|
||||
else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX;
|
||||
if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY;
|
||||
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
|
||||
vPointerPos.x = std::clamp(vPointerPos.x, m_fPointerMinX, m_fPointerMaxX);
|
||||
vPointerPos.y = std::clamp(vPointerPos.y, m_fPointerMinY, m_fPointerMaxY);
|
||||
|
||||
bStickInput = true;
|
||||
m_eCurrTapState=eTapStateNoInput;
|
||||
@@ -368,10 +366,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// If there is any input on sticks, move the pointer.
|
||||
if ( ( fabs( fInputX ) >= 0.01f ) || ( fabs( fInputY ) >= 0.01f ) )
|
||||
if ( ( std::abs( fInputX ) >= 0.01f ) || ( std::abs( fInputY ) >= 0.01f ) )
|
||||
{
|
||||
m_bPointerDrivenByMouse = false;
|
||||
fInputDirX = ( fInputX > 0.0f ) ? 1.0f : ( fInputX < 0.0f )?-1.0f : 0.0f;
|
||||
@@ -438,7 +434,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
m_fPointerAccelX += fInputX / 50.0f;
|
||||
m_fPointerAccelY += fInputY / 50.0f;
|
||||
|
||||
if ( fabsf( fInputX ) > fabsf( m_fPointerVelX + m_fPointerAccelX ) )
|
||||
if ( std::abs( fInputX ) > std::abs( m_fPointerVelX + m_fPointerAccelX ) )
|
||||
{
|
||||
m_fPointerVelX += m_fPointerAccelX;
|
||||
}
|
||||
@@ -448,7 +444,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
m_fPointerVelX = fInputX;
|
||||
}
|
||||
|
||||
if ( fabsf( fInputY ) > fabsf( m_fPointerVelY + m_fPointerAccelY ) )
|
||||
if ( std::abs( fInputY ) > std::abs( m_fPointerVelY + m_fPointerAccelY ) )
|
||||
{
|
||||
m_fPointerVelY += m_fPointerAccelY;
|
||||
}
|
||||
@@ -467,10 +463,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
vPointerPos.y -= fInputY;
|
||||
#endif
|
||||
// Clamp to pointer extents.
|
||||
if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX;
|
||||
else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX;
|
||||
if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY;
|
||||
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
|
||||
vPointerPos.x = std::clamp(vPointerPos.x, m_fPointerMinX, m_fPointerMaxX);
|
||||
vPointerPos.y = std::clamp(vPointerPos.y, m_fPointerMinY, m_fPointerMaxY);
|
||||
|
||||
bStickInput = true;
|
||||
}
|
||||
@@ -514,7 +508,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
bool bPointerIsOverSlot = false;
|
||||
|
||||
// Centre position of item under pointer, use this to snap pointer to item.
|
||||
D3DXVECTOR3 vSnapPos;
|
||||
DirectX::XMFLOAT2 vSnapPos;
|
||||
|
||||
for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection )
|
||||
{
|
||||
@@ -739,10 +733,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||
}
|
||||
|
||||
// Clamp to pointer extents.
|
||||
if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX;
|
||||
else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX;
|
||||
if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY;
|
||||
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
|
||||
vPointerPos.x = std::clamp(vPointerPos.x, m_fPointerMinX, m_fPointerMaxX);
|
||||
vPointerPos.y = std::clamp(vPointerPos.y, m_fPointerMinY, m_fPointerMaxY);
|
||||
|
||||
// Check if the pointer is outside of the panel.
|
||||
bool bPointerIsOutsidePanel = false;
|
||||
|
||||
Reference in New Issue
Block a user