1. pygame
  2. pygame
  3. pygame

Commits

Lenard Lindstrom  committed b0b3a3f Merge

update to main branch

  • Participants
  • Parent commits 984cc43, 9fcb7ab
  • Branches default

Comments (0)

Files changed (24)

File docs/reST/ref/code_examples/draw_module_example.png

  • Ignore whitespace
Added
New image

File docs/reST/ref/code_examples/draw_module_example.py

View file
  • Ignore whitespace
+# Import a library of functions called 'pygame'
+import pygame
+from math import pi
+ 
+# Initialize the game engine
+pygame.init()
+ 
+# Define the colors we will use in RGB format
+BLACK = (  0,   0,   0)
+WHITE = (255, 255, 255)
+BLUE =  (  0,   0, 255)
+GREEN = (  0, 255,   0)
+RED =   (255,   0,   0)
+ 
+# Set the height and width of the screen
+size = [400, 300]
+screen = pygame.display.set_mode(size)
+ 
+pygame.display.set_caption("Example code for the draw module")
+ 
+#Loop until the user clicks the close button.
+done = False
+clock = pygame.time.Clock()
+ 
+while not done:
+ 
+    # This limits the while loop to a max of 10 times per second.
+    # Leave this out and we will use all CPU we can.
+    clock.tick(10)
+     
+    for event in pygame.event.get(): # User did something
+        if event.type == pygame.QUIT: # If user clicked close
+            done=True # Flag that we are done so we exit this loop
+ 
+    # All drawing code happens after the for loop and but
+    # inside the main while done==False loop.
+     
+    # Clear the screen and set the screen background
+    screen.fill(WHITE)
+ 
+    # Draw on the screen a GREEN line from (0,0) to (50.75) 
+    # 5 pixels wide.
+    pygame.draw.line(screen, GREEN, [0, 0], [50,30], 5)
+ 
+    # Draw on the screen a GREEN line from (0,0) to (50.75) 
+    # 5 pixels wide.
+    pygame.draw.lines(screen, BLACK, False, [[0, 80], [50, 90], [200, 80], [220, 30]], 5)
+    
+    # Draw on the screen a GREEN line from (0,0) to (50.75) 
+    # 5 pixels wide.
+    pygame.draw.aaline(screen, GREEN, [0, 50],[50, 80], True)
+
+    # Draw a rectangle outline
+    pygame.draw.rect(screen, BLACK, [75, 10, 50, 20], 2)
+     
+    # Draw a solid rectangle
+    pygame.draw.rect(screen, BLACK, [150, 10, 50, 20])
+     
+    # Draw an ellipse outline, using a rectangle as the outside boundaries
+    pygame.draw.ellipse(screen, RED, [225, 10, 50, 20], 2) 
+
+    # Draw an solid ellipse, using a rectangle as the outside boundaries
+    pygame.draw.ellipse(screen, RED, [300, 10, 50, 20]) 
+ 
+    # This draws a triangle using the polygon command
+    pygame.draw.polygon(screen, BLACK, [[100, 100], [0, 200], [200, 200]], 5)
+  
+    # Draw an arc as part of an ellipse. 
+    # Use radians to determine what angle to draw.
+    pygame.draw.arc(screen, BLACK,[210, 75, 150, 125], 0, pi/2, 2)
+    pygame.draw.arc(screen, GREEN,[210, 75, 150, 125], pi/2, pi, 2)
+    pygame.draw.arc(screen, BLUE, [210, 75, 150, 125], pi,3*pi/2, 2)
+    pygame.draw.arc(screen, RED,  [210, 75, 150, 125], 3*pi/2, 2*pi, 2)
+    
+    # Draw a circle
+    pygame.draw.circle(screen, BLUE, [60, 250], 40)
+    
+    # Go ahead and update the screen with what we've drawn.
+    # This MUST happen after all the other drawing commands.
+    pygame.display.flip()
+ 
+# Be IDLE friendly
+pygame.quit()

File docs/reST/ref/code_examples/joystick_calls.png

  • Ignore whitespace
Added
New image

File docs/reST/ref/code_examples/joystick_calls.py

View file
  • Ignore whitespace
+import pygame
+
+# Define some colors
+BLACK    = (   0,   0,   0)
+WHITE    = ( 255, 255, 255)
+
+# This is a simple class that will help us print to the screen
+# It has nothing to do with the joysticks, just outputing the
+# information.
+class TextPrint:
+    def __init__(self):
+        self.reset()
+        self.font = pygame.font.Font(None, 20)
+
+    def print(self, screen, textString):
+        textBitmap = self.font.render(textString, True, BLACK)
+        screen.blit(textBitmap, [self.x, self.y])
+        self.y += self.line_height
+        
+    def reset(self):
+        self.x = 10
+        self.y = 10
+        self.line_height = 15
+        
+    def indent(self):
+        self.x += 10
+        
+    def unindent(self):
+        self.x -= 10
+    
+
+pygame.init()
+ 
+# Set the width and height of the screen [width,height]
+size = [500, 700]
+screen = pygame.display.set_mode(size)
+
+pygame.display.set_caption("My Game")
+
+#Loop until the user clicks the close button.
+done = False
+
+# Used to manage how fast the screen updates
+clock = pygame.time.Clock()
+
+# Initialize the joysticks
+pygame.joystick.init()
+    
+# Get ready to print
+textPrint = TextPrint()
+
+# -------- Main Program Loop -----------
+while done==False:
+    # EVENT PROCESSING STEP
+    for event in pygame.event.get(): # User did something
+        if event.type == pygame.QUIT: # If user clicked close
+            done=True # Flag that we are done so we exit this loop
+        
+        # Possible joystick actions: JOYAXISMOTION JOYBALLMOTION JOYBUTTONDOWN JOYBUTTONUP JOYHATMOTION
+        if event.type == pygame.JOYBUTTONDOWN:
+            print("Joystick button pressed.")
+        if event.type == pygame.JOYBUTTONUP:
+            print("Joystick button released.")
+            
+ 
+    # DRAWING STEP
+    # First, clear the screen to white. Don't put other drawing commands
+    # above this, or they will be erased with this command.
+    screen.fill(WHITE)
+    textPrint.reset()
+
+    # Get count of joysticks
+    joystick_count = pygame.joystick.get_count()
+
+    textPrint.print(screen, "Number of joysticks: {}".format(joystick_count) )
+    textPrint.indent()
+    
+    # For each joystick:
+    for i in range(joystick_count):
+        joystick = pygame.joystick.Joystick(i)
+        joystick.init()
+    
+        textPrint.print(screen, "Joystick {}".format(i) )
+        textPrint.indent()
+    
+        # Get the name from the OS for the controller/joystick
+        name = joystick.get_name()
+        textPrint.print(screen, "Joystick name: {}".format(name) )
+        
+        # Usually axis run in pairs, up/down for one, and left/right for
+        # the other.
+        axes = joystick.get_numaxes()
+        textPrint.print(screen, "Number of axes: {}".format(axes) )
+        textPrint.indent()
+        
+        for i in range( axes ):
+            axis = joystick.get_axis( i )
+            textPrint.print(screen, "Axis {} value: {:>6.3f}".format(i, axis) )
+        textPrint.unindent()
+            
+        buttons = joystick.get_numbuttons()
+        textPrint.print(screen, "Number of buttons: {}".format(buttons) )
+        textPrint.indent()
+
+        for i in range( buttons ):
+            button = joystick.get_button( i )
+            textPrint.print(screen, "Button {:>2} value: {}".format(i,button) )
+        textPrint.unindent()
+            
+        # Hat switch. All or nothing for direction, not like joysticks.
+        # Value comes back in an array.
+        hats = joystick.get_numhats()
+        textPrint.print(screen, "Number of hats: {}".format(hats) )
+        textPrint.indent()
+
+        for i in range( hats ):
+            hat = joystick.get_hat( i )
+            textPrint.print(screen, "Hat {} value: {}".format(i, str(hat)) )
+        textPrint.unindent()
+        
+        textPrint.unindent()
+
+    
+    # ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT
+    
+    # Go ahead and update the screen with what we've drawn.
+    pygame.display.flip()
+
+    # Limit to 20 frames per second
+    clock.tick(20)
+    
+# Close the window and quit.
+# If you forget this line, the program will 'hang'
+# on exit if running from IDLE.
+pygame.quit ()
+

