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

Author Topic: Drawing RectangleShape Second Time Overwrites Background  (Read 815 times)

0 Members and 1 Guest are viewing this topic.

qmurphy

  • Newbie
  • *
  • Posts: 1
    • View Profile
Drawing RectangleShape Second Time Overwrites Background
« on: July 18, 2013, 11:24:58 pm »
I'm currently working on a Password Generator for my company, and while I already have the backbone in place, I'm working on developing the GUI. I have the user click a few different settings, and it moves the "Selection Rectangle" (represented by a sf::RectangleShape). When I update the screen for the first time, everything shows just fine. But each time I redraw the screen afterwards, the rectangles cover everything another sprite I have drawn behind (they are transparent with a 5 pixel outline). I've attached my code and a picture that I use in the program (location is given on line 16).

If anyone could help, I would be greatly appreciative. If I comment out lines 151 and 152, I don't have any issues, but those are necessary to move redraw the rectangle once its been moved. I've never really worked with anyone else on SFML projects, so if I do something different than how its normally done and you need clarification on my code, I will be glad to give it.

EDIT: If I replace the RectangleShape with a PNG Sprite, everything works just fine. Maybe that's how I'll do it, but I would assume that the RectangleShape would be faster, right?
« Last Edit: July 18, 2013, 11:32:49 pm by qmurphy »

 

anything