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


C++ GetSprite函数代码示例

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


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

示例1: GetSWFObject

/*
========================
idMenuScreen_Shell_Playstation::Update
========================
*/
void idMenuScreen_Shell_Playstation::Update()
{

	if( menuData != NULL )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_SWF_SELECT";
			}
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( "#str_swf_playstation" );
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:55,代码来源:MenuScreen_Shell_Playstation.cpp

示例2: CWidget

CTextInputWidget::CTextInputWidget( CWidget* parent, const types::rect& rect, bool relative , const types::id& id , const std::string& img_file, const std::string& cursor_img_file,  bool single_line ) :
	CWidget( parent, rect, relative, id, img_file ),
	myText(),
	myCursorImageFile( cursor_img_file ),
	myCursorSprite(),
	myCursorPosition( 0 ),
	myFocus( false ),
	myIsPassword( false )
{
	Initialize( this, single_line );

	if( GetSprite() )
		mySpriteHandler->SetTextSingleLine( GetSprite(), single_line );
}
开发者ID:acekiller,项目名称:poro,代码行数:14,代码来源:ctextinputwidget.cpp

示例3: GetSprite

// Render
//	- draw the entity's image at its position
/*virtual*/ void Entity::Render( void )
{
	// Verify the image
	//assert( m_hImage != SGD::INVALID_HANDLE && "Entity::Render - image was not set!" );
	
	SGD::GraphicsManager* pGraphics = SGD::GraphicsManager::GetInstance();
	
	// Get the current frame
	int frame = GetSprite()->GetCurrFrame();


	// Find the center of the image
	SGD::Vector center;
	center.x = GetSprite()->GetFrame(frame).GetFrameRect().right - GetSprite()->GetFrame(frame).GetFrameRect().left;
	center.y = GetSprite()->GetFrame(frame).GetFrameRect().bottom - GetSprite()->GetFrame(frame).GetFrameRect().top;
	center.x /= 2;
	center.y /= 2;

	// Calculate the rotation
	SGD::Vector rotate = m_vtVelocity;
	rotate.Normalize();
	float rot = SGD::Vector(0.0f, -1.0f).ComputeSteering(rotate);

	float rotation = 0;
	if(rot > 0)
		rotation = SGD::Vector(0.0f, -1.0f).ComputeAngle(rotate);
	else
		rotation = -SGD::Vector(0.0f, -1.0f).ComputeAngle(rotate);
	
	// Render
	AnimationManager::GetInstance()->Render(m_antsAnimation, m_ptPosition.x - Camera::x, m_ptPosition.y - Camera::y, rotation, center);

	// Why is this here?
	SGD::Rectangle drawRect = GetRect();
	drawRect.left -= Camera::x;
	drawRect.right -= Camera::x;
	drawRect.top -= Camera::y;
	drawRect.bottom -= Camera::y;

	// HACK: Modify the rotation
	//m_fRotation += 0.01f;

	// Draw the image

	// -- Debugging Mode --
	Game* pGame = Game::GetInstance();
	if (pGame->IsShowingRects())
		SGD::GraphicsManager::GetInstance()->DrawRectangle(drawRect, SGD::Color(128, 255, 0, 0));
}
开发者ID:MatthewSalow,项目名称:soorry,代码行数:51,代码来源:Entity.cpp

示例4: DestroySprite

void HermiteSpline::Destroy()
{
	DestroySprite(GetSprite("start")->ID);//little ones
	DestroySprite(GetSprite("player")->ID);//player

	for (int i = 0; i < objectList.size(); i++)
	{
		delete objectList[i];
	}

	for (int i = 0; i < curvePoints.size(); i++)
	{
		delete curvePoints[i];
	}
}
开发者ID:JeffreyMJohnson,项目名称:exercises,代码行数:15,代码来源:HermiteSpline.cpp

示例5: GetSprite

void Bullet::Update(float frametime)
{
	if(GetPosition().x < 0) { alive = false; }
	if(GetPosition().y < 0) { alive = false; }

	if(GetPosition().x > _state->getApp()->GetWidth()) { alive = false; }
	if(GetPosition().y > _state->getApp()->GetHeight()) { alive = false; }


	double radian = GetSprite().getRotation() * (pi / 180);

	sf::Vector2f direction = sf::Vector2f((float)cos(radian), (float)sin(radian));

	GetSprite().move(direction * speed * frametime);
}
开发者ID:ChrisMelling,项目名称:basicGame,代码行数:15,代码来源:Bullet.cpp

