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!