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


C++ Animation::GetCurrentFrame方法代码示例

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


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

示例1: Draw

void ModeMenu::Draw(SDL_Surface* screenSurface)
{
	if(mWall.get())
	{
		Vector2f offset((Widget::GetScreenSize().x - mWall->GetBounds().x) / 2, 0);

		vector<Brick::SharedPointer> bricks = mWall->GetBricks();
		for(vector<Brick::SharedPointer>::iterator brick = bricks.begin(); brick != bricks.end(); ++brick)
		{
			Animation* sprite;
			switch((*brick)->GetBrickType())
			{
			default:
			case BrickType::BlueBrick:
				sprite = StandardTextures::blue_brick_animation[0];
				break;
			case BrickType::RedBrick:
				sprite = StandardTextures::red_brick_animation[(*brick)->GetLives() - 1];
				break;
			case BrickType::YellowBrick:
				sprite = StandardTextures::yellow_brick_animation[(*brick)->GetLives() - 1];
				break;
			}

			Vector2i inverted_y = (*brick)->GetPosition() + mWall->GetPosition() + offset + Vector2f(Brick::BRICK_WIDTH / 2, 0);
			inverted_y.y = 480 - inverted_y.y;
			sprite->GetCurrentFrame()->Draw(inverted_y);
		}
	}
}
开发者ID:RahulSDeshpande,项目名称:ReverseArkanoid,代码行数:30,代码来源:ModeMenu.cpp

示例2: GetCurrentFrame

int ScriptedAnimation::GetCurrentFrame()
{
	Animation *anim = anims[P_HOLD*MAX_ORIENT];
	if (anim) {
		return anim->GetCurrentFrame();
	}
	return 0;
}
开发者ID:MephistoSatanDevil,项目名称:gemrb,代码行数:8,代码来源:ScriptedAnimation.cpp

示例3: Update


//.........这里部分代码省略.........

	
	if (dir == 0 && s_map[tilepos_y / 16][(tilepos_x / 16)] < 2){

		position_x = position_x + speed;
		position.x = position_x;
		position.y = (position_y / 16) * 16 + 8;
	}
	if (dir == 1 && s_map[tilepos_y / 16][(tilepos_x / 16)] < 2){

		position_x = position_x - speed;
		position.x = position_x;
		position.y = (position_y / 16) * 16 + 8;

	}
	if (dir == 2 && s_map[tilepos_y / 16][(tilepos_x / 16)] < 2){

		position_y = position_y - speed;
		position.y = position_y;
		position.x = (position_x / 16) * 16 + 8;
	}
	if (dir == 3 && s_map[tilepos_y / 16][(tilepos_x / 16)] < 2){

		position_y = position_y + speed;
		position.y = position_y;
		position.x = (position_x / 16) * 16 + 8;
	}


	if (dir == 0 && s_map[tilepos_y / 16][(tilepos_x / 16) + 1] >= 2){

		position_x = position_x - speed;
		position.x = (position_x / 16) * 16 +8;
		position.y = (position_y / 16) * 16 + 8;
		
		
	}


	if (dir == 1 && s_map[tilepos_y / 16][(tilepos_x / 16) - 1] >= 2){

		position_x = position_x + speed;
		position.x = (position_x / 16) * 16 + 8;
		position.y = (position_y / 16) * 16 + 8;
	}
			
	
	if (dir == 2 && s_map[(tilepos_y / 16) - 1][(tilepos_x / 16)] >= 2){

			position_y = position_y + speed;
			position.y = (position_y / 16) * 16 + 8;
			position.x = (position_x / 16) * 16 + 8;
			
			
		}

	if (dir == 3 && s_map[(tilepos_y / 16) + 1][(tilepos_x / 16)] >= 2){
		position_y = position_y - speed;
		position.y = (position_y / 16) * 16 + 8;
		position.x = (position_x / 16) * 16 + 8;
				
				}
	if (s_map[(tilepos_y / 16)][(tilepos_x / 16)] == -3)
	{
		position.x = 0;
	}
	if (s_map[(tilepos_y / 16)][(tilepos_x / 16)] == -4)
	{
		position.x = 410;
	}

	
	
		if (destroyed == false)
			App->render->Blit(graphics, position.x, position.y, &(current_animation->GetCurrentFrame()));
		App->render->Blit(graphics, 128+16, 16, &(units->GetCurrentFrame()));
		App->render->Blit(graphics, 128, 16, &(dozens->GetCurrentFrame()));
		App->render->Blit(graphics, 96+16, 16, &(hundreds->GetCurrentFrame()));
		App->render->Blit(graphics, 96, 16, &(thousands->GetCurrentFrame()));
		App->render->Blit(graphics, 96-16, 16, &(t_thousands->GetCurrentFrame()));



		// Draw everything --------------------------------------
		SDL_Rect r = current_animation->GetCurrentFrame();

		if (destroyed == true){
			points = 0;
		}

		if (SDL_GetTicks() - time > 4000){
			power = false;
		}



		

		return UPDATE_CONTINUE;
	}
