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


C++ Anim类代码示例

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


在下文中一共展示了Anim类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nextCommandIf

Command *Command::opIsAnimAtTime(const ResourceReference &animRef, int32 time) {
	Anim *anim = animRef.resolve<Anim>();

	bool condition = !anim->isInUse() || anim->isAtTime(time);

	return nextCommandIf(condition);
}
开发者ID:DouglasLiuGamer,项目名称:residualvm,代码行数:7,代码来源:command.cpp

示例2: getDrawX

/**
 * Draw episode 1 guardian.
 *
 * @param ticks Time
 * @param change Time since last iteration
 */
void MedGuardian::draw(unsigned int ticks, int change) {

	Anim *stageAnim;
	unsigned char frame;

	if (next) next->draw(ticks, change);

	fixed xChange = getDrawX(change);
	fixed yChange = getDrawY(change);


	frame = ticks / (set->animSpeed << 5);


	if (stage == 0)
		stageAnim = anim;
	else
		stageAnim = level->getAnim(set->anims[E_LFINISHANIM | (animType & 1)] & 0x7F);

	if (ticks < flashTime) stageAnim->flashPalette(0);

	drawnX = x + anim->getXOffset();
	drawnY = y + anim->getYOffset() + stageAnim->getOffset();

	stageAnim->draw(xChange, yChange);

	if (ticks < flashTime) stageAnim->restorePalette();


	return;

}
开发者ID:ComputerNerd,项目名称:Open-Jazz-Jackrabbit-Casio-Prizm-port,代码行数:38,代码来源:jj1guardians.cpp

示例3: nextCommand

Command *Command::opAnimSetFrame(const ResourceReference &animRef, const ResourceReference &knowledgeRef) {
	Anim *anim = animRef.resolve<Anim>();
	Knowledge *knowledge = knowledgeRef.resolve<Knowledge>();

	anim->selectFrame(knowledge->getIntegerValue());

	return nextCommand();
}
开发者ID:DouglasLiuGamer,项目名称:residualvm,代码行数:8,代码来源:command.cpp

示例4: GetAnimFromImage

// Get an Anim from an Image
Anim GetAnimFromImage(const sf::Image& img, float height, float width, int howMany)
{

	// Add each frame
	Anim anim;
	for (int i=0; i<howMany; i++)
		anim.PushFrame(Frame(img, sf::IntRect(width*i, 0, width * (i+1), height)));

	return anim;

}
开发者ID:aguperezpala,项目名称:ggj-11-cpp,代码行数:12,代码来源:main_testScrollingManager.cpp

示例5: getDrawX

/**
 * Draw spring event.
 *
 * @param ticks Time
 * @param change Time since last iteration
 */
void SpringJJ2Event::draw (unsigned int ticks, int change) {

	Anim* an;
	int drawX, drawY;

	if (prepareDraw(ticks, change)) return;

	drawX = getDrawX(change);
	drawY = getDrawY(change);

	switch (type) {

		case 60: // Frozen green spring

			an = jj2Level->getAnim(animSet, 5, flipped);

			break;

		case 62: // Spring crate

			an = jj2Level->getAnim(animSet, 0, flipped);

			break;

		case 85: // Red spring

			an = jj2Level->getAnim(animSet, 7, flipped);

			break;

		case 86: // Green spring

			an = jj2Level->getAnim(animSet, 5, flipped);

			break;

		case 87: // Blue spring

			an = jj2Level->getAnim(animSet, 0, flipped);

			break;

		default:

			return;

	}

	an->setFrame(0, true);
	an->draw(drawX + F16, drawY + F16);

	return;

}
开发者ID:przemub,项目名称:openjazz,代码行数:60,代码来源:jj2eventframe.cpp

示例6: assert

Command *Command::opItemSetActivity(Script *script, const ResourceReference &itemRef, int32 animActivity, bool wait) {
	Item *item = itemRef.resolve<Item>();
	ItemVisual *sceneItem = item->getSceneInstance();
	Anim *actionAnim = sceneItem->getActionAnim();

	if (wait && actionAnim) {
		assert(actionAnim->getSubType() == Anim::kAnimSkeleton || actionAnim->getSubType() == Anim::kAnimVideo);
		script->suspend(actionAnim);
		return this;
	} else {
		resumeItemSetActivity();
		return nextCommand();
	}
}
开发者ID:DouglasLiuGamer,项目名称:residualvm,代码行数:14,代码来源:command.cpp

示例7: getDrawY

/**
 * Draw the bird.
 *
 * @param ticks Time
 * @param change Time since last step
 */