示例6: GetSWFObject

/*
========================
idMenuWidget_MenuBar::Update
========================
*/
void idMenuWidget_MenuBar::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();

	if ( !BindSprite( root ) ) {
		return;
	}

	totalWidth = 0.0f;
	buttonPos = 0.0f;

	for ( int index = 0; index < GetNumVisibleOptions(); ++index ) {
			
		if ( index >= children.Num() ) {
			break;
		}

		if ( index != 0 ) {
			totalWidth += rightSpacer;
		}

		idMenuWidget & child = GetChildByIndex( index );
		child.SetSpritePath( GetSpritePath(), va( "btn%d", index ) );
		if ( child.BindSprite( root ) ) {
			PrepareListElement( child, index );
			child.Update();
		}
	}

	// 640 is half the size of our flash files width
	float xPos = 640.0f - ( totalWidth / 2.0f );
	GetSprite()->SetXPos( xPos );

	idSWFSpriteInstance * backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
	if ( backing != NULL ) {
		if ( menuData != NULL && menuData->GetPlatform() != 2 ) {
			backing->SetVisible( false );
		} else {
			backing->SetVisible( true );
			backing->SetXPos( totalWidth / 2.0f );
		}
	}

}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:53,代码来源:MenuWidget_MenuBar.cpp

示例7: GetShipSpriteSize

/** Get the size of the sprite of a ship sprite heading west (used for lists)
 * @param engine The engine to get the sprite from
 * @param width The width of the sprite
 * @param height The height of the sprite
 */
void GetShipSpriteSize(EngineID engine, uint &width, uint &height)
{
	const Sprite *spr = GetSprite(GetShipIcon(engine), ST_NORMAL);

	width  = spr->width;
	height = spr->height;
}
开发者ID:andrew889,项目名称:OpenTTD,代码行数:12,代码来源:ship_cmd.cpp

示例8: DrawShipEngine

void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
{
	SpriteID sprite = GetShipIcon(engine);
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
	preferred_x = Clamp(preferred_x, left - real_sprite->x_offs, right - real_sprite->width - real_sprite->x_offs);
	DrawSprite(sprite, pal, preferred_x, y);
}
开发者ID:andrew889,项目名称:OpenTTD,代码行数:7,代码来源:ship_cmd.cpp

示例9: GetSprite

void Grenade::Render()
{
	
	// Get the current frame
	int frame = GetSprite()->GetCurrFrame();

	// Find the center of the image
	SGD::Vector center;
	center.x = GetSprite()->GetFrame(frame).GetFrameRect().right - GetSprite()->GetFrame(frame).GetFrameRect().left;
	center.y = GetSprite()->GetFrame(frame).GetFrameRect().bottom - GetSprite()->GetFrame(frame).GetFrameRect().top;
	center.x /= 2;
	center.y /= 2;

	// Render
	AnimationManager::GetInstance()->Render(m_antsAnimation, m_ptPosition.x - Camera::x, m_ptPosition.y - Camera::y, m_fRotation, center);
}
开发者ID:MatthewSalow,项目名称:soorry,代码行数:16,代码来源:Grenade.cpp

示例10: GetSprite

//prints a number in sprite format
//must be manually updated with sprite information
//0 to 999999
void CGraphics::PrintSpriteNumber(int x, int y, long num){
  if (num < 0 || num > 999999)
    return;

  GRAPHIC_IMAGE gi;

  int posX = x;
  int posY = y;
  std::string sRef = "0123456789";
  std::ostringstream oss;
  oss << num;
  std::string sNum = oss.str();
  std::string sPrefix;
  if(sNum.length() < 6)
    sPrefix.append(6 - sNum.length(), '0');
  std::string sScore = sPrefix + sNum;

  for(int i = 0; i < sScore.size();++i){
    for(int j = 0; j < sRef.size(); ++j){
      if(sScore.at(i) == sRef.at(j)){
        gi = GetSprite(1200 + j);
        RenderGraphicModulate(gi, posX, posY, 255, 255, 255);
        posX += gi.width;
        break;
      }
    }
  }


}
开发者ID:ChuckBolin,项目名称:JustAnotherTowerDefenseGame,代码行数:33,代码来源:CGraphics.cpp

