本文整理汇总了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();
}
示例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);
}
}
示例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);
}
示例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();
}