File docs/reST/ref/display.rst

View file
  • Ignore whitespace
 to update the actual display.
 
 The origin of the display, where x = 0, and y = 0 is the top left of the
-screen. Both axis increase positively towards the botom right of the screen.
+screen. Both axis increase positively towards the bottom right of the screen.
 
 The pygame display can actually be initialized in one of several modes. By
 default the display is a basic software driven framebuffer. You can request
 
 .. function:: init
 
-   | :sl:`initialize the display module`
+   | :sl:`Initialize the display module`
    | :sg:`init() -> None`
 
    Initializes the pygame display module. The display module cannot do anything
 
 .. function:: quit
 
-   | :sl:`uninitialize the display module`
+   | :sl:`Uninitialize the display module`
    | :sg:`quit() -> None`
 
    This will shut down the entire display module. This means any active
 
 .. function:: get_init
 
-   | :sl:`true if the display module is initialized`
+   | :sl:`Returns True if the display module has been initialized`
    | :sg:`get_init() -> bool`
 
    Returns True if the :mod:`pygame.display` module is currently initialized.
 
 .. function:: set_mode
 
-   | :sl:`initialize a window or screen for display`
+   | :sl:`Initialize a window or screen for display`
    | :sg:`set_mode(resolution=(0,0), flags=0, depth=0) -> Surface`
 
    This function will create a display Surface. The arguments passed in are
 
    When requesting fullscreen display modes, sometimes an exact match for the
    requested resolution cannot be made. In these situations pygame will select
-   the closest compatable match. The returned surface will still always match
+   the closest compatible match. The returned surface will still always match
    the requested resolution.
 
    The flags argument controls which type of display you want. There are
       pygame.FULLSCREEN    create a fullscreen display
       pygame.DOUBLEBUF     recommended for HWSURFACE or OPENGL
       pygame.HWSURFACE     hardware accelerated, only in FULLSCREEN
-      pygame.OPENGL        create an opengl renderable display
+      pygame.OPENGL        create an OpenGL renderable display
       pygame.RESIZABLE     display window should be sizeable
       pygame.NOFRAME       display window will have no border or controls
 
+   For example:
+    
+   ::
+    
+        # Open a window on the screen
+        screen_width=700
+        screen_height=400
+        screen=pygame.display.set_mode([screen_width,screen_height])
+    
    .. ## pygame.display.set_mode ##
 
 .. function:: get_surface
 
-   | :sl:`get a reference to the currently set display surface`
+   | :sl:`Get a reference to the currently set display surface`
    | :sg:`get_surface() -> Surface`
 
    Return a reference to the currently set display Surface. If no display mode
 
 .. function:: flip
 
-   | :sl:`update the full display Surface to the screen`
+   | :sl:`Update the full display Surface to the screen`
    | :sg:`flip() -> None`
 
    This will update the contents of the entire display. If your display mode is
 
 .. function:: update
 
-   | :sl:`update portions of the screen for software displays`
+   | :sl:`Update portions of the screen for software displays`
    | :sg:`update(rectangle=None) -> None`
    | :sg:`update(rectangle_list) -> None`
 
 
 .. function:: get_driver
 
-   | :sl:`get the name of the pygame display backend`
+   | :sl:`Get the name of the pygame display backend`
    | :sg:`get_driver() -> name`
 
    Pygame chooses one of many available display backends when it is
 
 .. function:: list_modes
 
-   | :sl:`get list of available fullscreen modes`
+   | :sl:`Get list of available fullscreen modes`
    | :sg:`list_modes(depth=0, flags=pygame.FULLSCREEN) -> list`
 
    This function returns a list of possible dimensions for a specified color
 
 .. function:: mode_ok
 
-   | :sl:`pick the best color depth for a display mode`
+   | :sl:`Pick the best color depth for a display mode`
    | :sg:`mode_ok(size, flags=0, depth=0) -> depth`
 
    This function uses the same arguments as ``pygame.display.set_mode()``. It
-   is used to depermine if a requested display mode is available. It will
+   is used to determine if a requested display mode is available. It will
    return 0 if the display mode cannot be set. Otherwise it will return a pixel
    depth that best matches the display asked for.
 
 
 .. function:: gl_get_attribute
 
-   | :sl:`get the value for an opengl flag for the current display`
+   | :sl:`Get the value for an OpenGL flag for the current display`
    | :sg:`gl_get_attribute(flag) -> value`
 
    After calling ``pygame.display.set_mode()`` with the ``pygame.OPENGL`` flag,
 
 .. function:: gl_set_attribute
 
-   | :sl:`request an opengl display attribute for the display mode`
+   | :sl:`Request an OpenGL display attribute for the display mode`
    | :sg:`gl_set_attribute(flag, value) -> None`
 
    When calling ``pygame.display.set_mode()`` with the ``pygame.OPENGL`` flag,
 
 .. function:: get_active
 
-   | :sl:`true when the display is active on the display`
+   | :sl:`Returns True when the display is active on the display`
    | :sg:`get_active() -> bool`
 
    After ``pygame.display.set_mode()`` is called the display Surface will be
 
 .. function:: iconify
 
-   | :sl:`iconify the display surface`
+   | :sl:`Iconify the display surface`
    | :sg:`iconify() -> bool`
 
    Request the window for the display surface be iconified or hidden. Not all
    systems and displays support an iconified display. The function will return
-   True if successfull.
+   True if successful.
 
    When the display is iconified ``pygame.display.get_active()`` will return
    False. The event queue should receive a ``ACTIVEEVENT`` event when the
 
 .. function:: toggle_fullscreen
 
-   | :sl:`switch between fullscreen and windowed displays`
+   | :sl:`Switch between fullscreen and windowed displays`
    | :sg:`toggle_fullscreen() -> bool`
 
    Switches the display window between windowed and fullscreen modes. This
 
 .. function:: set_gamma
 
-   | :sl:`change the hardware gamma ramps`
+   | :sl:`Change the hardware gamma ramps`
    | :sg:`set_gamma(red, green=None, blue=None) -> bool`
 
    Set the red, green, and blue gamma values on the display hardware. If the
 
 .. function:: set_gamma_ramp
 
-   | :sl:`change the hardware gamma ramps with a custom lookup`
+   | :sl:`Change the hardware gamma ramps with a custom lookup`
    | :sg:`set_gamma_ramp(red, green, blue) -> bool`
 
    Set the red, green, and blue gamma ramps with an explicit lookup table. Each
 
 .. function:: set_icon
 
-   | :sl:`change the system image for the display window`
+   | :sl:`Change the system image for the display window`
    | :sg:`set_icon(Surface) -> None`
 
    Sets the runtime icon the system will use to represent the display window.
 
 .. function:: set_caption
 
-   | :sl:`set the current window caption`
+   | :sl:`Set the current window caption`
    | :sg:`set_caption(title, icontitle=None) -> None`
 
    If the display has a window title, this function will change the name on the
 
 .. function:: get_caption
 
-   | :sl:`get the current window caption`
+   | :sl:`Get the current window caption`
    | :sg:`get_caption() -> (title, icontitle)`
 
    Returns the title and icontitle for the display Surface. These will often be
 
 .. function:: set_palette
 
-   | :sl:`set the display color palette for indexed displays`
+   | :sl:`Set the display color palette for indexed displays`
    | :sg:`set_palette(palette=None) -> None`
 
    This will change the video display color palette for 8bit displays. This

File docs/reST/ref/draw.rst

View file
  • Ignore whitespace
    | :sg:`aaline(Surface, color, startpos, endpos, blend=1) -> Rect`
 
    Draws an anti-aliased line on a surface. This will respect the clipping
-   rectangle. A bounding box of the affected area is returned returned as a
+   rectangle. A bounding box of the affected area is returned as a
    rectangle. If blend is true, the shades will be be blended with existing
    pixel shades instead of overwriting them. This function accepts floating
    point values for the end points.
    | :sg:`aalines(Surface, color, closed, pointlist, blend=1) -> Rect`
 
    Draws a sequence on a surface. You must pass at least two points in the
-   sequence of points. The closed argument is a simple boolean and if true, a
-   line will be draw between the first and last points. The boolean blend
+   sequence of points. The closed argument is a simple Boolean and if true, a
+   line will be draw between the first and last points. The Boolean blend
    argument set to true will blend the shades with existing shades instead of
    overwriting them. This function accepts floating point values for the end
    points.
    .. ## pygame.draw.aalines ##
 
 .. ## pygame.draw ##
+
+.. figure:: code_examples/draw_module_example.png
+   :scale: 50 %
+   :alt: draw module example
+
+   Example code for draw module.
+   
+.. literalinclude:: code_examples/draw_module_example.py
+   

File docs/reST/ref/event.rst

View file
  • Ignore whitespace
 
 | :sl:`pygame module for interacting with events and queues`
 
-Pygame handles all it's event messaging through an event queue. The routines in
+Pygame handles all its event messaging through an event queue. The routines in
 this module help you manage that event queue. The input queue is heavily
 dependent on the pygame display module. If the display has not been initialized
 and a video mode not set, the event queue will not really work.

File docs/reST/ref/joystick.rst

View file
  • Ignore whitespace
 ======================
 
 .. module:: pygame.joystick
-   :synopsis: pygame module for interacting with joystick devices
+   :synopsis: Pygame module for interacting with joysticks, gamepads, and trackballs.
 
-| :sl:`pygame module for interacting with joystick devices`
+| :sl:`Pygame module for interacting with joysticks, gamepads, and trackballs.`
 
-The joystick module manages the joystick devices on a computer (there can be
-more than one). Joystick devices include trackballs and video-game-style
+The joystick module manages the joystick devices on a computer.
+Joystick devices include trackballs and video-game-style
 gamepads, and the module allows the use of multiple buttons and "hats".
+Computers may manage multiple joysticks at a time.
 
-To get initialise the joystick module and get a list of Joystick instances
+Each instance of the Joystick class represents one gaming device plugged 
+into the computer. If a gaming pad has multiple joysticks on it, than the
+joystick object can actually represent multiple joysticks on that single
+game device.
+
+For a quick way to initialise the joystick module and get a list of Joystick instances
 use the following code::
 
     pygame.joystick.init()
 
 .. function:: init
 
-   | :sl:`initialize the joystick module`
+   | :sl:`Initialize the joystick module.`
    | :sg:`init() -> None`
 
    This function is called automatically by ``pygame.init()``.
 
 .. function:: quit
 
-   | :sl:`uninitialize the joystick module`
+   | :sl:`Uninitialize the joystick module.`
    | :sg:`quit() -> None`
 
    Uninitialize the joystick module. After you call this any existing joystick
 
 .. function:: get_init
 
-   | :sl:`true if the joystick module is initialized`
+   | :sl:`Returns True if the joystick module is initialized.`
    | :sg:`get_init() -> bool`
 
    Test if the ``pygame.joystick.init()`` function has been called.
 
 .. function:: get_count
 
-   | :sl:`number of joysticks on the system`
+   | :sl:`Returns the number of joysticks.`
    | :sg:`get_count() -> count`
 
    Return the number of joystick devices on the system. The count will be 0 if
 
 .. class:: Joystick
 
-   | :sl:`create a new Joystick object`
+   | :sl:`Create a new Joystick object.`
    | :sg:`Joystick(id) -> Joystick`
 
    Create a new joystick to access a physical device. The id argument must be a
    .. ## pygame.joystick.Joystick ##
 
 .. ## pygame.joystick ##
+
+.. figure:: code_examples/joystick_calls.png
+   :scale: 100 %
+   :alt: joystick module example
+
+   Example code for joystick module.
+   
+.. literalinclude:: code_examples/joystick_calls.py
+   

File docs/reST/ref/mask.rst

View file
  • Ignore whitespace
       | :sg:`convolve(othermask, outputmask = None, offset = (0,0)) -> Mask`
 
       Returns a mask with the (i-offset[0],j-offset[1]) bit set if shifting
-      othermask so that it's lower right corner pixel is at (i,j) would cause
+      othermask so that its lower right corner pixel is at (i,j) would cause
       it to overlap with self.
 
       If an outputmask is specified, the output is drawn onto outputmask and

File docs/reST/ref/sprite.rst

View file
  • Ignore whitespace
 
 .. class:: Sprite
 
-   | :sl:`simple base class for visible game objects`
+   | :sl:`Simple base class for visible game objects.`
    | :sg:`Sprite(*groups) -> Sprite`
 
    The base class for visible game objects. Derived classes will want to
    instances to be added to.
 
    When subclassing the Sprite, be sure to call the base initializer before
-   adding the Sprite to Groups.
+   adding the Sprite to Groups. For example:
 
+   .. code-block:: python
+   
+       class Block(pygame.sprite.Sprite):
+            
+           # Constructor. Pass in the color of the block, 
+           # and its x and y position
+           def __init__(self, color, width, height):
+              # Call the parent class (Sprite) constructor
+              pygame.sprite.Sprite.__init__(self) 
+        
+              # Create an image of the block, and fill it with a color.
+              # This could also be an image loaded from the disk.
+              self.image = pygame.Surface([width, height])
+              self.image.fill(color)
+        
+              # Fetch the rectangle object that has the dimensions of the image
+              # Update the position of this object by setting the values of rect.x and rect.y
+              self.rect = self.image.get_rect()   
+      
    .. method:: update
 
       | :sl:`method to control sprite behavior`
 
 .. class:: DirtySprite
 
-   | :sl:`a more featureful subclass of Sprite with more attributes`
+   | :sl:`A subclass of Sprite with more attributes and features.`
    | :sg:`DirtySprite(*groups) -> DirtySprite`
 
    Extra DirtySprite attributes with their default values:
 
 .. class:: Group
 
-   | :sl:`container class for many Sprites`
+   | :sl:`A container class to hold and manage multiple Sprite objects.`
    | :sg:`Group(*sprites) -> Group`
 
    A simple container for Sprite objects. This class can be inherited to create
 
 .. class:: RenderPlain
 
-   same as pygame.sprite.Group
+   | :sl:`Same as pygame.sprite.Group`
+
+   This class is an alias to ``pygame.sprite.Group()``. It has no additional functionality.
+
+   .. ## pygame.sprite.RenderClear ##
 
 .. class:: RenderClear
 
-   same as pygame.sprite.Group
+   | :sl:`Same as pygame.sprite.Group`
 
+   This class is an alias to ``pygame.sprite.Group()``. It has no additional functionality.
 
+   .. ## pygame.sprite.RenderClear ##
 
 .. class:: RenderUpdates
 
-   | :sl:`Group class that tracks dirty updates`
+   | :sl:`Group sub-class that tracks dirty updates.`
    | :sg:`RenderUpdates(*sprites) -> RenderUpdates`
 
    This class is derived from ``pygame.sprite.Group()``. It has an extended
 
 .. function:: OrderedUpdates
 
-   | :sl:`RenderUpdates class that draws Sprites in order of addition`
+   | :sl:`RenderUpdates sub-class that draws Sprites in order of addition.`
    | :sg:`OrderedUpdates(*spites) -> OrderedUpdates`
 
    This class derives from ``pygame.sprite.RenderUpdates()``. It maintains the
 
 .. class:: LayeredUpdates
 
-   | :sl:`LayeredUpdates Group handles layers, that draws like OrderedUpdates.`
+   | :sl:`LayeredUpdates is a sprite group that handles layers and draws like OrderedUpdates.`
    | :sg:`LayeredUpdates(*spites, **kwargs) -> LayeredUpdates`
 
    This group is fully compatible with :class:`pygame.sprite.Sprite`.
 
 .. class:: LayeredDirty
 
-   | :sl:`LayeredDirty Group is for DirtySprites.  Subclasses LayeredUpdates.`
+   | :sl:`LayeredDirty group is for DirtySprite objects.  Subclasses LayeredUpdates.`
    | :sg:`LayeredDirty(*spites, **kwargs) -> LayeredDirty`
 
    This group requires :class:`pygame.sprite.DirtySprite` or any sprite that
 
 .. function:: GroupSingle
 
