当前位置: 首页>>代码示例>>C++>>正文


C++ Animation函数代码示例

本文整理汇总了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();
}
开发者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


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