• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Animation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Animation函数的典型用法代码示例。如果您正苦于以下问题:C++ Animation函数的具体用法?C++ Animation怎么用?C++ Animation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Animation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:adrien-bougouin,项目名称:legendary-fighters,代码行数:13,代码来源:game_entity.cpp


示例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]);
    }
}
开发者ID:Beulard,项目名称:beul,代码行数:13,代码来源:AnimatedTile.cpp


示例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;
}
开发者ID:SpaghettiWestern,项目名称:SpaghettiWestern,代码行数:14,代码来源:BoardActor.cpp


示例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"];
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:7,代码来源:Obj.cpp


示例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();

}
开发者ID:Kon-Iku,项目名称:graine,代码行数:37,代码来源:Flower.cpp


示例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); //??
	}
}
开发者ID:NguyenMinhTri,项目名称:bigse-game2d,代码行数:32,代码来源:Bear.cpp


示例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;

	}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:28,代码来源:OgreAnimation.cpp


示例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();
		
}
开发者ID:ragemcmad,项目名称:CGBillard,代码行数:8,代码来源:cam.cpp


示例9: Animation

bool CSprite::DrawFinalize( )
{
	// アニメーション行うときは、こいつを実行
	Animation( );

//	m_DispObj->SetBlendColor(0);
	return TRUE;
}
开发者ID:childs-heart,项目名称:ChiruhaSyana,代码行数:8,代码来源:CLIB_Sprite.cpp


示例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;
}
开发者ID:Agrhor,项目名称:CityBuilder,代码行数:45,代码来源:Game.cpp


示例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");
}
开发者ID:D4rkFr4g,项目名称:zRPG,代码行数:44,代码来源:VillagerC.cpp


示例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]);
}
开发者ID:Beulard,项目名称:beul,代码行数:10,代码来源:AnimatedTile.cpp


示例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);
}
开发者ID:Risist,项目名称:ggj2016-game,代码行数:42,代码来源:Character.cpp


示例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;
        }
    }
}
开发者ID:Orpheon,项目名称:Coverguard,代码行数:42,代码来源:peacemaker.cpp


示例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");
}
开发者ID:D4rkFr4g,项目名称:zRPG,代码行数:42,代码来源:Chicken.cpp


示例16: addSeq