void JJ1Bird::draw (unsigned int ticks, int change) {

	Anim *anim;

	if (next) next->draw(ticks, change);

	anim = level->getAnim((player->getFacing() || fleeing)? BIRD_RIGHTANIM: BIRD_LEFTANIM);
	anim->setFrame(ticks / 80, true);

	anim->draw(getDrawX(change), getDrawY(change));

	return;

}
开发者ID:Chemrat,项目名称:openjazz,代码行数:20,代码来源:jj1bird.cpp

示例8: createAnim

/**
 * @fn	Anim* createAnim(const char filename[], std::vector< sf::Rect<int> > rects, const char name[])
 *
 * @brief	Creates an animation but do not add it for update & draw.
 *
 * @param	filename	Filename of the file.
 * @param	rects   	The rectangles.
 * @param	name		The name.
 *
 * @return	null if it fails, else the new animation.
 */
Anim* createAnim(const char filename[], std::vector< sf::Rect<int> > rects, const char name[])
{
	sf::Image image;
	image = MediaManager<sf::Image>::getInstance().getMedia(filename);

	Anim* anim;
	anim = new Anim;

	std::vector< sf::Rect<int> >::iterator it(rects.begin());
	for(; it != rects.end(); it++)
	{
		anim->pushFrame(Frame(image, *(it)));
	}

	return anim;
}
开发者ID:Hindi,项目名称:Rythm-Game,代码行数:27,代码来源:AnimationManager.cpp

示例9: if

/**
 * Draw the event's energy bar
 *
 * @param ticks Time
 */
void Event::drawEnergy (unsigned int ticks) {

	Anim* anim;
	int hits;

	if (!set || set->modifier != 8) {

		if (next) next->drawEnergy(ticks);

		return;

	} else if (set->strength) {

		// Draw boss energy bar

		hits = level->getEventHits(gridX, gridY) * 100 / set->strength;


		// Devan head

		anim = level->getMiscAnim(1);
		anim->setFrame(0, true);

		if (ticks < flashTime) anim->flashPalette(0);

		anim->draw(ITOF(viewW - 44), ITOF(hits + 48));

		if (ticks < flashTime) anim->restorePalette();


		// Bar
		drawRect(viewW - 40, hits + 40, 12, 100 - hits, (ticks < flashTime)? 0: 32);

	}

	return;

}
开发者ID:PocketInsanity,项目名称:openjazz,代码行数:43,代码来源:event.cpp

示例10: while

void Costume::load(string dirPath)
{
	Log::write(LOG_INFO, "Costume\n");
	Log::indent();

	XMLFile xmlFile;
	xmlFile.open(dirPath + XML_FILE_NAME);
	XMLNode *rootNode = xmlFile.getRootNode();

	_name = rootNode->getChild("name")->getStringContent();
	Log::write(LOG_INFO, "name: %s\n", _name.c_str());

	_mirror = rootNode->getChild("mirror")->getBooleanContent();
	Log::write(LOG_INFO, "mirror: %d\n", _mirror);

	int i = 0;
	XMLNode *child;
	while ((child = rootNode->getChild("anim", i++)) != NULL)
	{
		Anim *anim = new Anim();
		anim->load(child);
		_anims.push_back(anim);
	}

	i = 0;
	while ((child = rootNode->getChild("frame", i++)) != NULL)
	{
		Frame *frame = new Frame();
		frame->load(child, dirPath);
		_frames.push_back(frame);
	}

	_paletteData = new PaletteData();
	_paletteData->load(dirPath);

	Log::unIndent();
}
开发者ID:RumRogers,项目名称:scummgen,代码行数:37,代码来源:Costume.cpp

示例11: FTOI

/**
 * Draw current frame.
 *
 * @param x X-coordinate at which to draw
 * @param y Y-coordinate at which to draw
 */
void Anim::draw (fixed x, fixed y, int accessories) {

	Anim* anim;

	sprites[frame]->draw(
		FTOI(x) + (xOffsets[frame] << 2),
		FTOI(y) + yOffsets[frame] - yOffset);


	if (accessories && accessory) {

		anim = level->getAnim(accessory);
		anim->setFrame(frame, true);
		anim->draw(
			x + ITOF(accessoryX << 2),
			y + ITOF(accessoryY - yOffset) - anim->getOffset(),
			accessories - 1);

	}


	return;

}
开发者ID:Chemrat,项目名称:openjazz,代码行数:30,代码来源:anim.cpp

示例12: draw

/**
 * Draw episode B guardian.
 *
 * @param ticks Time
 * @param change Time since last iteration
 */
