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


C++ RenderTarget::GetWidth方法代码示例

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


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

示例1: renderSpells

void PlayerHUD::renderSpells(sf::RenderTarget& targ, float scaleX, float scaleY) const {
	glPushMatrix();
	const int id = mPlayer->mGamepad->getId();
	Spell** spells = mPlayer->mSpellArray;
	const sf::Vector2f& spellSize = spells[0]->getThumbnail()->GetSize();
	const int spellHalfW = spellSize.x / 2;
	const int spellHalfH = spellSize.y / 2;

	if(id%2) {
		glTranslatef(targ.GetWidth() - spellSize.x, 0, 0);
	}

	if(id>=2) {
		glTranslatef(0, targ.GetHeight() - spellSize.y, 0);
	}
	//LT
	renderSingleSpell(targ, spells[0], 5*scaleX, 110*scaleY);

	//LB
	renderSingleSpell(targ, spells[1], 53*scaleX, 108*scaleY);

	//RB
	renderSingleSpell(targ, spells[3], 96*scaleX, 91*scaleY);

	//RT
	renderSingleSpell(targ, spells[2], 115*scaleX, 45*scaleY);
	glPopMatrix();
}
开发者ID:TokyoBirdy,项目名称:MasterOfSorcery,代码行数:28,代码来源:Player.cpp

示例2: render

void MainMenuState::render(sf::RenderTarget& window) const
{
	
	//render background/sprite 
	window.Draw(*mSprite);
	// position menu background
	mSpriteMenu->SetPosition(0.74*window.GetWidth()-0.5*mSpriteMenu->GetSize().x, 0.5*window.GetHeight()-0.5*mSpriteMenu->GetSize().y);
	window.Draw(*mSpriteMenu);
	
	// put the positions and render buttons 
	for( int i=0; i< mAmountOfButtons; i++)
	{
		
		mButtons[i]->setPosition(0.75*window.GetWidth()-0.25*mButtons[i]->getSizeWidth()+58, 0.5*window.GetHeight()-0.25*mAmountOfButtons*mButtons[i]->getSizeHeight()+i*mButtons[i]->getSizeHeight()-90+i*11);
		if(i==4)
		{
			mButtons[4]->moveButton(sf::Vector2f(-12.0f, 67.5f));
		}
		mButtons[i]->render(window);	

	}

	
}
开发者ID:TokyoBirdy,项目名称:MasterOfSorcery,代码行数:24,代码来源:MainMenuState.cpp

示例3: render

void GridPoint::render(sf::RenderTarget &tgt) {
// We don't want the circle to scale with the image, so we have to break out of
// the current View and compute the position manually.

	const sf::View &view = tgt.GetView();
	sf::FloatRect rect = view.GetRect();

	float xtrans = rect.Left + (x * tgt.GetWidth() / rect.GetWidth());
	float ytrans = rect.Top + (y * tgt.GetHeight() / rect.GetHeight());

	tgt.SetView( tgt.GetDefaultView() );
	
	sf::Shape circle = sf::Shape::Circle(xtrans, ytrans, 5,
	                                     sf::Color(0, 0, 0, 0),
	                                     1, sf::Color(255, 0, 0));
	tgt.Draw(circle);

	tgt.SetView(view);
}
开发者ID:ChickenProp,项目名称:seegoban,代码行数:19,代码来源:gridpoint.cpp

示例4: renderFrame

void PlayerHUD::renderFrame(sf::RenderTarget& targ) const {
	const int id = mPlayer->mGamepad->getId();
	const sf::Vector2f& size = this->mSpriteBox->GetSize();

	glPushMatrix();

	//Check if the player should be aligned to the right side of the screen.
	if(id%2) {
		glTranslatef(targ.GetWidth() - size.x, 0, 0);
	}

	//Check if this frame is in the bottom of the screen
	if(id >= 2) {
		glTranslatef(0, targ.GetHeight() - size.y, 0);
	}

	targ.Draw(*mSpriteBox);

	glPopMatrix();
}
开发者ID:TokyoBirdy,项目名称:MasterOfSorcery,代码行数:20,代码来源:Player.cpp


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