开发者ID:adrixdx,项目名称:ms-pacman,代码行数:101,代码来源:ModulePlayer.cpp

示例4: Update


//.........这里部分代码省略.........
				}

			}


		}
		if (temp_dir == 0 && App->player->s_map[t_tilepos_y / 16][(t_tilepos_x / 16)] != 2){

			t_position_x = t_position_x + speed;
			t_positionx = t_position_x;
			t_positiony = (t_i_position_y / 16) * 16 + 8;
		}
		if (temp_dir == 1 && App->player->s_map[t_tilepos_y / 16][(t_tilepos_x / 16)] != 2){

			t_position_x = t_position_x - speed;
			t_positionx = t_position_x;
			t_positiony = (t_i_position_y / 16) * 16 + 8;

		}
		if (temp_dir == 2 && App->player->s_map[t_tilepos_y / 16][(t_tilepos_x / 16)] != 2){

			t_position_y = t_position_y - speed;
			t_positiony = t_position_y;
			t_positionx = (t_i_position_x / 16) * 16 + 8;
		}
		if (temp_dir == 3 && App->player->s_map[t_tilepos_y / 16][(t_tilepos_x / 16)] != 2){

			t_position_y = t_position_y + speed;
			t_positiony = t_position_y;
			t_positionx = (t_i_position_x / 16) * 16 + 8;
		}


		if (temp_dir == 0 && App->player->s_map[t_tilepos_y / 16][(t_tilepos_x / 16) + 1] == 2){

			t_position_x = t_position_x - speed;
			t_positionx = (t_i_position_x / 16) * 16 + 8;

		}


		if (temp_dir == 0 || temp_dir == 1){
			App->render->Blit(graphics, t_tilepos_x, t_tilepos_y, &(horitzontal->GetCurrentFrame()));
		}
		else App->render->Blit(graphics, t_tilepos_x, t_tilepos_y, &(vertical->GetCurrentFrame()));

		if (temp_dir == 0){
			t_tilepos_x += 16;
		}
		if (temp_dir == 1){
			t_tilepos_x -= 16;
		}
		if (temp_dir == 2){
			t_tilepos_y -= 16;
		}
		if (temp_dir == 3){
			t_tilepos_y += 16;
		}
		if (App->player->s_map[(t_tilepos_y / 16)][(t_tilepos_x / 16)] != -1 && App->player->s_map[(t_tilepos_y / 16)][(t_tilepos_x / 16)] != -2)
		{

			t_turn = true;
		}
		if ((t_tilepos_y == player_position_y && t_tilepos_x == player_position_x) || cont >= 100){
			ret = true;
			t_turn = true;
			temp_dir = direction;
		}
		cont++;
	}
	}
	
	if (destroyed == false)
		App->render->Blit(graphics, position.x, position.y, &(current_animation->GetCurrentFrame()));
	if (App->player->s_map[(tilepos_y / 16)][(tilepos_x / 16)] == -3)
	{
		position.x = 0;
	}
	if (App->player->s_map[(tilepos_y / 16)][(tilepos_x / 16)] == -4)
	{
		position.x = 410;
	}

	// Draw everything --------------------------------------
	SDL_Rect r = current_animation->GetCurrentFrame();

	//App->render->Blit(graphics, position.x, position.y - r.h, &r);
	/*int tilepos_x_temp = ((i_position_x + 16) / 16) * 16;
	int tilepos_y_temp = ((i_position_y + 16) / 16) * 16;

	if (tilepos_x_temp != tilepos_x || tilepos_y_temp != tilepos_y){
		turn = true;
	}*/
	if (App->player->s_map[(tilepos_y / 16)][(tilepos_x / 16)] != -1 && App->player->s_map[(tilepos_y / 16)][(tilepos_x / 16)] != -2)
	{
		turn = true;
	}

	return UPDATE_CONTINUE;
}
开发者ID:adrixdx,项目名称:ms-pacman,代码行数:101,代码来源:ModuleBlinky.cpp


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