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

Author Topic: Issues drawing BoundBoxes  (Read 1015 times)

0 Members and 1 Guest are viewing this topic.

bryce910

  • Newbie
  • *
  • Posts: 31
    • View Profile
Issues drawing BoundBoxes
« on: March 13, 2015, 07:05:03 pm »
Let me first state this is probably a very noobish question but I have not been able to figure this out!

I am trying to draw a bounding box around my sprite and I kept getting an error stating boundBox can't be drawn.

    sf::FloatRect boundingBox = player[0].getGlobalBounds();
    window.draw(boundingBox);

 

For a better explanation player[0] is a sprite that player 1 controls. so in theory like I saw of the sfml site this should set it to the correct size but I can't figure out what I need to do to draw it.

Thanks for the help!  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issues drawing BoundBoxes
« Reply #1 on: March 13, 2015, 07:12:05 pm »
The API documentation explains why sf::FloatRect cannot be drawn. The tutorials show you how to draw a rectangle.

Don't try random things, just read the doc ;)
Laurent Gomila - SFML developer

bryce910

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Issues drawing BoundBoxes
« Reply #2 on: March 13, 2015, 08:09:52 pm »
Ahhh never mind! I misunderstood what I was reading! I saw an example but it was of collision, not of these drawing...which I need to make a rectangle for instead.
« Last Edit: March 13, 2015, 08:15:03 pm by bryce910 »