예제 #1
0
 void PhysicsObject::SetLocalX(float aX, double aDuration, EasingFunction aEasingFunction, bool aReverse, int aRepeatCount)
 {
     if(aDuration == 0.0)
     {
         //Set the x position
         m_Position.x = aX;
         
         //Set the transform bit in the update flags
         m_UpdateFlags |= PhysicsUpdateTransform;
     }
     else
     {
         if(GetLocalX() != aX)
         {
             m_TweenLocalX.Set(GetLocalX(), aX, aDuration, aEasingFunction, aReverse, aRepeatCount);
         }
     }
 }
예제 #2
0
 vec2 Tile::GetCenter(bool aWorldPosition)
 {
     if(aWorldPosition == true)
     {
         return vec2(GetWorldX() + (GetSize() / 2), GetWorldY() + (GetSize() / 2));
     }
     
     return vec2(GetLocalX() + (GetSize() / 2), GetLocalY() + (GetSize() / 2));
 }
예제 #3
0
파일: Button.cpp 프로젝트: doorxp/seed
INLINE void Button::UpdateLabel()
{
	if (bLabelAutoUpdate)
	{
		cLabel.SetRotation(GetRotation());
		cLabel.SetScaleX(GetScaleX());
		cLabel.SetScaleY(GetScaleY());
		cLabel.SetLocalX(GetLocalX());
		cLabel.SetLocalY(GetLocalY());
	}

	cLabel.SetY(0.0f);
	switch (eLabelVAlignment)
	{
		case VerticalAlignTop:
		{
		}
		break;

		case VerticalAlignCenter:
		{
			cLabel.SetY((this->GetHeight() - cLabel.GetHeight()) / 2.0f);
		}
		break;

		case VerticalAlignBottom:
		{
			cLabel.SetY(this->GetHeight() - cLabel.GetHeight());
		}
		break;

		default:
			cLabel.SetY(fLabelOffsetY);
		break;
	}

	cLabel.SetX(0.0f);
	switch (eLabelHAlignment)
	{
		case HorizontalAlignLeft:
		{
		}
		break;

		case HorizontalAlignCenter:
		{
			cLabel.SetX((this->GetWidth() - cLabel.GetWidth()) / 2.0f);
		}
		break;

		case HorizontalAlignRight:
		{
			cLabel.SetX(this->GetWidth() - cLabel.GetWidth());
		}
		break;

		default:
			cLabel.SetX(fLabelOffsetX);
		break;
	}
}