• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetSprite函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: UnitBottom

/*
 * UnitBottom
 * 
 * Calculate how low the unit can appear on the screen. 
 * It's partially based on the unit's size.
 */
int UnitBottom (typUnit *unit)
{
    typSprite *sprite;

    sprite = GetSprite (unit);
    return (GetGameHeight () - (sprite[0].height / 2));
}
开发者ID:EVODelavega,项目名称:gtk-examples,代码行数:13,代码来源:defender.c


示例17: GetSprite

void CMessageBoxScene::Draw(float dt)
{
	LPD3DXSPRITE pSprite = GetSprite();
	LPD3DXFONT pFont = GetFont();

	// Darken down any other Scenes that were drawn beneath the popup.
	float alpha = 1 - GetTransPos();
	GetEngine()->DrawColourTint(D3DXCOLOR(0, 0, 0, alpha * 2 / 3));

	// compute the sizes
	RECT scr = GetEngine()->GetWindowRect();
	D3DXVECTOR2 scrSize((float)scr.right, (float)scr.bottom);
	D3DXVECTOR2 textSize = GetTextSize(pFont, mText.c_str());
	D3DXVECTOR2 textPos = (scrSize - textSize) / 2;

	const int VPAD = 16, HPAD = 32;	// padding
	RECT bg;
	bg.left = (int)textPos.x - HPAD;
	bg.top = (int)textPos.y - VPAD;
	bg.right = bg.left + (int)textSize.x + HPAD * 2;
	bg.bottom = bg.top + (int)textSize.y + VPAD * 2;

	D3DCOLOR col = D3DCOLOR_ARGB((int)(255 * alpha), 255, 255, 255);
	pSprite->Begin(D3DXSPRITE_ALPHABLEND);	// must have ALPHABLEND or font looks awful
	// stretch the 8x8 background into its area
	DrawSprite(pSprite, mpTexture, bg, col);
	// add text (using the sprite batch)
	DrawD3DFontEx(pFont, pSprite, mText.c_str(), (int)textPos.x, (int)textPos.y,
		col);
	pSprite->End();
}
开发者ID:crystalised,项目名称:GDEV,代码行数:31,代码来源:MessageBoxScene.cpp


示例18: GetSWFObject

/*
========================
idMenuScreen_Shell_Leaderboards::Update
========================
*/
void idMenuScreen_Shell_Leaderboards::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_JOY3 );
			buttonInfo->label = "#str_online_leaderboards_toggle_filter";
			buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS );
			
			if ( !lbCache->IsLoadingNewLeaderboard() && !lbCache->IsRequestingRows() && options != NULL && options->GetTotalNumberOfOptions() > 0 ) {
				buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
				if ( menuData->GetPlatform() != 2 ) {
					buttonInfo->label = "#str_swf_view_profile";
				}
				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( lbCache->GetFilterStrType() );
			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:469486139,项目名称:DOOM-3-BFG,代码行数:52,代码来源:MenuScreen_Shell_Leaderboards.cpp


示例19: SetPosition

void MessageBox::Draw(sf::RenderWindow& rw)
{
	SetPosition(400, 720, true);
	text.setPosition(GetPosition());

	rw.draw(GetSprite());
	rw.draw(text);
}
开发者ID:minersail,项目名称:The-Unfortunate-Adventure-of-Joe,代码行数:8,代码来源:MessageBox.cpp


示例20: GetSprite

Bonus::Bonus(float X, float Y, int W, int H, sf::String Name):GameObject(X, Y, W, H, Name)
{
	if (name == "Daemond")
			{
				GetSprite().setTextureRect(sf::IntRect(x, y, w, h));
			}
	//speed = 0;
}
开发者ID:Anastatsia1213,项目名称:PlatformerGame,代码行数:8,代码来源:Bonus.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetSquared函数代码示例发布时间:2022-05-30
下一篇:
C++ GetSpellStore函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap