本文整理匯總了C++中Animation函數的典型用法代碼示例。如果您正苦於以下問題:C++ Animation函數的具體用法?C++ Animation怎麽用?C++ Animation使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Animation函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: walk_velocity_
GameEntity::GameEntity(): walk_velocity_(10.0), jump_velocity_(160.0), // TODO send to constructor
direction_(1.0),
position_(0.0, 0.0), velocity_(0.0, 0.0),
state_(&AState::standing_state), // TODO should not be static
animations_(),
frame_data_component_(),
inputs_component_(),
physics_component_(),
graphics_component_() {
animations_[0] = Animation();
animations_[1] = Animation();
animations_[2] = Animation();
}
示例2: Animation
Animation AnimationList::operator[](unsigned int index){
try{
if(index > anims.size() - 1)
throw 0;
else{
return Animation(anims[index]);
}
}
catch(int){
std::cerr << "Can't access AnimationList[" << index << "], returning AnimationList[0]." << std::endl;
return Animation(anims[0]);
}
}
示例3: initAnimations
void BoardActor::initAnimations(){
animations.clear();
animations.push_back(Animation());
animations.push_back(Animation());
animations[0].addFrame(Frame(Coordinate2D<double>(.25,0), Coordinate2D<double>(.5,1), .04)); //idle
animations[0].addFrame(Frame(Coordinate2D<double>(.75,0), Coordinate2D<double>(1,1), .04)); //idle
animations[1].addFrame(Frame(Coordinate2D<double>(0,0), Coordinate2D<double>(.25,1), .04)); //moving
animations[1].addFrame(Frame(Coordinate2D<double>(.5,0), Coordinate2D<double>(.75,1), .04)); //moving
spriteSheet = BlitHelper::loadImageGL("C:\\Users\\banan\\workspace\\SpaghettiWestern\\Resources\\adude.bmp");
active_animation = 0;
}
示例4: Animation
Obj::Obj(nl::node src)
{
animation = Animation(nl::nx::map["Obj"][src["oS"] + ".img"][src["l0"]][src["l1"]][src["l2"]]);
pos = Point<int16_t>(src["x"], src["y"]);
flip = src["f"].get_bool();
z = src["z"];
}
示例5: switch
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Name : 更新
// Description : いろんな更新
// Arguments : ないよ
// Returns : ないよ
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
void CFlower::Update()
{
switch(m_nPhase)
{
case FLOWER_PHASE_INIT:
m_lastTime = CTimer::GetTime();
m_nPhase++;
break;
case FLOWER_PHASE_START:
RotationZ((float)(m_nowTime - m_lastTime) * m_rotSpd);
m_nowTime = CTimer::GetTime();
if(m_nowTime - m_lastTime > abs(m_rotSpd)){
m_nPhase = FLOWER_PHASE_FLOWER;
}
break;
case FLOWER_PHASE_FLOWER:
RotationZ(m_rotSpd * abs(m_rotSpd));
break;
case FLOWER_PHASE_WAIT:
RotationZ(m_rotSpd);
break;
case FLOWER_PHASE_UNINIT:
break;
}
Translate(m_pos);
Animation();
}
示例6: rand
void Bear::Update(float _Time, int** _Terrain,float _MaxWidth,float _MaxHeight)
{
if(getLife() == false)
{
int random ;
random = rand() % 4 ;
switch(random)
{
case 0 :
Item *_item = new Item(m_X,m_Y);
ManagerObject::Instance()->getListItem()->push_back(_item);
break ;
}
EffectDieBear *_EffectDie = new EffectDieBear(this,m_X,m_Y);
ManagerObject ::Instance()->getListEffect()->push_back(_EffectDie);
}
if(m_skillManager->getSkill(0)->getSTT()==ACTIVE)
{
m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight);
}
else if(m_skillManager->getSkill(0)->getSTT() !=ACTIVE)
{
if(getFrenzy() ==false)
{
Move(_Time,_Terrain,_MaxWidth,_MaxHeight);
}
Animation(_Time);
UpdateStatus(_Time);
m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); //??
}
}
示例7: Animation
//-----------------------------------------------------------------------
Animation* Animation::clone(const String& newName) const
{
Animation* newAnim = OGRE_NEW Animation(newName, mLength);
newAnim->mInterpolationMode = mInterpolationMode;
newAnim->mRotationInterpolationMode = mRotationInterpolationMode;
// Clone all tracks
for (NodeTrackList::const_iterator i = mNodeTrackList.begin();
i != mNodeTrackList.end(); ++i)
{
i->second->_clone(newAnim);
}
for (NumericTrackList::const_iterator i = mNumericTrackList.begin();
i != mNumericTrackList.end(); ++i)
{
i->second->_clone(newAnim);
}
for (VertexTrackList::const_iterator i = mVertexTrackList.begin();
i != mVertexTrackList.end(); ++i)
{
i->second->_clone(newAnim);
}
newAnim->_keyFrameListChanged();
return newAnim;
}
示例8: Animation
void myCam::queueAnimation(QVector3D ziel, QVector3D zielLookat, int duration)
{
Animation aniNew = Animation(ziel,zielLookat,duration);
this->animations.push_back(aniNew);
if (!this->isMoving)
this->nextAnimation();
}
示例9: Animation
bool CSprite::DrawFinalize( )
{
// アニメーション行うときは、こいつを実行
Animation( );
// m_DispObj->SetBlendColor(0);
return TRUE;
}
示例10: staticAnim
void Game::loadTiles()
{
Animation staticAnim(0, 0, 1.0f);
this->tileAtlas["grass"] =
Tile(this->tileSize, 1, texmgr.getRef("grass"),
{ staticAnim },
TileType::GRASS, 50, 0, 1);
this->tileAtlas["forest"] =
Tile(this->tileSize, 1, texmgr.getRef("forest"),
{ staticAnim },
TileType::FOREST, 100, 0, 1);
this->tileAtlas["water"] =
Tile(this->tileSize, 1, texmgr.getRef("water"),
{ Animation(0, 3, 0.5f),
Animation(0, 3, 0.5f),
Animation(0, 3, 0.5f) },
TileType::WATER, 0, 0, 1);
this->tileAtlas["residental"] =
Tile(this->tileSize, 2, texmgr.getRef("residental"),
{ staticAnim, staticAnim, staticAnim,
staticAnim, staticAnim, staticAnim },
TileType::RESIDENTIAL, 300, 50, 6);
this->tileAtlas["commercial"] =
Tile(this->tileSize, 2, texmgr.getRef("commercial"),
{ staticAnim, staticAnim, staticAnim, staticAnim },
TileType::COMMERCIAL, 300, 50, 4);
this->tileAtlas["industrial"] =
Tile(this->tileSize, 2, texmgr.getRef("industrial"),
{ staticAnim, staticAnim, staticAnim, staticAnim },
TileType::INDUSTRIAL, 300, 50, 4);
this->tileAtlas["road"] =
Tile(this->tileSize, 1, texmgr.getRef("road"),
{ staticAnim, staticAnim, staticAnim, staticAnim,
staticAnim, staticAnim, staticAnim, staticAnim,
staticAnim, staticAnim, staticAnim },
TileType::ROAD, 100, 0, 1);
return;
}
示例11: AnimatedSprite
VillagerC::VillagerC()
{
Texture* tex = textureLoader::getTexture("friendly_npcs");
AnimatedSprite sprite = AnimatedSprite(&tex->texture, 0, 0, tex->cellWidth, tex->cellHeight, 0 * tex->uSize, 5 * tex->vSize, 1 * tex->uSize, 1 * tex->vSize);
*this = VillagerC((VillagerC&)sprite);
type = 1;
name = "villagerC";
isAnimated = false;
//Setup Collider
int xOffset = 18;
int yOffset = 15;
int width = 28;
int height = 45;
float uSize = 1;
float vSize = 1;
colliderXOffset = xOffset;
colliderYOffset = yOffset;
setCollider(&AABB(x + xOffset, y + yOffset, width, height));
maxSpeed = 50;
isColliderDrawn = false;
// Walking Animation
int numFrames = 1;
int timeToNextFrame = 300;
std::vector<AnimationFrame> frames;
frames.assign(numFrames, AnimationFrame());
frames[0] = AnimationFrame(0, 5, uSize, vSize);
//frames[1] = AnimationFrame(1, 0, uSize, vSize);
Animation animation_walking = Animation("Walking", frames, numFrames);
animations[animation_walking.name] = AnimationData(animation_walking, timeToNextFrame, true);
// Idle Animation
numFrames = 1;
frames.clear();
frames.assign(numFrames, AnimationFrame());
frames[0] = AnimationFrame(0, 5, uSize, vSize);
Animation animation_idle = Animation("Idle", frames, numFrames);
animations[animation_idle.name] = AnimationData(animation_idle, timeToNextFrame, true);
//setAnimation("Walking");
}
示例12:
AnimationList::AnimationList(bool){
//std::vector<Frame*> f;
//f.push_back(frameList[0]);
//f.push_back(frameList[1]);
anims.push_back(Animation());
anims.back().AddFrame(*frameList[0]);
anims.back().AddFrame(*frameList[1]);
//anims.back().AddFrame(frameList[0]);
//anims.back().AddFrame(frameList[1]);
}
示例13: initAllModels
void Character::onInit()
{
Game::Object::onInit();
model.deserialize("model_shiveil.txt");
initAllModels();
addCollider(CircleCollider(Vector2D(), 50.f));
idAnimAtU = addResource(Resource<float>());
getResource_f(idAnimAtU).resetVelocity = 0.75;
getResource_f(idAnimAtU).inverseMass = 0.5;
idAnimAtH = addResource(Resource<float>());
getResource_f(idAnimAtH).resetVelocity = 0.75;
getResource_f(idAnimAtH).inverseMass = 0.5;
setInput("up", Control::Input(sf::Keyboard::W));
setInput("down", Control::Input(sf::Keyboard::S));
setInput("left", Control::Input(sf::Keyboard::A));
setInput("right", Control::Input(sf::Keyboard::D));
setInput("s1", Control::Input(sf::Mouse::Left));
setInput("s2", Control::Input(sf::Mouse::Right));
addAnimation("block", Animation("animBlockShield.txt"));
addAnimation("atackH", Animation("swordAnim.txt"));
addAnimation("atackU", Animation("swordAnimPush.txt"));
// realms
// position
getPos().inverseMass = 0.9f;
getPos().resetVelocity = 0.8f;
// rotation
getRot().inverseMass = 0.5;
getRot().resetVelocity = 0.75f;
gen.addParticle("particleTest.txt", 250, 1);
//genSword.addParticle("swordParticle.txt", 50, 0.5);
}
示例14: al_premul_rgba
void Peacemaker::firesecondary(Gamestate *state)
{
double spread = (2*(rand()/(RAND_MAX+1.0)) - 1)*25*3.1415/180.0;
double cosa = std::cos(aimdirection+spread), sina = std::sin(aimdirection+spread);
double collisionptx, collisionpty;
EntityPtr target = state->collidelinedamageable(x, y, x+cosa*FALLOFF_END, y+sina*FALLOFF_END, team, &collisionptx, &collisionpty);
if (target.id != 0)
{
double distance = std::hypot(collisionptx-x, collisionpty-y);
double falloff = 1.0;
if (distance > FALLOFF_BEGIN)
{
falloff = std::max(0.0, (distance-FALLOFF_BEGIN) / (FALLOFF_END-FALLOFF_BEGIN));
}
MovingEntity *m = state->get<MovingEntity>(target);
if (m->entitytype == CHARACTER)
{
Character *c = reinterpret_cast<Character*>(m);
c->damage(state, MAX_FTH_DAMAGE*falloff);
}
}
state->make_entity<Trail>(state, al_premul_rgba(133, 238, 238, 150), x+cosa*24, y+sina*24, collisionptx, collisionpty, 0.1);
Explosion *e = state->get<Explosion>(state->make_entity<Explosion>(state, "heroes/mccree/projectiletrail/", aimdirection+spread));
e->x = x+cosa*24;
e->y = y+sina*24;
--clip;
if (clip > 0 and state->engine->isserver)
{
if (isfthing)
{
fthanim = Animation("heroes/mccree/fanthehammerloop/", std::bind(&Peacemaker::wantfiresecondary, this, state));
}
else
{
fthanim = Animation("heroes/mccree/fanthehammerstart/", std::bind(&Peacemaker::wantfiresecondary, this, state));
isfthing = true;
}
}
}
示例15: AnimatedSprite
Chicken::Chicken()
{
Texture* tex = textureLoader::getTexture("cucco");
AnimatedSprite sprite = AnimatedSprite(&tex->texture, 0, 0, tex->width, tex->height, 0, 0, 0.5, 1);
*this = Chicken((Chicken&)sprite);
type = 1;
name = "cucco";
//Setup Collider
int xOffset = 20;
int yOffset = 25;
int width = 20;
int height = 20;
float uSize = 0.5;
float vSize = 1;
colliderXOffset = xOffset;
colliderYOffset = yOffset;
setCollider(&AABB(x + xOffset, y + yOffset, width, height));
maxSpeed = 50;
// Walking Animation
int numFrames = 2;
int timeToNextFrame = 300;
std::vector<AnimationFrame> frames;
frames.assign(numFrames, AnimationFrame());
frames[0] = AnimationFrame(0, 0, uSize, vSize);
frames[1] = AnimationFrame(0.5, 0, uSize, vSize);
Animation animation_walking = Animation("Walking", frames, numFrames);
animations[animation_walking.name] = AnimationData(animation_walking, timeToNextFrame, true);
// Idle Animation
numFrames = 1;
frames.clear();
frames.assign(numFrames, AnimationFrame());
frames[0] = AnimationFrame(0, 0, uSize, vSize);
Animation animation_idle = Animation("Idle", frames, numFrames);
animations[animation_idle.name] = AnimationData(animation_idle, timeToNextFrame, true);
setAnimation("Walking");
}