void Animator::addSeq(int frames)
{
	Seq seq;
	seq.frames = frames;
	_seqs.push_back(seq);
	for (int k = 0; k < _objs.size(); ++k) {
		Object* obj = _objs[k];
		_anims[k].keys.push_back(obj->getAnimation());
		obj->setAnimation(Animation());
	}
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:11,代码来源:animator.cpp


示例17: extractSeq

void Animator::extractSeq(int first, int last, int seq)
{
	Seq sq;
	sq.frames = last - first;
	_seqs.push_back(sq);

	for (int k = 0; k < _objs.size(); ++k) {
		Animation& keys = _anims[k].keys[seq];
		_anims[k].keys.push_back(Animation(keys, first, last));
	}
}
开发者ID:Xaymar,项目名称:BlitzNext,代码行数:11,代码来源:animator.cpp


示例18: makeMonsterNoise

void SwampMonster::kill()
{
	Monster::kill();

	mHealth = 0;

	ResourceManager *resources = game->getResourceManager();

	if(!mIsDying)
	{
		if(mVoice)
			mVoice->stop();

		makeMonsterNoise(true);

		Player *player = game->getPlayer();

		switch(rand() % 3)
		{
			case 0:
				player->speak(player->getQuipKillSwampMonster());
				break;
			case 2:
				if(mAttachments.size() > 0)
					player->speak(player->getQuipBurn());
				break;
			case 1:
				player->speak(player->getQuipKill());
				break;
		}

		if(mIsFrozen)
			//Made this a bit quieter since it was pretty overpowering.
			game->getSoundEngine()->play2DSound(game->getResourceManager()->get("shatter" + std::to_string(rand() % 10 + 1)), 0.25f);

		//Remove all attachments left.
		for(auto it = mAttachments.begin(); it != mAttachments.end();  ++it)
		{
			it->second->setShouldDelete(true);
		}

		mAttachments.clear();

		mIsDying = true;
		mDeathTimer.start();

		delete mpAnim;

		mpAnim = New Animation(*game->getAnimationManager()->get("vaporize"));

		//if(rand() % 5 == 0)
				game->getEntityManager()->add(New HealthPotion(mPosition));
	}
}
开发者ID:porzell,项目名称:Duke-Spookem-3D,代码行数:54,代码来源:SwampMonster.cpp


示例19: getOwner

void EfectWeaponShield::onInit()
{
	EfectWeapon::onInit();
	idColiderMin = getOwner()->colliders.size();
	getResX().inverseMass = 0.5;

	//getOwner()->getPos().inverseMass *= 0.9;

	// weapon model;
	{
		static bool model_loaded = false;
		static string constructionScript;

		loadScript("model_shl.txt", constructionScript, model_loaded);
		static stringstream stream;
		stream.str(constructionScript);
		getOwner()->addEfect(efModel = new EfectModel(stream, handSprite, false, false));
	}
	getOwner()->allModels.push_back(&efModel->model);

	// Animations
	getOwner()->addAnimation(animCodeX, Animation("animation_shl_cross.txt"));
	getOwner()->addAnimation(animCodeY, Animation("animation_shl_push.txt"));

	//shield Colliders
	auto efShield = new Game::MultiEfect;
	addEfect(efShield);

	efShield->addEfect(new EfectMaterial(pos, EfectMaterial::v2, getOwner(), 0.9));
	//efShield->addEfect(new EfectMaterial(hp, EfectMaterial::f, getOwner(), 0.075));
	efShield->addEfect(new EfectRotateOnCollision(0.65, handSprite, 90));
	efShield->addEfect(new EfectSwordMaterial(idResX, idResY, 5.75, 3.5, &efModel->model,-90));

	efShield->addEfect(new EfectCollisionResponse( 30, 12.5, 100));


	getOwner()->addCollider(ColliderInfo(CircleCollider(Vector2D(0, 25), 45), efShield, &efModel->model));
	getOwner()->addCollider(ColliderInfo(CircleCollider(Vector2D(0, -10), 55), efShield, &efModel->model));

	idColiderMax = getOwner()->colliders.size();
}
开发者ID:Risist,项目名称:FuryGame,代码行数:41,代码来源:EfectWeaponShield.cpp


示例20: split

  bool AnimationGroup::initialize(const DataProxy& dict, Ogre::SceneManager* sceneManager)
  {
    for(auto& pair : dict)
    {
      std::string fullId = pair.second.as<std::string>();

      std::vector<std::string> id = split(fullId, '.');

      std::string entityID;
      mAnimations[pair.first] = Animation();
      if(id.size() < 2) {
        LOG(TRACE) << "Added empty animation to group " << pair.first;
        continue;
      }

      SceneNodeWrapper* containerNode = mRenderComponent->getRoot();
      int i;
      for(i = 0; i < id.size() - 2; i++) {
        containerNode = containerNode->getChildOfType<SceneNodeWrapper>(id[i]);
        if(containerNode == 0) {
          break;
        }
      }

      if(containerNode == 0) {
        LOG(TRACE) << "Failed to find node with name " << id[i];
        continue;
      }

      EntityWrapper* w = containerNode->getChildOfType<EntityWrapper>(id[i]);

      OgreV1::Entity* e = w->getEntity();

      // no entity was found with such id
      if(e == 0)
      {
        LOG(ERROR) << "Failed to add animation: entity with id \"" << id[0] << "\" not found in scene manager";
        return false;
      }

      // no such state
      if(!e->hasAnimationState(id[1]))
      {
        LOG(ERROR) << "Failed to add animation: animation state with id \"" << id[1] << "\" not found in entity";
        return false;
      }

      LOG(TRACE) << "Adding animation " << fullId << " to group " << pair.first;
      mAnimations[pair.first].initialize(e->getAnimationState(id[1]));
    }
    return true;
  }
开发者ID:gsage,项目名称:engine,代码行数:52,代码来源:AnimationScheduler.cpp



注:本文中的Animation函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AnscAcquireLock函数代码示例发布时间:2022-05-30
下一篇:
C++ Animate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap