diff --git a/docs/reST/ref/mixer.rst b/docs/reST/ref/mixer.rst index 5a441c7f81..9f5d57105b 100644 --- a/docs/reST/ref/mixer.rst +++ b/docs/reST/ref/mixer.rst @@ -79,6 +79,10 @@ The following file formats are supported The channels argument is used to specify whether to use mono or stereo. 1 for mono and 2 for stereo. + + ``NOTE``: The channels argument is not related to the number + of channels for playback of sounds, that you can get with the function + ``get_num_channels`` or set with the function ``set_num_channels`` (see below). The buffer argument controls the number of internal samples used in the sound mixer. The default value should work for most cases. It can be lowered @@ -220,7 +224,7 @@ The following file formats are supported | :sl:`set the total number of playback channels` | :sg:`set_num_channels(count, /) -> None` - Sets the number of available channels for the mixer. The default value is 8. + Sets the number of available playback channels for the mixer. The default value is 8. The value can be increased or decreased. If the value is decreased, sounds playing on the truncated channels are stopped. diff --git a/examples/go_over_there.py b/examples/go_over_there.py index 7284134190..51b04f6d64 100644 --- a/examples/go_over_there.py +++ b/examples/go_over_there.py @@ -14,7 +14,7 @@ import random MIN_SPEED = 0.25 -MAX_SPEED = 5 +MAX_SPEED = 1 MAX_BALLS = 1600 SCREEN_SIZE = pygame.Vector2(1000, 600) CIRCLE_RADIUS = 5 diff --git a/src_c/draw.c b/src_c/draw.c index 0d6b9fc8a8..d967d22a51 100644 --- a/src_c/draw.c +++ b/src_c/draw.c @@ -1189,7 +1189,7 @@ rect(PyObject *self, PyObject *args, PyObject *kwargs) } draw_round_rect(surf, rect->x, rect->y, rect->x + rect->w - 1, - rect->y + rect->h - 1, radius, width, color, + rect->y + rect->h - 1, MAX(radius, 0), width, color, top_left_radius, top_right_radius, bottom_left_radius, bottom_right_radius, drawn_area); if (!pgSurface_Unlock(surfobj)) { diff --git a/test/rect_test.py b/test/rect_test.py index 0ad1af77c3..e032242db6 100644 --- a/test/rect_test.py +++ b/test/rect_test.py @@ -52,6 +52,41 @@ def testCalculatedAttributes(self): self.assertEqual((r.left, r.centery), r.midleft) self.assertEqual((r.right, r.centery), r.midright) + def testAttributes(self): + """Checks that all the attributes are initialized correctly.""" + r = Rect(1, 2, 3, 4) + + self.assertEqual(1, r.left) + self.assertEqual(2, r.top) + self.assertEqual(4, r.right) + self.assertEqual(6, r.bottom) + + self.assertEqual(1, r.x) + self.assertEqual(2, r.y) + + self.assertEqual(3, r.w) + self.assertEqual(4, r.h) + + self.assertEqual((1, 2), r.topleft) + self.assertEqual((4, 2), r.topright) + self.assertEqual((1, 6), r.bottomleft) + self.assertEqual((4, 6), r.bottomright) + + self.assertEqual((3, 4), r.size) + self.assertEqual(3, r.width) + self.assertEqual(4, r.height) + + self.assertEqual(2, r.centerx) + self.assertEqual(4, r.centery) + self.assertEqual((2, 4), r.center) + + self.assertEqual((2, 2), r.midtop) + self.assertEqual((2, 6), r.midbottom) + self.assertEqual((1, 4), r.midleft) + self.assertEqual((4, 4), r.midright) + + + def testRepr(self): rect = Rect(12, 34, 56, 78) self.assertEqual(repr(rect), "Rect(12, 34, 56, 78)")