本文整理汇总了C++中Explosion::Initialise方法的典型用法代码示例。如果您正苦于以下问题:C++ Explosion::Initialise方法的具体用法?C++ Explosion::Initialise怎么用?C++ Explosion::Initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explosion
的用法示例。
在下文中一共展示了Explosion::Initialise方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Explosion
void
Game::SpawnExplosion(int x, int y)
{
Explosion* explosion = new Explosion();
explosion->SetPositionX(x - 10);
explosion->SetPositionY(y - 10);
AnimatedSprite* exploding = m_pBackBuffer->CreateAnimatedSprite("assets\\explosion.png");
exploding->SetLooping(false);
exploding->SetFrameWidth(64);
exploding->SetFrameSpeed(0.05);
exploding->AddFrame(0);
exploding->AddFrame(64);
exploding->AddFrame(128);
exploding->AddFrame(192);
exploding->AddFrame(256);
explosion->Initialise(exploding);
Explosions.push_back(explosion);
}
示例2: Explosion
void
Game::SpawnExplosion(int x, int y)
{
Sprite* aS = m_pBackBuffer->CreateSprite("assets\\explosion.png");
// create an explosion object
Explosion* explosion = new Explosion();
// initialize the texture
if (!explosion->Initialise(*aS->GetTexture())) {
LogManager::GetInstance().Log("Explosion Init Fail!");
return;
}
// set the width and speed of the animation
int fw = aS->GetWidth() / 5;
explosion->SetFrameWidth(fw); // 5 frames in the animation
explosion->SetFrameSpeed(0.1f);
for (int i = 0; i < 5; i++) {
explosion->AddFrame(i * fw);
}
// set the center points for visual alignment
explosion->SetCenter(fw / 2, aS->GetHeight() / 2);
// set the x and y
explosion->SetX(x - explosion->GetCenterX() / 2);
explosion->SetY(y - explosion->GetCenterY() / 2);
// add to the explosion container
m_explosion.push_back(explosion);
}