SFML community forums

Bindings - other languages => General => Topic started by: eniddelemaj on October 03, 2016, 12:58:50 pm

Title: it doesnt render the bars
Post by: eniddelemaj 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!
Title: Re: it doesnt render the bars
Post by: eniddelemaj 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!
Title: Re: it doesnt render the bars
Post by: eXpl0it3r 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.
Title: Re: it doesnt render the bars
Post by: eniddelemaj on October 03, 2016, 05:02:39 pm
thank you i appreciate that:)