本文整理汇总了C++中sf::RenderWindow::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::Draw方法的具体用法?C++ RenderWindow::Draw怎么用?C++ RenderWindow::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::Draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void Player::Draw(sf::RenderWindow& iWindow, sf::Color& iColor, float timeElapsed) const
{
if(!mIsActive)
return;
sf::Shape cannon;
sf::Color regularColor = iColor;
if(mLife < 30 && ((int)timeElapsed%2))
{
iColor.a -= 130;
}
// create the cannon shape
cannon.AddPoint(0, 0, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(20, 0, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(20, 20, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(15, 20, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(15, 40, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(5, 40, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(5, 20, iColor, sf::Color(255, 255, 255));
cannon.AddPoint(0, 20, iColor, sf::Color(255, 255, 255));
// Define an outline width
cannon.SetOutlineWidth(2);
// Disable filling and enable the outline
cannon.EnableFill(true);
cannon.EnableOutline(true);
cannon.SetColor(sf::Color(255, 255, 255));
/*cannon.Move(mPosition.X(), mPosition.Y());
cannon.SetCenter(10,0);
cannon.Rotate(mCannonRotation);*/
// move and rotate the shape for each player
cannon.Move(mPosition.X(), mPosition.Y());
cannon.SetCenter(10,0);
//switch(mID)
//{
//case 0:
// cannon.Rotate(mCannonRotation);
// break;
//case 1:
// cannon.Rotate(mCannonRotation+90.0f);
// break;
//case 2:
// cannon.Rotate(mCannonRotation+180.0f);
// break;
//case 3:
// cannon.Rotate(mCannonRotation-90.0f);
// break;
//}
cannon.Rotate(mCannonRotation);
// Draw the cannon
iWindow.Draw(cannon);
// draw projectiles
for(int i=0; i<mProjectiles.size(); i++)
{
mProjectiles.at(i)->Draw(iWindow,regularColor);
}
}
示例2: draw
void WidgetBase::draw(sf::RenderWindow &window) const {
window.Draw(_sprite);
}
示例3: afficher
//*Methodes
void Carte::afficher(sf::RenderWindow& App,std::string txt){
if (txt.compare("inf") == 0)
App.Draw(Iinf);
else
App.Draw(Isup);
}
示例4: Draw
void Animation::Draw(sf::RenderWindow &Window)
{
Window.Draw(spriteImage);
}
示例5: drawInventory
void Player::drawInventory(sf::RenderWindow& rw) const
{
static bool firstRun = true;
static sf::Image tlo;
static sf::Font font;
if(firstRun)
{
tlo.LoadFromFile("Images/inv.png");
firstRun = false;
font.LoadFromFile("silesiana.otf", 50, L"A�BC�DE�FGHIJKL�MN�O�PRS�TUWYZ��a�bc�de�fghijkl�mn�o�prs�tuwyz��[email protected]#$%^&*()_-[]\\;',./{}:\"<>?=-+ ");
}
sf::Sprite tloH(tlo);
rw.Draw(tloH);
std::stringstream ss;
ss<<"Masz " << coins << " $";
sf::String t(ss.str(), font, 30.f);
t.SetColor(sf::Color(20, 18, 160));
t.SetPosition(600.f, 30.f);
rw.Draw(t);
float posy = 30.0;
int i = 0;
for(std::vector<Item>::const_iterator it = inventory.begin(); it != inventory.end(); it++)
{
std::wstring name = it->getName();
if(i == weapon)
{
name += L" (uzbrojny - bro�)";
}
if(i == armor)
{
name += L" (uzbrojny - zbroja)";
}
sf::String t(name, font, 30.f);
t.SetColor(sf::Color(20, 18, 160));
if(selectedItem == i)
t.SetColor(sf::Color(200, 18, 160));
t.SetPosition(20.f, posy);
rw.Draw(t);
posy += 30.0;
i++;
}
if(0 <= selectedItem && selectedItem < inventory.size())
{
TextArea desc(inventory[selectedItem].getDesc(), 400, font);
desc.SetPosition(300, 50);
rw.Draw(desc);
Item::Type type = inventory[selectedItem].getProperty();
if(type == 0)
{
TextArea desc1(L"Bron - Atak + " +inventory[selectedItem].getBoost(), 400,font);
desc1.SetPosition(350,250);
rw.Draw(desc1);
}
else if(type == 1)
{
TextArea desc1(L"Zbroja - Obrona + " +inventory[selectedItem].getBoost(), 400,font);
desc1.SetPosition(350,250);
rw.Draw(desc1);
}
else if(type == 2)
{
TextArea desc1(L"Helm - Obrona + " +inventory[selectedItem].getBoost(), 400,font);
desc1.SetPosition(350,250);
rw.Draw(desc1);
}
else if(type == 3)
{
TextArea desc1(L"Mikstura", 460,font);
desc1.SetPosition(350,250);
rw.Draw(desc1);
}
}
}
示例6: Draw
void TankSpawn::Draw(sf::RenderWindow& wnd){
wnd.Draw(mSprite);
}
示例7: Draw
void IGui::Draw(sf::RenderWindow& window)
{
window.Draw(sprite);
}
示例8: renderForeground
void Map::renderForeground(sf::RenderWindow& window) const
{
window.Draw(*mForeground);
}
示例9: Draw
void Node::Draw(sf::RenderWindow &renderWindow){
if (_isLoaded){
renderWindow.Draw(_sprite);
}
}
示例10: Draw
void Frame::Draw(sf::RenderWindow& W){
if(sprite)
W.Draw(*sprite);
}
示例11: renderBackground
void Map::renderBackground(sf::RenderWindow& window) const
{
window.Draw(*mBackground);
}
示例12: run
//.........这里部分代码省略.........
if(monEvent.MouseButton.X > SpriteFlecheGauche5.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheGauche5.GetPosition().x + TAILLEFLECHE)
{
l = l - TAILLEIMAGEMANCHES;
if(l < 0)
{
l = TAILLETILEMANCHES - TAILLEIMAGEMANCHES;
}
SpriteNombreManches.SetSubRect(sf::IntRect(l, 0, l + TAILLEIMAGEMANCHES, TAILLEIMAGEMANCHES));
}
//Cas ou on clique sur la fleche suivant pour le choix du nombre de manches gagnantes
if(monEvent.MouseButton.X > SpriteFlecheDroite4.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheDroite4.GetPosition().x + TAILLEFLECHE)
{
l = l + TAILLEIMAGEMANCHES;
if(l >= TAILLETILEMANCHES)
{
l = 0;
}
SpriteNombreManches.SetSubRect(sf::IntRect(l, 0, l + TAILLEIMAGEMANCHES, TAILLEIMAGEMANCHES));
}
}
//Cas ou on clique sur Commencer
if(monEvent.MouseButton.X > 530 && monEvent.MouseButton.X < 710)
{
if(monEvent.MouseButton.Y > 660 && monEvent.MouseButton.Y < 710)
{
//Switch sur i pour savoir quel perso a choisi le joueur 1
switch(i)
{
case 0*TAILLEIMAGEPERSO:
joueur1 = "zelda";
break;
case 1*TAILLEIMAGEPERSO:
joueur1 = "mario";
break;
}
//Switch sur j pour savoir quel perso a choisi le joueur 2
switch(j)
{
case 0*TAILLEIMAGEPERSO:
joueur2 = "zelda";
break;
case 1*TAILLEIMAGEPERSO:
joueur2 = "mario";
break;
}
//Switch sur k pour savoir quel map ont choisi les joueurs
switch(k)
{
case 0*TAILLEIMAGEMAP:
map = "zelda";
break;
case 1*TAILLEIMAGEMAP:
map = "mario";
break;
}
//On initialise le nombre de parties gagnantes
perso1.setNombreDeManchesGagnantes((int)(l / TAILLEIMAGEMANCHES) + 1);
perso2.setNombreDeManchesGagnantes((int)(l / TAILLEIMAGEMANCHES) + 1);
perso1.setThemePersonnage(joueur1);
perso2.setThemePersonnage(joueur2);
affichage.setThemeCarte(map);
return (ECRAN_JEU); // On rentre dans l'écran du jeu
}
}
}
}
fenetre.Clear();
fenetre.Draw(SpriteMulti);
fenetre.Draw(SpriteFlecheDroite1);
fenetre.Draw(SpriteFlecheDroite2);
fenetre.Draw(SpriteFlecheDroite3);
fenetre.Draw(SpriteFlecheDroite4);
fenetre.Draw(SpriteFlecheGauche1);
fenetre.Draw(SpriteFlecheGauche2);
fenetre.Draw(SpriteFlecheGauche3);
fenetre.Draw(SpriteFlecheGauche4);
fenetre.Draw(SpriteFlecheGauche5);
fenetre.Draw(SpritePerso1);
fenetre.Draw(SpritePerso2);
fenetre.Draw(SpriteMap);
fenetre.Draw(SpriteNombreManches);
fenetre.Display();
}
return (ECRAN_QUITTER);
}
示例13: Draw
void Block::Draw(sf::RenderWindow& Window)const{
Block::Sprite.SetPosition(Location);
Window.Draw(Block::Sprite);
}
示例14: draw
void const MoveOrder::draw(sf::RenderWindow &App)
{
destination_circle = sf::Shape::Circle(xpos, ypos, 2, sf::Color(0,0,0,0), 2, sf::Color::White);
App.Draw(destination_circle);
}
示例15: draw
//draws the chess piece
void Knight::draw(sf::RenderWindow& canvas)const{
canvas.Draw(m_sprite);
}