예제 #1
0
void SpriteGroup::Render()
{
	Element::Render();

	for (int i = 0; i < m_sprite_list.size(); ++i)
	{
		Sprite* sprite = m_sprite_list.at(i);
		sprite->Render();

		sprite->SetPosition(
			sprite->GetPositionX() - GetPositionX(),
			sprite->GetPositionY() - GetPositionY(),
			sprite->GetPositionZ() - GetPositionZ());

		sprite->SetAngle(
			sprite->GetAngleX() - GetAngleX(),
			sprite->GetAngleY() - GetAngleY(),
			sprite->GetAngleZ() - GetAngleZ());

		sprite->SetAnchor(
			sprite->GetAnchorX() * 2.0f - GetAnchorX(),
			sprite->GetAnchorY() * 2.0f - GetAnchorY());

		if (GetScaleX() != 0)
		{
			sprite->SetScaleX(sprite->GetScaleX() / GetScaleX());
		}
		if (GetScaleY() != 0)
		{
			sprite->SetScaleY(sprite->GetScaleY() / GetScaleY());
		}
	}
}
예제 #2
0
void SpriteGroup::Update(const float& delta)
{
	Element::Update(delta);

	for (int i = 0; i < m_sprite_list.size(); ++i)
	{
		Sprite* sprite = m_sprite_list.at(i);
		sprite->SetPosition(
			sprite->GetPositionX() + GetPositionX(),
			sprite->GetPositionY() + GetPositionY(),
			sprite->GetPositionZ() + GetPositionZ());

		sprite->SetAngle(
			sprite->GetAngleX() + GetAngleX(),
			sprite->GetAngleY() + GetAngleY(),
			sprite->GetAngleZ() + GetAngleZ());

		sprite->SetAnchor(
			(sprite->GetAnchorX() + GetAnchorX()) / 2.0f,
			(sprite->GetAnchorY() + GetAnchorY()) / 2.0f);

		sprite->SetScale(
			sprite->GetScaleX() * GetScaleX(),
			sprite->GetScaleY() * GetScaleY());

		sprite->Update(delta);
	}
}