-   | :sl:`Group container that holds a single Sprite`
+   | :sl:`Group container that holds a single sprite.`
    | :sg:`GroupSingle(sprite=None) -> GroupSingle`
 
    The GroupSingle container only holds a single Sprite. When a new Sprite is
 
 .. function:: spritecollide
 
-   | :sl:`find Sprites in a Group that intersect another Sprite`
+   | :sl:`Find sprites in a group that intersect another sprite.`
    | :sg:`spritecollide(sprite, group, dokill, collided = None) -> Sprite_list`
 
    Return a list containing all Sprites in a Group that intersect with another
        collide_rect, collide_rect_ratio, collide_circle,
        collide_circle_ratio, collide_mask
 
+   Example:
+   
+   .. code-block:: python
+
+    # See if the Sprite block has collided with anything in the Group block_list
+    # The True flag will remove the sprite in block_list
+    blocks_hit_list = pygame.sprite.spritecollide(player, block_list, True)  
+     
+    # Check the list of colliding sprites, and add one to the score for each one
+    for block in blocks_hit_list:
+        score +=1
+       
    .. ## pygame.sprite.spritecollide ##
 
 .. function:: collide_rect
 
-   | :sl:`collision detection between two sprites, using rects.`
+   | :sl:`Collision detection between two sprites, using rects.`
    | :sg:`collide_rect(left, right) -> bool`
 
    Tests for collision between two sprites. Uses the pygame rect colliderect
 
 .. function:: collide_rect_ratio
 
-   | :sl:`collision detection between two sprites, using rects scaled to a ratio.`
+   | :sl:`Collision detection between two sprites, using rects scaled to a ratio.`
    | :sg:`collide_rect_ratio(ratio) -> collided_callable`
 
    A callable class that checks for collisions between two sprites, using a
 
 .. function:: collide_circle
 
-   | :sl:`collision detection between two sprites, using circles.`
+   | :sl:`Collision detection between two sprites, using circles.`
    | :sg:`collide_circle(left, right) -> bool`
 
    Tests for collision between two sprites, by testing to see if two circles
 
 .. function:: collide_circle_ratio
 
-   | :sl:`collision detection between two sprites, using circles scaled to a ratio.`
+   | :sl:`Collision detection between two sprites, using circles scaled to a ratio.`
    | :sg:`collide_circle_ratio(ratio) -> collided_callable`
 
    A callable class that checks for collisions between two sprites, using a
 
 .. function:: collide_mask
 
-   | :sl:`collision detection between two sprites, using masks.`
+   | :sl:`Collision detection between two sprites, using masks.`
    | :sg:`collide_mask(SpriteLeft, SpriteRight) -> point`
 
    Returns first point on the mask where the masks collided, or None if 
 
 .. function:: groupcollide
 
-   | :sl:`find all Sprites that collide between two Groups`
+   | :sl:`Find all sprites that collide between two groups.`
    | :sg:`groupcollide(group1, group2, dokill1, dokill2, collided = None) -> Sprite_dict`
 
    This will find collisions between all the Sprites in two groups.
 
 .. function:: spritecollideany
 
-   | :sl:`simple test if a Sprite intersects anything in a Group`
+   | :sl:`Simple test if a sprite intersects anything in a group.`
    | :sg:`spritecollideany(sprite, group, collided = None) -> Sprite` Collision with the returned sprite.
    | :sg:`spritecollideany(sprite, group, collided = None) -> None` No collision
 

File docs/reST/themes/classic/elements.html

View file
  • Ignore whitespace
 
 
 {%- block relbaritems %}
-    <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>
+{%- set jquerydocscomments_path = '_static/jquery.plugin.docscomments.js' %}
+    <script type="text/javascript" src="{{ pathto(jquerydocscomments_path, 1) }}"></script>
 {% endblock %} 

File docs/reST/themes/classic/static/jquery.plugin.docscomments.js

View file
  • Ignore whitespace
+$(document).ready(function () {
+
+
+	/*
+	- fix comment addition for module level comment.
+	- format dates in a more human readable way.
+	X - show user title for each post.
+	X - order comments by newest first.
+	X - prevent comments from being added multiple times.
+	X - add comment button to reference full url.
+	X - Add 'add comment' button in, even if there are comments.
+	*/
+
+	var _comments = {};
+
+	$.getJSON("docscomments.json", function (data) {
+		//console.log(data);
+
+		// newest comment first.
+		var sortComments = function (a,b) {
+		    var x = a.datetimeon;
+		    var y = b.datetimeon;
+		    return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+		}
+
+		for(var i=0; i < data.length; i+=1) {
+			var link = data[i]['link']
+			if(typeof _comments[link] === "undefined") {
+				_comments[link] = [];
+			}
+			_comments[link].push(data[i]);
+			_comments[link].sort(sortComments);
+		}
+
+
+		var getComments = function (link) {
+			return _comments[link];
+		};
+
+
+		var addCommentHtml = [
+			'<form action="http://www.pygame.org/docs/ref/comment_new.php" class="addcomment"><input type="hidden" value="',
+			'" name="link"><input type="submit" value="Add a Comment"></form>'
+		];
+		var showCommentHtml = [
+			'<a href="#comment_',
+			'" title="show comments" class="commentButton">Comments ',
+			'</a><article id="comment_',
+			'" class="hidden commentsArticle"></article>'
+		];
+		var commentPartHtml = [
+			'<section class="commentPart"><header class="commentHeading">', 
+			'</header>',
+			'<pre class="commentContent">', 
+			'</pre></section>'
+		]
+
+		$('dt.title').each(function (idx, el) {
+			var link = $(el).attr('id');
+			if (typeof link === "undefined") {
+				return;
+			}
+
+			// Add "search internet for source code" buttons.
+			//var searchButton = $(searchButtonHtml[0] + link + searchButtonHtml[1] + link + searchButtonHtml[2]);
+			//$(el).next().append(searchButton);
+
+			// Add show comments buttons.
+			var comments = getComments(link);
+
+			var addCommentButton = $(addCommentHtml[0] + link + addCommentHtml[1]);
+			$(el).next().append(addCommentButton);
+
+			if(typeof comments === "undefined") {
+			} else {
+				// show comment button.
+				//console.log(link)
+				var $showCommentButton = $([showCommentHtml[0], 
+							  link.replace(/\./g, "_"), 
+							showCommentHtml[1],
+							comments.length,
+							showCommentHtml[2],
+							  link.replace(/\./g, "_"), 
+							showCommentHtml[3]
+							  ].join(""));
+				$(el).next().append($showCommentButton);
+
+				$showCommentButton.click(function () {
+					//console.log('asdf')
+					var $commentSection = $("#comment_" + link.replace(/\./g, "_"));
+					if (!$commentSection.hasClass('hidden')) {
+						// we have already loaded the comments for this part.
+						return;
+					}
+					$commentSection.removeClass("hidden");
+					$.each(comments, function(idx) {
+						console.log(comments[idx])
+						// date + user
+						var userName = comments[idx]['user_title'];
+						if (userName == null) {
+							userName = 'Anonymous';
+						}
+						var commentHeading = comments[idx]['datetimeon'] + " - " + userName;
+						var commentContent= comments[idx]['content'];
+
+						var $commentPart = $([commentPartHtml[0], 
+							  commentHeading, 
+							commentPartHtml[1],
+							commentPartHtml[2],
+							commentContent,
+							commentPartHtml[3]].join("\n"));
+						$commentSection.append($commentPart);
+					});
+					
+				})
+			}
+		});
+	});
+
+
+    var searchButtonHtml = [
+        '<form action="http://nullege.com/codes/search" class="addcomment"><input type="hidden" value="', 
+        '" name="cq"><input type="submit" value="Search examples for ',
+        '"></form>'
+    ];
+
+    // Add "search internet for source code" buttons.
+    $('dt.title').each(function (idx, el) {
+        var link = $(el).attr('id');
+        if (typeof link === "undefined") {
+            return;
+        }
+        var searchButton = $(searchButtonHtml[0] + link + searchButtonHtml[1] + link + searchButtonHtml[2]);
+        $(el).next().append(searchButton);
+    });
+});

File docs/reST/themes/classic/static/pygame.css_t

View file
  • Ignore whitespace
 div.documentwrapper {
     float: left;
     width: 100%;
-    padding: 0.5em;
 }
 
 div.bodywrapper {
 }
 
 div.body {
+    padding: 0.5em;
 }
 
 div.heading {
 }
 
 pre {
-    font-family: monospace;
-    padding: 5px;
-    padding-left: 15px;
-    margin-bottom: 1em;
-    background-color: {{ theme_codebgcolor }};
-    color: {{ theme_codetextcolor }};
-    line-height: 120%;
+    background-color: #eeffcc;
     border: 1px solid #ac9;
     border-left: none;
     border-right: none;
+    color: #333333;
+    display: inline-block;
+    font-family: monospace;
+    line-height: 120%;
+    margin-bottom: 1em;
+    padding: 5px;
+    padding-left: 15px;
 }
 
 .warning tt {

File docs/ref/jquery.plugin.docscomments.js

  • Ignore whitespace
-$(document).ready(function () {
-
-
-	/*
-	- fix comment addition for module level comment.
-	- format dates in a more human readable way.
-	X - show user title for each post.
-	X - order comments by newest first.
-	X - prevent comments from being added multiple times.
-	X - add comment button to reference full url.
-	X - Add 'add comment' button in, even if there are comments.
-	*/
-
-	var _comments = {};
-
-	$.getJSON("docscomments.json", function (data) {
-		//console.log(data);
-
-		// newest comment first.
-		var sortComments = function (a,b) {
-		    var x = a.datetimeon;
-		    var y = b.datetimeon;
-		    return ((x < y) ? 1 : ((x > y) ? -1 : 0));
-		}
-
-		for(var i=0; i < data.length; i+=1) {
-			var link = data[i]['link']
-			if(typeof _comments[link] === "undefined") {
-				_comments[link] = [];
-			}
-			_comments[link].push(data[i]);
-			_comments[link].sort(sortComments);
-		}
-
-
-		var getComments = function (link) {
-			return _comments[link];
-		};
-
-		var searchButtonHtml = [
-			'<form action="http://nullege.com/codes/search" class="addcomment"><input type="hidden" value="', 
-			'" name="cq"><input type="submit" value="Search examples for ',
-			'"></form>'
-		];
-
-		var addCommentHtml = [
-			'<form action="http://www.pygame.org/docs/ref/comment_new.php" class="addcomment"><input type="hidden" value="',
-			'" name="link"><input type="submit" value="Add a Comment"></form>'
-		];
-		var showCommentHtml = [
-			'<a href="#comment_',
-			'" title="show comments" class="commentButton">Comments ',
-			'</a><article id="comment_',
-			'" class="hidden commentsArticle"></article>'
-		];
-		var commentPartHtml = [
-			'<section class="commentPart"><header class="commentHeading">', 
-			'</header>',
-			'<pre class="commentContent">', 
-			'</pre></section>'
-		]
-
-		$('dt.title').each(function (idx, el) {
-			var link = $(el).attr('id');
-			if (typeof link === "undefined") {
-				return;
-			}
-
-			// Add "search internet for source code" buttons.
-			var searchButton = $(searchButtonHtml[0] + link + searchButtonHtml[1] + link + searchButtonHtml[2]);
-			$(el).next().append(searchButton);
-
-			// Add show comments buttons.
-			var comments = getComments(link);
-
-			var addCommentButton = $(addCommentHtml[0] + link + addCommentHtml[1]);
-			$(el).next().append(addCommentButton);
-
-			if(typeof comments === "undefined") {
-			} else {
-				// show comment button.
-				//console.log(link)
-				var $showCommentButton = $([showCommentHtml[0], 
-							  link.replace(/\./g, "_"), 
-							showCommentHtml[1],
-							comments.length,
-							showCommentHtml[2],
-							  link.replace(/\./g, "_"), 
-							showCommentHtml[3]
-							  ].join(""));
-				$(el).next().append($showCommentButton);
-
-				$showCommentButton.click(function () {
-					//console.log('asdf')
-					var $commentSection = $("#comment_" + link.replace(/\./g, "_"));
-					if (!$commentSection.hasClass('hidden')) {
-						// we have already loaded the comments for this part.
-						return;
-					}
-					$commentSection.removeClass("hidden");
-					$.each(comments, function(idx) {
-						console.log(comments[idx])
-						// date + user
-						var userName = comments[idx]['user_title'];
-						if (userName == null) {
-							userName = 'Anonymous';
-						}
-						var commentHeading = comments[idx]['datetimeon'] + " - " + userName;
-						var commentContent= comments[idx]['content'];
-
-						var $commentPart = $([commentPartHtml[0], 
-							  commentHeading, 
-							commentPartHtml[1],
-							commentPartHtml[2],
-							commentContent,
-							commentPartHtml[3]].join("\n"));
-						$commentSection.append($commentPart);
-					});
-					
-				})
-			}
-		});
-
-
-
-	});
-
-
-
-
-});

File src/doc/display_doc.h

View file
  • Ignore whitespace
 /* Auto generated file: with makeref.py .  Docs go in src/ *.doc . */
 #define DOC_PYGAMEDISPLAY "pygame module to control the display window and screen"
 
-#define DOC_PYGAMEDISPLAYINIT "init() -> None\ninitialize the display module"
+#define DOC_PYGAMEDISPLAYINIT "init() -> None\nInitialize the display module"
 
-#define DOC_PYGAMEDISPLAYQUIT "quit() -> None\nuninitialize the display module"
+#define DOC_PYGAMEDISPLAYQUIT "quit() -> None\nUninitialize the display module"
 
-#define DOC_PYGAMEDISPLAYGETINIT "get_init() -> bool\ntrue if the display module is initialized"
+#define DOC_PYGAMEDISPLAYGETINIT "get_init() -> bool\nReturns True if the display module has been initialized"
 
-#define DOC_PYGAMEDISPLAYSETMODE "set_mode(resolution=(0,0), flags=0, depth=0) -> Surface\ninitialize a window or screen for display"
+#define DOC_PYGAMEDISPLAYSETMODE "set_mode(resolution=(0,0), flags=0, depth=0) -> Surface\nInitialize a window or screen for display"
 
-#define DOC_PYGAMEDISPLAYGETSURFACE "get_surface() -> Surface\nget a reference to the currently set display surface"
+#define DOC_PYGAMEDISPLAYGETSURFACE "get_surface() -> Surface\nGet a reference to the currently set display surface"
 
-#define DOC_PYGAMEDISPLAYFLIP "flip() -> None\nupdate the full display Surface to the screen"
+#define DOC_PYGAMEDISPLAYFLIP "flip() -> None\nUpdate the full display Surface to the screen"
 
-#define DOC_PYGAMEDISPLAYUPDATE "update(rectangle=None) -> None\nupdate(rectangle_list) -> None\nupdate portions of the screen for software displays"
+#define DOC_PYGAMEDISPLAYUPDATE "update(rectangle=None) -> None\nupdate(rectangle_list) -> None\nUpdate portions of the screen for software displays"
 
-#define DOC_PYGAMEDISPLAYGETDRIVER "get_driver() -> name\nget the name of the pygame display backend"
+#define DOC_PYGAMEDISPLAYGETDRIVER "get_driver() -> name\nGet the name of the pygame display backend"
 
 #define DOC_PYGAMEDISPLAYINFO "Info() -> VideoInfo\nCreate a video display information object"
 
 #define DOC_PYGAMEDISPLAYGETWMINFO "get_wm_info() -> dict\nGet information about the current windowing system"
 
-#define DOC_PYGAMEDISPLAYLISTMODES "list_modes(depth=0, flags=pygame.FULLSCREEN) -> list\nget list of available fullscreen modes"
+#define DOC_PYGAMEDISPLAYLISTMODES "list_modes(depth=0, flags=pygame.FULLSCREEN) -> list\nGet list of available fullscreen modes"
 
-#define DOC_PYGAMEDISPLAYMODEOK "mode_ok(size, flags=0, depth=0) -> depth\npick the best color depth for a display mode"
+#define DOC_PYGAMEDISPLAYMODEOK "mode_ok(size, flags=0, depth=0) -> depth\nPick the best color depth for a display mode"
 
-#define DOC_PYGAMEDISPLAYGLGETATTRIBUTE "gl_get_attribute(flag) -> value\nget the value for an opengl flag for the current display"
+#define DOC_PYGAMEDISPLAYGLGETATTRIBUTE "gl_get_attribute(flag) -> value\nGet the value for an OpenGL flag for the current display"
 
-#define DOC_PYGAMEDISPLAYGLSETATTRIBUTE "gl_set_attribute(flag, value) -> None\nrequest an opengl display attribute for the display mode"
+#define DOC_PYGAMEDISPLAYGLSETATTRIBUTE "gl_set_attribute(flag, value) -> None\nRequest an OpenGL display attribute for the display mode"
 
-#define DOC_PYGAMEDISPLAYGETACTIVE "get_active() -> bool\ntrue when the display is active on the display"
+#define DOC_PYGAMEDISPLAYGETACTIVE "get_active() -> bool\nReturns True when the display is active on the display"
 
-#define DOC_PYGAMEDISPLAYICONIFY "iconify() -> bool\niconify the display surface"
+#define DOC_PYGAMEDISPLAYICONIFY "iconify() -> bool\nIconify the display surface"
 
-#define DOC_PYGAMEDISPLAYTOGGLEFULLSCREEN "toggle_fullscreen() -> bool\nswitch between fullscreen and windowed displays"
+#define DOC_PYGAMEDISPLAYTOGGLEFULLSCREEN "toggle_fullscreen() -> bool\nSwitch between fullscreen and windowed displays"
 
-#define DOC_PYGAMEDISPLAYSETGAMMA "set_gamma(red, green=None, blue=None) -> bool\nchange the hardware gamma ramps"
+#define DOC_PYGAMEDISPLAYSETGAMMA "set_gamma(red, green=None, blue=None) -> bool\nChange the hardware gamma ramps"
 
-#define DOC_PYGAMEDISPLAYSETGAMMARAMP "set_gamma_ramp(red, green, blue) -> bool\nchange the hardware gamma ramps with a custom lookup"
+#define DOC_PYGAMEDISPLAYSETGAMMARAMP "set_gamma_ramp(red, green, blue) -> bool\nChange the hardware gamma ramps with a custom lookup"
 
-#define DOC_PYGAMEDISPLAYSETICON "set_icon(Surface) -> None\nchange the system image for the display window"
+#define DOC_PYGAMEDISPLAYSETICON "set_icon(Surface) -> None\nChange the system image for the display window"
 
-#define DOC_PYGAMEDISPLAYSETCAPTION "set_caption(title, icontitle=None) -> None\nset the current window caption"
+#define DOC_PYGAMEDISPLAYSETCAPTION "set_caption(title, icontitle=None) -> None\nSet the current window caption"
 
-#define DOC_PYGAMEDISPLAYGETCAPTION "get_caption() -> (title, icontitle)\nget the current window caption"
+#define DOC_PYGAMEDISPLAYGETCAPTION "get_caption() -> (title, icontitle)\nGet the current window caption"
 
-#define DOC_PYGAMEDISPLAYSETPALETTE "set_palette(palette=None) -> None\nset the display color palette for indexed displays"
+#define DOC_PYGAMEDISPLAYSETPALETTE "set_palette(palette=None) -> None\nSet the display color palette for indexed displays"
 
 
 
 
 pygame.display.init
  init() -> None
-initialize the display module
+Initialize the display module
 
 pygame.display.quit
  quit() -> None
-uninitialize the display module
+Uninitialize the display module
 
 pygame.display.get_init
  get_init() -> bool
-true if the display module is initialized
+Returns True if the display module has been initialized
 
 pygame.display.set_mode
  set_mode(resolution=(0,0), flags=0, depth=0) -> Surface
-initialize a window or screen for display
+Initialize a window or screen for display
 
 pygame.display.get_surface
  get_surface() -> Surface
-get a reference to the currently set display surface
+Get a reference to the currently set display surface
 
 pygame.display.flip
  flip() -> None
-update the full display Surface to the screen
+Update the full display Surface to the screen
 
 pygame.display.update
  update(rectangle=None) -> None
  update(rectangle_list) -> None
-update portions of the screen for software displays
+Update portions of the screen for software displays
 
 pygame.display.get_driver
  get_driver() -> name
-get the name of the pygame display backend
+Get the name of the pygame display backend
 
 pygame.display.Info
  Info() -> VideoInfo
 
 pygame.display.list_modes
  list_modes(depth=0, flags=pygame.FULLSCREEN) -> list
-get list of available fullscreen modes
+Get list of available fullscreen modes
 
 pygame.display.mode_ok
  mode_ok(size, flags=0, depth=0) -> depth
-pick the best color depth for a display mode
+Pick the best color depth for a display mode
 
 pygame.display.gl_get_attribute
  gl_get_attribute(flag) -> value
-get the value for an opengl flag for the current display
+Get the value for an OpenGL flag for the current display
 
 pygame.display.gl_set_attribute
  gl_set_attribute(flag, value) -> None
-request an opengl display attribute for the display mode
+Request an OpenGL display attribute for the display mode
 
 pygame.display.get_active
  get_active() -> bool
-true when the display is active on the display
+Returns True when the display is active on the display
 
 pygame.display.iconify
  iconify() -> bool
-iconify the display surface
+Iconify the display surface
 
 pygame.display.toggle_fullscreen
  toggle_fullscreen() -> bool
-switch between fullscreen and windowed displays
+Switch between fullscreen and windowed displays
 
 pygame.display.set_gamma
  set_gamma(red, green=None, blue=None) -> bool
-change the hardware gamma ramps
+Change the hardware gamma ramps
 
 pygame.display.set_gamma_ramp
  set_gamma_ramp(red, green, blue) -> bool
-change the hardware gamma ramps with a custom lookup
+Change the hardware gamma ramps with a custom lookup
 
 pygame.display.set_icon
  set_icon(Surface) -> None
-change the system image for the display window
+Change the system image for the display window
 
 pygame.display.set_caption
  set_caption(title, icontitle=None) -> None
-set the current window caption
+Set the current window caption
 
 pygame.display.get_caption
  get_caption() -> (title, icontitle)
-get the current window caption
+Get the current window caption
 
 pygame.display.set_palette
  set_palette(palette=None) -> None
-set the display color palette for indexed displays
+Set the display color palette for indexed displays
 
 */

File src/doc/joystick_doc.h

View file
  • Ignore whitespace
 /* Auto generated file: with makeref.py .  Docs go in src/ *.doc . */
-#define DOC_PYGAMEJOYSTICK "pygame module for interacting with joystick devices"
+#define DOC_PYGAMEJOYSTICK "Pygame module for interacting with joysticks, gamepads, and trackballs."
 
-#define DOC_PYGAMEJOYSTICKINIT "init() -> None\ninitialize the joystick module"
+#define DOC_PYGAMEJOYSTICKINIT "init() -> None\nInitialize the joystick module."
 
-#define DOC_PYGAMEJOYSTICKQUIT "quit() -> None\nuninitialize the joystick module"
+#define DOC_PYGAMEJOYSTICKQUIT "quit() -> None\nUninitialize the joystick module."
 
-#define DOC_PYGAMEJOYSTICKGETINIT "get_init() -> bool\ntrue if the joystick module is initialized"
+#define DOC_PYGAMEJOYSTICKGETINIT "get_init() -> bool\nReturns True if the joystick module is initialized."
 
-#define DOC_PYGAMEJOYSTICKGETCOUNT "get_count() -> count\nnumber of joysticks on the system"
+#define DOC_PYGAMEJOYSTICKGETCOUNT "get_count() -> count\nReturns the number of joysticks."
 
-#define DOC_PYGAMEJOYSTICKJOYSTICK "Joystick(id) -> Joystick\ncreate a new Joystick object"
+#define DOC_PYGAMEJOYSTICKJOYSTICK "Joystick(id) -> Joystick\nCreate a new Joystick object."
 
 #define DOC_JOYSTICKINIT "init() -> None\ninitialize the Joystick"
 
 /*
 
 pygame.joystick
-pygame module for interacting with joystick devices
+Pygame module for interacting with joysticks, gamepads, and trackballs.
 
 pygame.joystick.init
  init() -> None
-initialize the joystick module
+Initialize the joystick module.
 
 pygame.joystick.quit
  quit() -> None
-uninitialize the joystick module
+Uninitialize the joystick module.
 
 pygame.joystick.get_init
  get_init() -> bool
-true if the joystick module is initialized
+Returns True if the joystick module is initialized.
 
 pygame.joystick.get_count
  get_count() -> count
-number of joysticks on the system
+Returns the number of joysticks.
 
 pygame.joystick.Joystick
  Joystick(id) -> Joystick
-create a new Joystick object
+Create a new Joystick object.
 
 pygame.joystick.Joystick.init
  init() -> None

File src/doc/sprite_doc.h

View file
  • Ignore whitespace
 /* Auto generated file: with makeref.py .  Docs go in src/ *.doc . */
 #define DOC_PYGAMESPRITE "pygame module with basic game object classes"
 
-#define DOC_PYGAMESPRITESPRITE "Sprite(*groups) -> Sprite\nsimple base class for visible game objects"
+#define DOC_PYGAMESPRITESPRITE "Sprite(*groups) -> Sprite\nSimple base class for visible game objects."
 
 #define DOC_SPRITEUPDATE "update(*args) -> None\nmethod to control sprite behavior"
 
 
 #define DOC_SPRITEGROUPS "groups() -> group_list\nlist of Groups that contain this Sprite"
 
-#define DOC_PYGAMESPRITEDIRTYSPRITE "DirtySprite(*groups) -> DirtySprite\na more featureful subclass of Sprite with more attributes"
+#define DOC_PYGAMESPRITEDIRTYSPRITE "DirtySprite(*groups) -> DirtySprite\nA subclass of Sprite with more attributes and features."
 
-#define DOC_PYGAMESPRITEGROUP "Group(*sprites) -> Group\ncontainer class for many Sprites"
+#define DOC_PYGAMESPRITEGROUP "Group(*sprites) -> Group\nA container class to hold and manage multiple Sprite objects."
 
 #define DOC_GROUPSPRITES "sprites() -> sprite_list\nlist of the Sprites this Group contains"
 
 
 #define DOC_GROUPEMPTY "empty() -> None\nremove all Sprites"
 
-#define DOC_PYGAMESPRITERENDERPLAIN ""
+#define DOC_PYGAMESPRITERENDERPLAIN "Same as pygame.sprite.Group"
 
-#define DOC_PYGAMESPRITERENDERCLEAR ""
+#define DOC_PYGAMESPRITERENDERCLEAR "Same as pygame.sprite.Group"
 
-#define DOC_PYGAMESPRITERENDERUPDATES "RenderUpdates(*sprites) -> RenderUpdates\nGroup class that tracks dirty updates"
+#define DOC_PYGAMESPRITERENDERUPDATES "RenderUpdates(*sprites) -> RenderUpdates\nGroup sub-class that tracks dirty updates."
 
 #define DOC_RENDERUPDATESDRAW "draw(surface) -> Rect_list\nblit the Sprite images and track changed areas"
 
-#define DOC_PYGAMESPRITEORDEREDUPDATES "OrderedUpdates(*spites) -> OrderedUpdates\nRenderUpdates class that draws Sprites in order of addition"
+#define DOC_PYGAMESPRITEORDEREDUPDATES "OrderedUpdates(*spites) -> OrderedUpdates\nRenderUpdates sub-class that draws Sprites in order of addition."
 
-#define DOC_PYGAMESPRITELAYEREDUPDATES "LayeredUpdates(*spites, **kwargs) -> LayeredUpdates\nLayeredUpdates Group handles layers, that draws like OrderedUpdates."
+#define DOC_PYGAMESPRITELAYEREDUPDATES "LayeredUpdates(*spites, **kwargs) -> LayeredUpdates\nLayeredUpdates is a sprite group that handles layers and draws like OrderedUpdates."
 
 #define DOC_LAYEREDUPDATESADD "add(*sprites, **kwargs) -> None\nadd a sprite or sequence of sprites to a group"
 
 
 #define DOC_LAYEREDUPDATESSWITCHLAYER "switch_layer(layer1_nr, layer2_nr) -> None\nswitches the sprites from layer1 to layer2"
 
-#define DOC_PYGAMESPRITELAYEREDDIRTY "LayeredDirty(*spites, **kwargs) -> LayeredDirty\nLayeredDirty Group is for DirtySprites.  Subclasses LayeredUpdates."
+#define DOC_PYGAMESPRITELAYEREDDIRTY "LayeredDirty(*spites, **kwargs) -> LayeredDirty\nLayeredDirty group is for DirtySprite objects.  Subclasses LayeredUpdates."
 
 #define DOC_LAYEREDDIRTYDRAW "draw(surface, bgd=None) -> Rect_list\ndraw all sprites in the right order onto the passed surface."
 
 
 #define DOC_LAYEREDDIRTYSETTIMINGTRESHOLD "set_timing_treshold(time_ms) -> None\nsets the treshold in milliseconds"
 
-#define DOC_PYGAMESPRITEGROUPSINGLE "GroupSingle(sprite=None) -> GroupSingle\nGroup container that holds a single Sprite"
+#define DOC_PYGAMESPRITEGROUPSINGLE "GroupSingle(sprite=None) -> GroupSingle\nGroup container that holds a single sprite."
 
-#define DOC_PYGAMESPRITESPRITECOLLIDE "spritecollide(sprite, group, dokill, collided = None) -> Sprite_list\nfind Sprites in a Group that intersect another Sprite"
+#define DOC_PYGAMESPRITESPRITECOLLIDE "spritecollide(sprite, group, dokill, collided = None) -> Sprite_list\nFind sprites in a group that intersect another sprite."
 
-#define DOC_PYGAMESPRITECOLLIDERECT "collide_rect(left, right) -> bool\ncollision detection between two sprites, using rects."
+#define DOC_PYGAMESPRITECOLLIDERECT "collide_rect(left, right) -> bool\nCollision detection between two sprites, using rects."
 
-#define DOC_PYGAMESPRITECOLLIDERECTRATIO "collide_rect_ratio(ratio) -> collided_callable\ncollision detection between two sprites, using rects scaled to a ratio."
+#define DOC_PYGAMESPRITECOLLIDERECTRATIO "collide_rect_ratio(ratio) -> collided_callable\nCollision detection between two sprites, using rects scaled to a ratio."
 
-#define DOC_PYGAMESPRITECOLLIDECIRCLE "collide_circle(left, right) -> bool\ncollision detection between two sprites, using circles."
+#define DOC_PYGAMESPRITECOLLIDECIRCLE "collide_circle(left, right) -> bool\nCollision detection between two sprites, using circles."
 
-#define DOC_PYGAMESPRITECOLLIDECIRCLERATIO "collide_circle_ratio(ratio) -> collided_callable\ncollision detection between two sprites, using circles scaled to a ratio."
+#define DOC_PYGAMESPRITECOLLIDECIRCLERATIO "collide_circle_ratio(ratio) -> collided_callable\nCollision detection between two sprites, using circles scaled to a ratio."
 
-#define DOC_PYGAMESPRITECOLLIDEMASK "collide_mask(SpriteLeft, SpriteRight) -> point\ncollision detection between two sprites, using masks."
+#define DOC_PYGAMESPRITECOLLIDEMASK "collide_mask(SpriteLeft, SpriteRight) -> point\nCollision detection between two sprites, using masks."
 
-#define DOC_PYGAMESPRITEGROUPCOLLIDE "groupcollide(group1, group2, dokill1, dokill2, collided = None) -> Sprite_dict\nfind all Sprites that collide between two Groups"
+#define DOC_PYGAMESPRITEGROUPCOLLIDE "groupcollide(group1, group2, dokill1, dokill2, collided = None) -> Sprite_dict\nFind all sprites that collide between two groups."
 
-#define DOC_PYGAMESPRITESPRITECOLLIDEANY "spritecollideany(sprite, group, collided = None) -> Sprite\nspritecollideany(sprite, group, collided = None) -> None\nsimple test if a Sprite intersects anything in a Group"
+#define DOC_PYGAMESPRITESPRITECOLLIDEANY "spritecollideany(sprite, group, collided = None) -> Sprite\nspritecollideany(sprite, group, collided = None) -> None\nSimple test if a sprite intersects anything in a group."
 
 
 
 
 pygame.sprite.Sprite
  Sprite(*groups) -> Sprite
-simple base class for visible game objects
+Simple base class for visible game objects.
 
 pygame.sprite.Sprite.update
  update(*args) -> None
 
 pygame.sprite.DirtySprite
  DirtySprite(*groups) -> DirtySprite
-a more featureful subclass of Sprite with more attributes
+A subclass of Sprite with more attributes and features.
 
 pygame.sprite.Group
  Group(*sprites) -> Group
-container class for many Sprites
+A container class to hold and manage multiple Sprite objects.
 
 pygame.sprite.Group.sprites
  sprites() -> sprite_list
 remove all Sprites
 
 pygame.sprite.RenderPlain
-
+Same as pygame.sprite.Group
 
 pygame.sprite.RenderClear
-
+Same as pygame.sprite.Group
 
 pygame.sprite.RenderUpdates
  RenderUpdates(*sprites) -> RenderUpdates
-Group class that tracks dirty updates
+Group sub-class that tracks dirty updates.
 
 pygame.sprite.RenderUpdates.draw
  draw(surface) -> Rect_list
 
 pygame.sprite.OrderedUpdates
  OrderedUpdates(*spites) -> OrderedUpdates
-RenderUpdates class that draws Sprites in order of addition
+RenderUpdates sub-class that draws Sprites in order of addition.
 
 pygame.sprite.LayeredUpdates
  LayeredUpdates(*spites, **kwargs) -> LayeredUpdates
-LayeredUpdates Group handles layers, that draws like OrderedUpdates.
+LayeredUpdates is a sprite group that handles layers and draws like OrderedUpdates.
 
 pygame.sprite.LayeredUpdates.add
  add(*sprites, **kwargs) -> None
 
 pygame.sprite.LayeredDirty
  LayeredDirty(*spites, **kwargs) -> LayeredDirty
-LayeredDirty Group is for DirtySprites.  Subclasses LayeredUpdates.
+LayeredDirty group is for DirtySprite objects.  Subclasses LayeredUpdates.
 
 pygame.sprite.LayeredDirty.draw
  draw(surface, bgd=None) -> Rect_list
 
 pygame.sprite.GroupSingle
  GroupSingle(sprite=None) -> GroupSingle
-Group container that holds a single Sprite
+Group container that holds a single sprite.
 
 pygame.sprite.spritecollide
  spritecollide(sprite, group, dokill, collided = None) -> Sprite_list
-find Sprites in a Group that intersect another Sprite
+Find sprites in a group that intersect another sprite.
 
 pygame.sprite.collide_rect
  collide_rect(left, right) -> bool
-collision detection between two sprites, using rects.
+Collision detection between two sprites, using rects.
 
 pygame.sprite.collide_rect_ratio
  collide_rect_ratio(ratio) -> collided_callable
-collision detection between two sprites, using rects scaled to a ratio.
+Collision detection between two sprites, using rects scaled to a ratio.
 
 pygame.sprite.collide_circle
  collide_circle(left, right) -> bool
-collision detection between two sprites, using circles.
+Collision detection between two sprites, using circles.
 
 pygame.sprite.collide_circle_ratio
  collide_circle_ratio(ratio) -> collided_callable
-collision detection between two sprites, using circles scaled to a ratio.
+Collision detection between two sprites, using circles scaled to a ratio.
 
 pygame.sprite.collide_mask
  collide_mask(SpriteLeft, SpriteRight) -> point
-collision detection between two sprites, using masks.
+Collision detection between two sprites, using masks.
 
 pygame.sprite.groupcollide
  groupcollide(group1, group2, dokill1, dokill2, collided = None) -> Sprite_dict
-find all Sprites that collide between two Groups
+Find all sprites that collide between two groups.
 
 pygame.sprite.spritecollideany
  spritecollideany(sprite, group, collided = None) -> Sprite
  spritecollideany(sprite, group, collided = None) -> None
-simple test if a Sprite intersects anything in a Group
+Simple test if a sprite intersects anything in a group.
 
 */

File src/draw.c

View file
  • Ignore whitespace
 
 MODINIT_DEFINE (draw)
 {
-        PyObject *module;
-
 #if PY3
         static struct PyModuleDef _module = {
             PyModuleDef_HEAD_INIT,
 
 	/* create the module */
 #if PY3
-        module = PyModule_Create (&_module);
+        return PyModule_Create (&_module);
 #else
-	module = Py_InitModule3(MODPREFIX "draw", _draw_methods, DOC_PYGAMEDRAW);
+	Py_InitModule3(MODPREFIX "draw", _draw_methods, DOC_PYGAMEDRAW);
 #endif
-        MODINIT_RETURN (module);
 }
 
 

File src/freetype/ft_layout.c

View file
  • Ignore whitespace
     FontGlyph   *glyph = 0;
     FontGlyph   **glyph_array = 0;
     FontMetrics *metrics;
-    FT_BitmapGlyph image;
     TextContext context;
 
     FT_Face     font;
             --ftext->length;
             continue;
         }
-        image = glyph->image;
         glyph_width = glyph->width;
         glyph_height = glyph->height;
 

File src/mixer.c

View file
  • Ignore whitespace
 {
     int channelnum = PyChannel_AsInt (self);
     float volume, stereovolume=-1.11f;
+#ifdef Py_DEBUG
     int result;
+#endif
     Uint8 left, right;
 
     if (!PyArg_ParseTuple (args, "f|f", &volume, &stereovolume))
         volume = (volume + stereovolume) * 0.5f;
 #endif
 
-    result = Mix_Volume (channelnum, (int)(volume*128));
+#ifdef Py_DEBUG
+    result = 
+#endif
+    Mix_Volume (channelnum, (int)(volume*128));
     Py_RETURN_NONE;
 }
 

File src/pixelarray_methods.c

View file
  • Ignore whitespace
     Py_ssize_t y;
     PyPixelArray *new_array;
     PyObject *new_surface;
-    SDL_Surface *new_surf;
     SDL_PixelFormat *new_format;
     Py_ssize_t stride0;
     Py_ssize_t stride1;
         return 0;
     }
 
-    new_surf = PySurface_AsSurface(new_surface);
     new_format = surf->format;
     stride0 = new_array->stride0;
     stride1 = new_array->stride1;

File src/pixelcopy.c

View file
  • Ignore whitespace
 
 MODINIT_DEFINE(pixelcopy)
 {
-    PyObject *module;
-
 #if PY3
     static struct PyModuleDef _module = {
         PyModuleDef_HEAD_INIT,
     }
 
 #if PY3
-    module = PyModule_Create(&_module);
+    return PyModule_Create(&_module);
 #else
-    module = Py_InitModule3("pixelcopy",
-                            _pixelcopy_methods,
-                            DOC_PYGAMEPIXELCOPY);
+    Py_InitModule3("pixelcopy", _pixelcopy_methods, DOC_PYGAMEPIXELCOPY);
 #endif
-    MODINIT_RETURN(module);
 }

File src/scrap.c

View file
  • Ignore whitespace
 
 MODINIT_DEFINE (scrap)
 {
-    PyObject *module;
-
 #if PY3
     static struct PyModuleDef _module = {
         PyModuleDef_HEAD_INIT,
 
     /* create the module */
 #if PY3
-    module = PyModule_Create (&_module);
+    return PyModule_Create (&_module);
 #else
-    module = Py_InitModule3 (MODPREFIX "scrap", scrap_builtins, NULL);
+    Py_InitModule3 (MODPREFIX "scrap", scrap_builtins, NULL);
 #endif
-
-    MODINIT_RETURN (module);
 }

File src/time.c

View file
  • Ignore whitespace
 MODINIT_DEFINE (time)
 #endif    
 {
-    PyObject *module;
-    
 #if PY3
     static struct PyModuleDef _module = {
         PyModuleDef_HEAD_INIT,
     
     /* create the module */
 #if PY3
-    module = PyModule_Create (&_module);
+    return PyModule_Create (&_module);
 #else
-    module = Py_InitModule3 (MODPREFIX "time", _time_methods, DOC_PYGAMETIME);
+    Py_InitModule3 (MODPREFIX "time", _time_methods, DOC_PYGAMETIME);
 #endif
-    MODINIT_RETURN (module);
 }