def _draw_button(self, overlay, text, location):
        """Draws a button on the won and lost overlays, and return its hitbox."""
        label = self.button_font.render(text, True, (119, 110, 101))
        w, h = label.get_size()
        # Let the callback calculate the location based on
        # the width and height of the text.
        x, y = location(w, h)
        # Draw a box with some border space.
        pygame.draw.rect(overlay, (238, 228, 218), (x - 5, y - 5, w + 10, h + 10))
        overlay.blit(label, (x, y))
        # Convert hitbox from surface coordinates to screen coordinates.
        x += self.origin[0] - 5
        y += self.origin[1] - 5
        # Return the hitbox.
        return x - 5, y - 5, x + w + 10, y + h + 10
def _draw_button ( self , overlay , text , location ) : label = self . button_font . render ( text , True , ( 119 , 110 , 101 ) ) w , h = label . get_size ( ) x , y = location ( w , h ) pygame . draw . rect ( overlay , ( 238 , 228 , 218 ) , ( x - 5 , y - 5 , w + 10 , h + 10 ) ) overlay . blit ( label , ( x , y ) ) x += self . origin [ 0 ] - 5 y += self . origin [ 1 ] - 5 return x - 5 , y - 5 , x + w + 10 , y + h + 10
Draws a button on the won and lost overlays, and return its hitbox.