本文整理汇总了C++中ParticleEmitter::setSpriteFrameCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::setSpriteFrameCoords方法的具体用法?C++ ParticleEmitter::setSpriteFrameCoords怎么用?C++ ParticleEmitter::setSpriteFrameCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::setSpriteFrameCoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
ParticleEmitter* ParticleEmitter::create(const char* textureFile, TextureBlending textureBlending, unsigned int particleCountMax)
{
Texture* texture = NULL;
texture = Texture::create(textureFile, false);
if (!texture)
{
GP_ERROR("Failed to create texture for particle emitter.");
return NULL;
}
GP_ASSERT(texture->getWidth());
GP_ASSERT(texture->getHeight());
// Use default SpriteBatch material.
SpriteBatch* batch = SpriteBatch::create(texture, NULL, particleCountMax);
texture->release(); // batch owns the texture.
GP_ASSERT(batch);
ParticleEmitter* emitter = new ParticleEmitter(batch, particleCountMax);
GP_ASSERT(emitter);
// By default assume only one frame which uses the entire texture.
emitter->setTextureBlending(textureBlending);
emitter->_spriteTextureWidth = texture->getWidth();
emitter->_spriteTextureHeight = texture->getHeight();
emitter->_spriteTextureWidthRatio = 1.0f / (float)texture->getWidth();
emitter->_spriteTextureHeightRatio = 1.0f / (float)texture->getHeight();
Rectangle texCoord((float)texture->getWidth(), (float)texture->getHeight());
emitter->setSpriteFrameCoords(1, &texCoord);
return emitter;
}