Esempio n. 1
0
void ChainShape::changeVertices(const Vector& from, const Vector& to)
{
	size_t index = 0;
	for (size_t n = m_vertices.size(); index < n; ++index)
	{
		if (m_vertices[index] == from)
			break;
	}

	if (index == m_vertices.size()) return;

	m_vertices[index] = to;
	if (from.x == m_rect.xMin || from.x == m_rect.xMax
		|| from.y == m_rect.yMin || from.y == m_rect.yMax)
		initBounding();
	else 
		m_rect.combine(to);
}
Esempio n. 2
0
void ChainShape::loadFromTextFile(std::ifstream& fin)
{
	m_vertices.clear();
	size_t size;
	fin >> size;
	m_vertices.reserve(size);
	for (size_t i = 0; i < size; ++i)
	{
		Vector pos;
		fin >> pos;
		m_vertices.push_back(pos);
	}

	fin >> m_isLoop;

// 	int isLoop;
// 	fin >> isLoop;
// 	m_isLoop = (isLoop == 1 ? true : false);

	initBounding();
}
Esempio n. 3
0
void CombinationSymbol::loadResources()
{
	CombinationFileAdapter adapter;
	adapter.load(m_filepath.c_str());

	for (size_t i = 0, n = adapter.m_data.size(); i < n; ++i)
	{
		ISprite* sprite = NULL;

		const CombinationFileAdapter::Entry& entry = adapter.m_data[i];
		ISymbol* symbol = SymbolMgr::Instance()->getSymbol(entry.filepath);
		sprite = SpriteFactory::Instance()->create(symbol);

		sprite->setTransform(entry.pos, entry.angle);
		sprite->setScale(entry.scale);
		sprite->setMirror(entry.xMirror, entry.yMirror);

		m_sprites.push_back(sprite);
	}

//	moveToCenter();

	initBounding();
}
Esempio n. 4
0
ChainShape::ChainShape(const std::vector<Vector>& vertices, bool isLoop)
	: m_vertices(vertices)
{
	m_isLoop = isLoop;
	initBounding();
}
Esempio n. 5
0
void ChainShape::setVertices(const std::vector<Vector>& vertices)
{
	m_vertices = vertices;
	initBounding();
}
Esempio n. 6
0
SkeletalSprite::SkeletalSprite(WholeSkeleton* skeleton)
{
	m_src = skeleton;
	m_skeleton = skeleton->clone();
	initBounding();
}