[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] How does pygame.draw.rect border width work?



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 : owner-pygame-users@xxxxxxxx <owner-pygame-users@xxxxxxxx> de la part de N2TheRed <xxn2theredxx@xxxxxxxxx>
Envoyé : jeudi, 2 novembre 2017 13:25:51
À : pygame-users@xxxxxxxx
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/Screenshot_%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/Screenshot_%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/Screenshot_%2814%29.png>



--
Sent from: http://pygame-users.25799.x6.nabble.com/