Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: it doesnt render the bars  (Read 6140 times)

0 Members and 1 Guest are viewing this topic.

eniddelemaj

  • Newbie
  • *
  • Posts: 13
    • View Profile
it doesnt render the bars
« on: October 03, 2016, 12:58:50 pm »
im creating a pong game with a play class and the ball and bat class.
bat and ball returning their shapes with a method. ball is working but i dont get the bat shapes!

this is in the bars(or bat) constructor:
Bars::Bars()
{
        //linke Bar
        barOne.setSize(sf::Vector2f(20.0, 90.0));
        barOne.setPosition(sf::Vector2f( 0.0, 640.0));


        //rechte Bar
        barTwo.setSize(sf::Vector2f(20.0, 90.0));
        barTwo.setPosition(sf::Vector2f(590.0, 640.0));
}

 
these methods return bat of type rectangleshape

sf::RectangleShape Bars::getBarOne()
{
       
        return barOne;
}

sf::RectangleShape Bars::getBarTwo()
{
        return barTwo;
}

and the draw method of class play is drawing the shapes to the window
void play::draw(game &Game)
{

        Game.window.draw(ball.getShape());
        Game.window.draw(bars.getBarOne());
        Game.window.draw(bars.getBarTwo());
       
}

i dont get it...only the ball is appearing but none of the bars.
in my dispair i changed the types of the bars to circleshape types.
in the constructor i initialized the circleshapes and it worked!
i dont get it what do i miss?

thank you for your help!

eniddelemaj

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: it doesnt render the bars
« Reply #1 on: October 03, 2016, 01:11:48 pm »
its just embarassing i found the mistake!

i dont want to talk about it its too dumb!

but thanks for everybody who read my post and wanted to help!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: it doesnt render the bars
« Reply #2 on: October 03, 2016, 01:52:13 pm »
its just embarassing i found the mistake!

i dont want to talk about it its too dumb!
Don't be afraid to make mistakes, even dumb ones. ;)
Every time one fails, one gets to learn something new.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eniddelemaj

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: it doesnt render the bars
« Reply #3 on: October 03, 2016, 05:02:39 pm »
thank you i appreciate that:)

 

anything