示例11: GetVelocity

void ADefyingGravityCharacter::UpdateAnimation()
{
	const FVector PlayerVelocity = GetVelocity();
	const float PlayerSpeed = PlayerVelocity.Size();

	// Are we moving or standing still?
	UPaperFlipbook* DesiredAnimation = (PlayerSpeed > 0.0f) ? catWalkAnimation : idleCatAnimation;
	if (GetCharacterMovement()->IsFalling())
	{
		DesiredAnimation = JumpCatAnimation;
	}
	if( GetSprite()->GetFlipbook() != DesiredAnimation 	)
	{
		GetSprite()->SetFlipbook(DesiredAnimation);
	}
}
开发者ID:hanzes,项目名称:DefyingGravity,代码行数:16,代码来源:DefyingGravityCharacter.cpp

示例12: GetSprite

 TaskPtr BombGem::explosion()
 {
     CCSprite* medium = GetSprite("fuze_1.png");
     auto size = this->root->getContentSize();
     medium->setAnchorPoint(ccp(0.5f, 0.5f));
     //CCPoint pos = g2w_center(this->position);
     medium->setPosition(ccp(Gem::kGemWidthPixel/2, Gem::kGemHeightPixel/2));
     medium->setOpacity(0);
     this->root->addChild(medium);
     
     auto anim =
     CCAnimationCache::sharedAnimationCache()->animationByName("skill_explosion");
     
     auto hack = this->shared_from_this();
     TaskSequencePtr seq = TaskSequence::make();
     seq << TaskLambda::make([=]()
                             {
                                 medium->setOpacity(255);
                             })
     << TaskBatch::make(TaskAnim::make(medium,
                                       CCAnimate::create(anim)),
                        TaskAnim::make(this->root,
                                       CCFadeOut::create(0.3f)))
     << TaskLambda::make([=]()
                         {
                             auto self = hack;
                         });
     
     return seq;
 }
开发者ID:13609594236,项目名称:ph-open,代码行数:30,代码来源:Gem.cpp

示例13: GetField

void TToweredTrainUnit::GetDrawRect(TRect *r)
{
    TRect r1;
    TField *f = GetField(X, Y);
    TSprite *s = GetSprite();
    int rrx = GetRelX(X), rry = GetRelY(Y);
    int drawx = 28 * (rrx - rry) + LittleX + 28;
    int drawy = 14 * (rrx + rry - (f->Height)) + LittleY + 14;
    
    r->x1 = drawx - s->dx, r->y1 = drawy - s->dy;
    r->x2 = r->x1 + s->w, r->y2 = r->y1 + s->h;

    s = UnitsSprites[Type][40 + WpnOrient];
    r1.x1 = drawx + SpriteLocators[Type][SpriteOrient*2] - s->dx, 
    r1.y1 = drawy + SpriteLocators[Type][SpriteOrient*2+1] - s->dy;
    r1.x2 = r1.x1 + s->w, r1.y2 = r1.y1 + s->h;
    Union(r, &r1);

    s = GetSmoke();
    if (s) {
        r1.x1 = drawx - s->dx, r1.y1 = drawy - s->dy;
        r1.x2 = r1.x1 + s->w, r1.y2 = r1.y1 + s->h;
        Union(r, &r1);
    }
}
开发者ID:danvac,项目名称:signus,代码行数:25,代码来源:utrains.cpp

示例14: Load

GameBall::GameBall()
{
	Load("Resources/Images/Ball.png");
	assert(IsLoaded());

	GetSprite().setOrigin(15, 15);
}
开发者ID:SillenZ,项目名称:Pong,代码行数:7,代码来源:GameBall.cpp

示例15: GetSWFObject

/*
========================
idMenuWidget_InfoBox::ObserveEvent
========================
*/
void idMenuWidget_InfoBox::ResetInfoScroll() {

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( !BindSprite( root ) || GetSprite() == NULL ){
		return;
	}

	idSWFTextInstance * txtBody = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBody" );
	if ( txtBody != NULL ) {
		txtBody->scroll = 0;
	}

	if ( scrollbar != NULL ) {
		scrollbar->Update();
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:21,代码来源:MenuWidget_InfoBox.cpp


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