本文整理汇总了C++中Graphic::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphic::Initialize方法的具体用法?C++ Graphic::Initialize怎么用?C++ Graphic::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphic
的用法示例。
在下文中一共展示了Graphic::Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
// |----------------------------------------------------------------------------|
// | Initialize |
// |----------------------------------------------------------------------------|
bool Player::Initialize() {
GameObject::Initialize();
// Set up ship
Graphic* graphic = new Graphic;
graphic->SetTint(1.0f,1.0f,1.0f,1.0f);
graphic->SetShader("Texture");
graphic->SetShader("Light");
graphic->SetTexture("shiptexture");
graphic->SetModel("ship");
graphic->SetScale(Coord(0.01f,0.01f,0.01f));
graphic->SetReflectiveness(0.95f);
graphic->Initialize();
m_ship = new GameObject;
m_ship->Initialize();
m_ship->SetGraphic(graphic);
m_ship->SetPosition(Coord(0.0f,0.0f,0.0f));
m_ship->SetOrientation(Coord(0.0f,0.0f,0.0f));
// Set up left thruster
m_leftThruster = new ParticleSystem;
m_leftThruster->Initialize();
graphic = new Billboard;
graphic->SetShader("Texture");
graphic->SetTexture("fireball");
graphic->SetAlphaBlend(true);
graphic->SetScale(Coord(0.003f,0.003f,0.003f));
graphic->Initialize();
m_leftThruster->SetGraphic(graphic);
m_leftThruster->SetPosition(Coord(-0.6f,0.0f,-0.7f));
m_leftThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
m_leftThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
m_leftThruster->SetParticleSpawnFrequency(0.01f);
m_leftThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
m_leftThruster->SetParticleLifetime(0.5f);
m_leftThruster->SetParticleFadeout(0.2f);
m_leftThruster->SetMaxParticles(100);
m_leftThruster->SetTint(0.8f,0.9f,1.0f);
m_leftThruster->SetTintVar(0.2f,0.2f,0.2f);
// Set up right thruster
m_rightThruster = new ParticleSystem;
m_rightThruster->Initialize();
graphic = new Billboard;
graphic->SetShader("Texture");
graphic->SetTexture("fireball");
graphic->SetAlphaBlend(true);
graphic->SetScale(Coord(0.003f,0.003f,0.003f));
graphic->Initialize();
m_rightThruster->SetGraphic(graphic);
m_rightThruster->SetPosition(Coord(0.6f,0.0f,-0.7f));
m_rightThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
m_rightThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
m_rightThruster->SetParticleSpawnFrequency(0.001f);
m_rightThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
m_rightThruster->SetParticleLifetime(0.5f);
m_rightThruster->SetParticleFadeout(0.2f);
m_rightThruster->SetMaxParticles(100);
m_rightThruster->SetTint(0.8f,0.9f,1.0f);
m_rightThruster->SetTintVar(0.2f,0.2f,0.2f);
DebugLog ("Player: object initialized.");
return true;
}