void DeckGuardian::draw (unsigned int ticks, int change) {

	Anim* anim;


	if (next) next->draw(ticks, change);


	// If the event has been removed from the grid, do not show it
	if (!set) return;


	// Draw the boss

	if (stage < 3) {

		// Draw unit

		anim = level->getAnim(29 + stage);

		if (stage == 0) {

			width = F8;
			drawnX = x - F64;

		} else if (stage == 1) {

			width = F8;
			drawnX = x + F32 - F8;

		} else if (stage == 2) {

			width = F64 + F32;
			drawnX = x - F64;

		}

		drawnY = y + F32;
		height = F32;

		if (ticks < flashTime) anim->flashPalette(0);

		if (stage == 0) anim->draw(getDrawX(change) - F64, getDrawY(change) + F32);
		else if (stage == 1) anim->draw(getDrawX(change) + F32 - F8 - F4, getDrawY(change) + F32);
		else anim->draw(getDrawX(change) + F8 - F64, getDrawY(change) + F32);

		if (ticks < flashTime) anim->restorePalette();

	}


	return;

}
开发者ID:Chemrat,项目名称:openjazz,代码行数:60,代码来源:jj1guardians.cpp

示例13: sprintf

/// @todo Repair major memory leaks when returning FALSE
sint32 UnitSpriteGroup::Parse(uint16 id, GROUPTYPE type)
{
	MBCHAR			scriptName[k_MAX_NAME_LENGTH];

	MBCHAR			*facedImageNames[k_NUM_FACINGS][k_MAX_NAMES];
	MBCHAR			*facedShadowNames[k_NUM_FACINGS][k_MAX_NAMES];

	MBCHAR			*imageNames[k_MAX_NAMES];
	MBCHAR			*shadowNames[k_MAX_NAMES];

	size_t			i;
    size_t          j;

	char			prefixStr[80];

	
	for (j=0; j<k_NUM_FACINGS; j++) 
	{
		for (i=0; i<k_MAX_NAMES; i++) 
		{
			facedImageNames[j][i] =  new MBCHAR[2 * k_MAX_NAME_LENGTH];
			facedShadowNames[j][i] = new MBCHAR[2 * k_MAX_NAME_LENGTH];
		}
	}

	for (i=0; i<k_MAX_NAMES; i++) 
	{
		imageNames[i] =  new MBCHAR[2 * k_MAX_NAME_LENGTH];
		shadowNames[i] = new MBCHAR[2 * k_MAX_NAME_LENGTH];
	}

	sprintf(prefixStr, ".%s%d%s", FILE_SEP, id, FILE_SEP);

	if (type == GROUPTYPE_UNIT)
	{
		sprintf(scriptName, "GU%.3d.txt", id);

		
		if (!c3files_PathIsValid(scriptName))
			sprintf(scriptName, "GU%.2d.txt", id);
	}
	else 
		sprintf(scriptName, "GC%.3d.txt", id);

	printf("Processing '%s'\n", scriptName);

	Token	* theToken = new Token(scriptName, C3DIR_SPRITES); 
	Assert(theToken); 
	if (!theToken) return FALSE; 
	
	sint32 tmp; 

	if (!token_ParseKeywordNext(theToken, TOKEN_UNIT_SPRITE)) return FALSE; 

	if (!token_ParseAnOpenBraceNext(theToken)) return FALSE; 

	if (!token_ParseValNext(theToken, TOKEN_UNIT_SPRITE_MOVE, tmp)) return FALSE;    
	
	if (tmp) 
	{
		Assert(type == GROUPTYPE_UNIT);
		
		if (type != GROUPTYPE_UNIT) 
		{
			printf("\n Illegal unit action (Move) for a city sprite.\n");
			return FALSE;
		}

		
		FacedSprite *moveSprite = new FacedSprite;
		
		
		moveSprite->ParseFromTokens(theToken);

		printf(" [Move");
		for (j=0; j<k_NUM_FACINGS; j++) 
		{
			for (size_t k = 0; k < moveSprite->GetNumFrames(); ++k) 
			{
				if (!GetImageFileName(facedShadowNames[j][k],"%sGU%#.3dMS%d.%d", prefixStr,  id, j+1, k+moveSprite->GetFirstFrame()))
					GetImageFileName(facedShadowNames[j][k] ,"%sGU%#.2dMS%d.%d", prefixStr,  id, j+1, k+moveSprite->GetFirstFrame());
				
				if (!GetImageFileName(facedImageNames[j][k], "%sGU%#.3dMA%d.%d", prefixStr, id,  j+1, k+moveSprite->GetFirstFrame()))
					GetImageFileName(facedImageNames[j][k] , "%sGU%#.2dMA%d.%d", prefixStr, id,  j+1, k+moveSprite->GetFirstFrame());
			}
		}

		
		moveSprite->Import(moveSprite->GetNumFrames(), facedImageNames, facedShadowNames);

		delete m_sprites[UNITACTION_MOVE];
		m_sprites[UNITACTION_MOVE] = moveSprite;
		printf("]\n");

		Anim *moveAnim = new Anim;

		moveAnim->ParseFromTokens(theToken);
		delete m_anims[UNITACTION_MOVE];
		m_anims[UNITACTION_MOVE] = moveAnim;
//.........这里部分代码省略.........
开发者ID:talentlesshack,项目名称:C2P2,代码行数:101,代码来源:UnitSpriteGroup.cpp

示例14: Render

void LayerAnim::Render(sf::RenderTarget& Target) const
{
  Anim* th = const_cast<LayerAnim*>(this);
  th->update();
  Target.Draw(*at(currentFrame()));
}
开发者ID:bguina,项目名称:epi-zappy,代码行数:6,代码来源:LayerAnim.cpp

示例15: pos

void MyAppli::onInit () {
    Network::startCli(10'000, 10'001,sf::IpAddress::LocalHost);
    TextureManager<> &tm = cache.resourceManager<Texture, std::string>("TextureManager");
    Vec2f pos (getView().getPosition().x - getView().getSize().x * 0.5f, getView().getPosition().y - getView().getSize().y * 0.5f);
    BoundingBox bx (pos.x, pos.y, 0, getView().getSize().x, getView().getSize().y, 0);
    theMap = new Map(&getRenderComponentManager(), "Map test", 100, 50);
    BaseChangementMatrix bcm;
    bcm.set2DIsoMatrix();
    theMap->setBaseChangementMatrix(bcm);
    World::addEntityManager(theMap);
    World::setCurrentEntityManager("Map test");
    eu = new EntitiesUpdater(false);
    World::addWorker(eu);
    au = new AnimUpdater(false);
    au->setInterval(sf::seconds(0.01f));
    World::addTimer(au);
    tiles.push_back(new Tile(tm.getResourceByAlias("GRASS"), Vec3f(0, 0, 0), Vec3f(120, 60, 0),sf::IntRect(0, 0, 100, 50)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 0, 100, 100)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 100, 100, 100)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 200, 100, 100)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 300, 100, 100)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 400, 100, 100)));
    walls.push_back(new Tile(tm.getResourceByAlias("WALLS"), Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(100, 500, 100, 100)));
    tiles[0]->getFaces()[0]->getMaterial().setTexId("GRASS");
    walls[0]->getFaces()[0]->getMaterial().setTexId("WALLS");
    walls[1]->getFaces()[0]->getMaterial().setTexId("WALLS");
    walls[2]->getFaces()[0]->getMaterial().setTexId("WALLS");
    walls[3]->getFaces()[0]->getMaterial().setTexId("WALLS");
    walls[4]->getFaces()[0]->getMaterial().setTexId("WALLS");
    walls[5]->getFaces()[0]->getMaterial().setTexId("WALLS");
    std::ifstream ifs("FichierDeSerialisation");
    BoundingBox mapZone(0, 0, 0, 1500, 1000, 0);
    World::generate_map(tiles, walls, Vec2f(100, 50), mapZone, false);
    w = new g2d::Wall(3, 80, walls[3],&g2d::AmbientLight::getAmbientLight(), Shadow::SHADOW_TYPE::SHADOW_TILE);
    w->setPosition(Vec3f(0, 130, 130 + w->getSize().y * 0.5f));
    World::addEntity(w);
    Tile* thouse = new Tile(tm.getResourceByAlias("HOUSE"), Vec3f(0, 0, 0), Vec3f(250, 300, 0), sf::IntRect(0, 0, 250, 300));
    thouse->getFaces()[0]->getMaterial().setTexId("HOUSE");
    g2d::Decor* decor = new g2d::Decor(thouse, &g2d::AmbientLight::getAmbientLight(), 300, Shadow::SHADOW_TYPE::SHADOW_TILE);
    decor->setPosition(Vec3f(-100, 250, 400));
    BoundingVolume *bb = new BoundingBox(decor->getGlobalBounds().getPosition().x, decor->getGlobalBounds().getPosition().y + decor->getGlobalBounds().getSize().y * 0.4f, 0,
    decor->getGlobalBounds().getSize().x, decor->getGlobalBounds().getSize().y * 0.25f, 0);
    decor->setCollisionVolume(bb);
    decor->setShadowCenter(Vec3f(-10, 500, 0));
    World::addEntity(decor);
    Anim* fire = new Anim(0.1f, Vec3f(0, 100, 150), Vec3f(100, 100, 0), 0);
    Tile* tf1 = new Tile(tm.getResourceByAlias("FIRE1"), Vec3f(0, 100, 150), Vec3f(100, 100, 0), sf::IntRect(0, 0, 150, 200));
    tf1->getFaces()[0]->getMaterial().setTexId("FIRE1");
    g2d::Decor *fire1 = new g2d::Decor(tf1, &g2d::AmbientLight::getAmbientLight(), 100, Shadow::SHADOW_TYPE::SHADOW_TILE);
    fire1->setShadowCenter(Vec3f(0, 400, 0));
    //decor->setShadowCenter(Vec2f(0, 60));
    //decor->changeGravityCenter(Vec3f(50, 50, 0));
    Tile* tf2 = new Tile(tm.getResourceByAlias("FIRE2"), Vec3f(0, 100, 150), Vec3f(100, 100, 0), sf::IntRect(0, 0, 150, 200));
    tf2->getFaces()[0]->getMaterial().setTexId("FIRE2");
    g2d::Decor *fire2 = new g2d::Decor(tf2, &g2d::AmbientLight::getAmbientLight(), 100, Shadow::SHADOW_TYPE::SHADOW_TILE);
    fire2->setShadowCenter(Vec3f(0, 400, 0));
    //decor->setShadowCenter(Vec2f(0, 60));
    //decor->changeGravityCenter(Vec3f(50, 50, 0));
    Tile* tf3 = new Tile(tm.getResourceByAlias("FIRE3"), Vec3f(0, 100, 150), Vec3f(100, 100, 0), sf::IntRect(0, 0, 150, 200));
    tf3->getFaces()[0]->getMaterial().setTexId("FIRE3");
    g2d::Decor *fire3 = new g2d::Decor(tf3, &g2d::AmbientLight::getAmbientLight(), 100, Shadow::SHADOW_TYPE::SHADOW_TILE);
    fire3->setShadowCenter(Vec3f(0, 400, 0));
    //decor->setShadowCenter(Vec2f(0, 60));
    //decor->changeGravityCenter(Vec3f(50, 50, 0));
    //fire1->setShadowCenter(Vec2f(80, 100));
    //fire2->setShadowCenter(Vec2f(80, 100));
    //fire3->setShadowCenter(Vec2f(80, 100));
    fire->addFrame(fire1);
    fire->addFrame(fire2);
    fire->addFrame(fire3);
    fire->play(true);
    World::addEntity(fire);
    au->addAnim(fire);
    //PonctualLight* light = new PonctualLight(Vec2f(50, 150),100,50,0,200,sf::Color(255,255,0),16,0);
    //World::addEntity(light);
    SymEncPacket packet;
    packet<<"GETCARINFOS";
    Network::sendTcpPacket(packet);
    std::string response = Network::waitForLastResponse("CARINFOS", sf::seconds(10.f));
    std::istringstream iss(response);
    ITextArchive ia(iss);
    ia(hero);
    std::string path = "tilesets/vlad_sword.png";
    cache.resourceManager<Texture, std::string>("TextureManager").fromFileWithAlias(path, "VLADSWORD");
    const Texture *text = cache.resourceManager<Texture, std::string>("TextureManager").getResourceByPath(path);
    int textRectX = 0, textRectY = 0, textRectWidth = 50, textRectHeight = 100;
    int textWidth = text->getSize().x;
    Vec3f tmpCenter = hero->getCenter();
    hero->setCenter(Vec3f(0, 0, 0));
    for (unsigned int i = 0; i <= 56; i+=8) {
        Anim* animation = new Anim(0.1f, Vec3f(-25, -50, 0), Vec3f(50, 100, 0), 0);
        for (unsigned int j = 0; j < 8; j++) {
            sf::IntRect textRect (textRectX, textRectY, textRectWidth, textRectHeight);
            Tile *tile = new Tile(text, Vec3f(-25, -50, 0), Vec3f(50, 100, 0), textRect);
            tile->getFaces()[0]->getMaterial().setTexId("VLADSWORD");
            g2d::Decor *frame = new g2d::Decor(tile, &g2d::AmbientLight::getAmbientLight(), 100, Shadow::SHADOW_TYPE::SHADOW_TILE);
            frame->setShadowCenter(Vec3f(0, 100, 0));
            //decor->setShadowCenter(Vec2f(80, 130));
            //decor->changeGravityCenter(Vec3f(50, 50, 0));
            textRectX += textRectWidth;
//.........这里部分代码省略.........
开发者ID:Ornito,项目名称:ODFAEG,代码行数:101,代码来源:application.cpp


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