Thank you Luke, for your reply. I find it funny I never thought about doing it like Yann suggested, but I've implemented it and it works as I thought it the original should have.
On Thu, Nov 2, 2017 at 10:32 PM, Luke Paireepinart <[email protected]> wrote: > I think this happens because the border is drawn with line segments > between discrete points so the corners never get filled in for widths above > 1. I remember running into this in the past and I solved it the same way, > using stacked rects. > > On Nov 2, 2017 9:25 AM, "Zexx Moore" <[email protected]> wrote: > >> Thanks for the reply Yann. >> >> I had figured my math was wrong, but it seemed pretty basic to me. You >> did give me an alternative, which is going to be much easier then what I >> had been trying to do. >> >> My thinking now is that I can draw three solid rects, one that will be >> the border, another rect for the inside background color, and a third rect >> for the percent bar. >> >> This is going to be a much easier approach and one that I feel will not >> break like the previous one. >> >> Thanks for the idea Yann. >> >> On Thu, Nov 2, 2017 at 7:38 AM, Yann Thorimbert <[email protected] >> > wrote: >> >>> Hello, >>> >>> >>> When I need a true border, I simply draw two rects, the seconde one >>> hiding the first one in such a way that the rest of the first one >>> constitutes the border. >>> >>> I don't know why the default behaviour of draw.rect() is this strange >>> border for width bigger than 1. >>> >>> >>> Cheers, >>> >>> >>> Yann >>> ------------------------------ >>> *De :* [email protected] <[email protected]> de la >>> part de N2TheRed <[email protected]> >>> *Envoyé :* jeudi, 2 novembre 2017 13:25:51 >>> *À :* [email protected] >>> *Objet :* [pygame] How does pygame.draw.rect border width work? >>> >>> I've been trying to make a percent bar class that I can use to represent >>> health or speed, but the border width is causing issues. >>> >>> The goal is to make an outer rectangle frame of a specified border width >>> while using a solid rect inside it to represent a percentage. >>> >>> <http://pygame-users.25799.x6.nabble.com/file/t429/Screensho >>> t_%2812%29.png> >>> >>> In the picture above, I pass in a border width of 1 for the outer rect >>> frame >>> with a width of 300 and a height of 50. At least in the picture above, >>> it >>> seems to work out find. >>> >>> <http://pygame-users.25799.x6.nabble.com/file/t429/Screensho >>> t_%2813%29.png> >>> >>> In that picture, I pass in all the same values except for a width of 10 >>> instead of 1. This time, it breaks and I've been unable to figure out >>> why. >>> >>> <http://pygame-users.25799.x6.nabble.com/file/t429/Screensho >>> t_%2814%29.png> >>> >>> >>> >>> -- >>> Sent from: http://pygame-users.25799.x6.nabble.com/ >>> >> >>
