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


C++ Anim::setFrame方法代码示例

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


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

示例1: draw

/**
 * 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);


	stageAnim->setFrame(frame + gridX + gridY, true);

	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:Chemrat,项目名称:openjazz,代码行数:41,代码来源:jj1guardians.cpp

示例2: 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

示例3: 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

示例4: drawEnergy

/**
 * 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

示例5: draw

/**
 * 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

示例6: if

/**
 * Draw coin/gem pickup event.
 *
 * @param ticks Time
 * @param change Time since last iteration
 */
void CoinGemJJ2Event::draw (unsigned int ticks, int change) {

	Anim* an;
	int drawX, drawY;

	if (prepareDraw(ticks, change)) return;

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

	if (endTime) {

		an = jj2Level->getAnim(animSet, 86, flipped);
		an->setFrame((int)ticks / 60, true);
		an->draw(drawX + F16, drawY + F16 + F32);

	}

	if (type == 44) an = jj2Level->getAnim(animSet, 84, flipped); // Silver coin
	else if (type == 45) an = jj2Level->getAnim(animSet, 37, flipped); // Gold coin
	else an = jj2Level->getAnim(animSet, 35, flipped); // Gem

	an->setFrame((int)ticks / 60, true);

	switch (type) {

		case 63: // Red gem

			mapPalette(an, 48);

			break;

		case 64: // Green gem

			mapPalette(an, 80);

			break;

		case 65: // Blue gem

			mapPalette(an, 32);

			break;

		case 66: // Purple gem

			mapPalette(an, 88);

			break;

	}

	if (endTime) {

		drawX += (ticks + 500 - endTime) << 8;
		drawY += (ticks + 500 - endTime) << 10;

	}

	an->draw(drawX + F16, drawY + F16 + F32);

	return;

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


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