예제 #1
0
void UIComponentTreeView::updateItemPositions()
{
	float offset_y = 0.f;
	for(size_t i = 0; i < mParent->getChildCount(); ++i)
	{
		UIView* child = mParent->getChild(i);
		child->setPosition(child->getPosition().x, mParent->getPosition().y + offset_y);

		offset_y += child->getSize().y + 2.f;

		if(mSubTreeView)
		{
			Log("Child %d sizeY %f stays at %f", i, child->getSize().y, child->getPosition().y);
		}
	}
}
예제 #2
0
파일: UIView.cpp 프로젝트: YurieCo/Nephilim
void UIView::setLocalPosition(float x, float y)
{
	UIView* parent = getParent();
	if(parent)
	{
		setPosition(parent->getPosition() + vec2(x,y));
	}
}
예제 #3
0
파일: UIView.cpp 프로젝트: YurieCo/Nephilim
vec2 UIView::getLocalPosition()
{
	UIView* parent = getParent();
	
	if(!parent)
		return vec2(0.f, 0.f);

	return getPosition() - parent->getPosition();
}