Commits

Anonymous committed fb3855c

lots of new stuff and a few breaking changes

Comments (0)

Files changed (35)

 font src/font.c $(SDL) $(FONT)
 image src/image.c $(SDL) $(IMAGE)
 mixer src/mixer.c $(SDL) $(MIXER)
-music src/music.c $(SDL) $(MIXER)
+mixer_music src/music.c $(SDL) $(MIXER)
 
 
 #the following are placeholders. setup.py can use
 This is a list of changes in pygame's history.
 
-     Nov 14, 2000
+
+Nov 15, 2000
+ BREAK:	Moved pygame.music to a member of pygame.mixer
+ BREAK:	Constructor functions capitalized: Rect(), Event(), Surface()
+ BREAK:	Surface.blit takes a source rectangle instead of pos, size
+ BUG:	pygame.display.set_clip() correctly accepts rectstyle arg
+	Added Surface.get_flags() and Surface.get_pitch()
+	Added set_cursor and get_cursor to pygame.mouse
+	New module, pygame.cursors, contains sample cursors
+
+Nov 14, 2000
 	Release the Python Global Interpreter Lock on delays and IO
-	Added timer events to pygame.time (vgrade example demonstrates)
+	Added timer events to pygame.time (check vgrade example)
 	New music playback finished events
-	Documentation reorganized, 1st tutorial added
 	surfarray.blit_array() supports all bit depths
 
-     Nov 11, 2000
-	BUG: pygame.display.set_mode() uses int, not short, for size
+Nov 11, 2000
+ BUG:	pygame.display.set_mode() uses int, not short, for size
 
-     Nov 10, 2000
-	Committed to CVS and documentation expanded
+Nov 10, 2000
+	Committed to CVS
 	Added pygame.display.get_driver()
 
-0.2: Nov 3, 2000
-	Documentation takes a step forward
-	Sound, mixer and music, now working   (and added to aliens)
-	Addition of get_width, get_height, and get_rect to Surfaces
 
-0.1: Oct 28, 2000
-	PyGame First Release
+
+ BREAK:	change breaks existing code
+ BUG:	fixed a bug that was crashing
 || <a href=ref/pygame_joystick.html>joystick</a> || 
 <a href=ref/pygame_key.html>key</a> || 
 <a href=ref/pygame_mixer.html>mixer</a> || 
+<a href=ref/pygame_mixer_music.html>mixer_music</a> || 
 <a href=ref/pygame_mouse.html>mouse</a> || 
 <a href=ref/pygame_music.html>music</a> || 
-<a href=ref/pygame_surfarray.html>surfarray</a> || 
-<a href=ref/pygame_time.html>time</a> ||<br>
+<a href=ref/pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=ref/pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>
 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Channel.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Font.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Joystick.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Rect.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Sound.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/Surface.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_cdrom.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_constants.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_display.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_event.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_font.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_image.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_joystick.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_key.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_mixer.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_mouse.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_music.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>
 <br>
 <h2 align=center>pygame.music</h2>
-The music module is tied closely to the pygame.mixer module. It
-is an optional module since it depends on the SDL_mixer library.
-<br>&nbsp;<br>
-The difference between playback of music and playback of sounds
-is that the music object is not loaded and decoded all at once,
-instead the music data is streamed and decoded during playback.
-There can only be one music file loaded at a single time. Loading
-a new music file will replace any currently loaded music.
-<br>&nbsp;<br>
-The music module has many of the same types of functions as the
-Sound objects. The main difference is only one music object can
-be loaded at a time, with the pygame.music.load() function. Music
-must be stored in an individual file on the system, it cannot be
-loaded from special file-like objects through python.
+{module}
 
 <hr>
 
 <table>
-<tr><td><a href=#fadeout>fadeout</a></td><td> -
-fadeout current music</td></tr>
-
-
-<tr><td><a href=#get_busy>get_busy</a></td><td> -
-query state of the music</td></tr>
-
-
-<tr><td><a href=#get_endevent>get_endevent</a></td><td> -
-query the current music finished event</td></tr>
-
-
-<tr><td><a href=#get_init>get_init</a></td><td> -
-query the music module</td></tr>
-
-
-<tr><td><a href=#get_volume>get_volume</a></td><td> -
-query music volume</td></tr>
-
-
-<tr><td><a href=#init>init</a></td><td> -
-initialize the music module</td></tr>
-
-
-<tr><td><a href=#load>load</a></td><td> -
-load current music</td></tr>
-
-
-<tr><td><a href=#pause>pause</a></td><td> -
-pause the playing music</td></tr>
-
-
 <tr><td><a href=#play>play</a></td><td> -
 play the current loaded music</td></tr>
 
 
-<tr><td><a href=#quit>quit</a></td><td> -
-uninitialize music module</td></tr>
-
-
-<tr><td><a href=#rewind>rewind</a></td><td> -
-restarts music</td></tr>
-
-
-<tr><td><a href=#set_endevent>set_endevent</a></td><td> -
-sets music finished event</td></tr>
-
-
-<tr><td><a href=#set_volume>set_volume</a></td><td> -
-set music volume</td></tr>
-
-
-<tr><td><a href=#stop>stop</a></td><td> -
-stop the playing music</td></tr>
-
-
-<tr><td><a href=#unpause>unpause</a></td><td> -
-restarts the paused music</td></tr>
-
-
 </table>
 
 <hr>
 
-<a name=fadeout><font size=+2><b>fadeout
-</b></font><br><font size=+1><tt>
-pygame.music.fadeout(millisec) -> None
-</tt></font><ul>
-Fades out the current playing music and stops it over the given
-milliseconds.
-</ul><br>&nbsp;<br>
-
-<a name=get_busy><font size=+2><b>get_busy
-</b></font><br><font size=+1><tt>
-pygame.music.get_busy() -> bool
-</tt></font><ul>
-Returns true if music is currently playing
-</ul><br>&nbsp;<br>
-
-<a name=get_endevent><font size=+2><b>get_endevent
-</b></font><br><font size=+1><tt>
-pygame.music.get_endevent([eventid]) -> int
-</tt></font><ul>
-When the music has finished playing, you can optionally have
-pygame place a user defined message on the event queue. If there
-is no callback event set, NOEVENT will be returned. Otherwise it
-will return the id of the current music finishe event.
-</ul><br>&nbsp;<br>
-
-<a name=get_init><font size=+2><b>get_init
-</b></font><br><font size=+1><tt>
-pygame.music.get_init() -> bool
-</tt></font><ul>
-Returns true if the music module is initialized.
-</ul><br>&nbsp;<br>
-
-<a name=get_volume><font size=+2><b>get_volume
-</b></font><br><font size=+1><tt>
-pygame.music.get_volume() -> val
-</tt></font><ul>
-Get the current volume for the music. Value is
-between 0.0 and 1.0.
-</ul><br>&nbsp;<br>
-
-<a name=init><font size=+2><b>init
-</b></font><br><font size=+1><tt>
-pygame.music.init([freq, [size, [stereo]]]) -> None
-</tt></font><ul>
-Initializes the music module. Since the music requires use of the
-mixer, the mixer module will also be initialized with this call.
-See the mixer init function for more details on the arguments.
-Don't be fooled though, just because the mixer module is
-initialized, does not mean the music is initialized.
-</ul><br>&nbsp;<br>
-
-<a name=load><font size=+2><b>load
-</b></font><br><font size=+1><tt>
-pygame.music.load(filename) -> None
-</tt></font><ul>
-Load a music object as the current music. The music only handles
-one music as the current. If music is currently playing, it will
-be stopped and replaced with the given one. Loading music only
-supports filenames, not file-like objects.
-</ul><br>&nbsp;<br>
-
-<a name=pause><font size=+2><b>pause
-</b></font><br><font size=+1><tt>
-pygame.music.pause() -> None
-</tt></font><ul>
-Temporarily stops the current music.
-</ul><br>&nbsp;<br>
-
 <a name=play><font size=+2><b>play
 </b></font><br><font size=+1><tt>
 pygame.music.play([loops]) -> None
 defaults to 0.
 </ul><br>&nbsp;<br>
 
-<a name=quit><font size=+2><b>quit
-</b></font><br><font size=+1><tt>
-pygame.music.quit() -> None
-</tt></font><ul>
-Stops playback of any music and uninitializes the module.
-</ul><br>&nbsp;<br>
-
-<a name=rewind><font size=+2><b>rewind
-</b></font><br><font size=+1><tt>
-pygame.music.rewind() -> None
-</tt></font><ul>
-Restarts playback of the current music.
-</ul><br>&nbsp;<br>
-
-<a name=set_endevent><font size=+2><b>set_endevent
-</b></font><br><font size=+1><tt>
-pygame.music.set_endevent([eventid]) -> None
-</tt></font><ul>
-When the music has finished playing, you can optionally have
-pygame place a user defined message on the event queue. If the
-eventid field is omittied or NOEVENT, no messages will be sent
-when the music finishes playing. Once the endevent is set, it
-will be called every time the music finished playing.
-</ul><br>&nbsp;<br>
-
-<a name=set_volume><font size=+2><b>set_volume
-</b></font><br><font size=+1><tt>
-pygame.music.set_volume(val) -> None
-</tt></font><ul>
-Sets the current volume for the music. Value is
-between 0.0 and 1.0.
-</ul><br>&nbsp;<br>
-
-<a name=stop><font size=+2><b>stop
-</b></font><br><font size=+1><tt>
-pygame.music.stop() -> None
-</tt></font><ul>
-Stops playback of the current music.
-</ul><br>&nbsp;<br>
-
-<a name=unpause><font size=+2><b>unpause
-</b></font><br><font size=+1><tt>
-pygame.music.unpause() -> None
-</tt></font><ul>
-Restarts playback of the current music object when paused.
-</ul><br>&nbsp;<br>
-
 
 <hr>
 

docs/ref/pygame_surfarray.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/ref/pygame_time.html

 || <a href=pygame_joystick.html>joystick</a> || 
 <a href=pygame_key.html>key</a> || 
 <a href=pygame_mixer.html>mixer</a> || 
+<a href=pygame_mixer_music.html>mixer_music</a> || 
 <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_music.html>music</a> || 
-<a href=pygame_surfarray.html>surfarray</a> || 
-<a href=pygame_time.html>time</a> ||<br>
+<a href=pygame_surfarray.html>surfarray</a> ||<br>
+|| <a href=pygame_time.html>time</a> ||<br>
 
 
 </td></tr></table>

docs/util/makedocs.py

     global MODULETOC
     pathed_toc = create_toc(alldocs[2], 'ref/')
     MODULETOC = create_toc(alldocs[2])
-    print MODULETOC
 
 
     #categorize

examples/aliens.py

 from pygame.locals import *
 try:
     import pygame.mixer
-    import pygame.music
     pygame.mixer.pre_init(11025)
 except ImportError:
     print 'Warning, sound not initialized'
-    pygame.mixer = pygame.music = None
+    pygame.mixer = None
 
 #see if we can get some font lovin'
 try: import pygame.font as font
     "An enhanced sort of sprite class"
     def __init__(self, image):
         self.image = image
-        self.rect = rect((0, 0), image.get_size())
+        self.rect = image.get_rect()
         self.clearrect = self.rect
         
     def update(self):
         
     def erase(self, screen, background):
         "gets the sprite off of the screen"
-        pos = self.rect.topleft
-        r = screen.blit(background, pos, pos, self.rect.size)
+        r = screen.blit(background, self.rect.topleft, self.rect)
         self.clearrect = r
 
 
 
     # Create the background
     background = pygame.surface(SCREENRECT.size)
-    for x in range(0, SCREENRECT.width, Img.background.get_size()[0]):
+    for x in range(0, SCREENRECT.width, Img.background.get_width()):
         background.blit(Img.background, (x, 0))
     screen.blit(background, (0,0))
     pygame.display.flip()
     kills = 0
 
     # Soundtrack
-    if pygame.music:
+    if pygame.mixer:
         music = os.path.join('data', 'house_lo.wav')
-        pygame.music.load(music)
-        pygame.music.play(-1)
+        pygame.mixer.music.load(music)
+        pygame.mixer.music.play(-1)
 
     # Main loop
     while player.alive or explosions:
         pygame.display.update(dirtyrects)
         dirtyrects = []
 
-    if pygame.music:
-        pygame.music.fadeout(1200)
+    if pygame.mixer:
+        pygame.mixer.music.fadeout(1200)
 
     #attempt to show game over (if font installed)
     if font:
         pygame.display.flip()
 
     #wait a beat
-    if pygame.music:
-        while pygame.music.get_busy():
+    if pygame.mixer:
+        while pygame.mixer.music.get_busy():
             pygame.time.delay(200)
     else:
         pygame.time.delay(800)

examples/fonty.py

 
 
 import pygame, pygame.font, os.path
+import pygame.cursors
 from pygame.locals import *
 
 
     #initialize
     pygame.init()
     screen = pygame.display.set_mode((400, 200))
+    pygame.mouse.set_cursor(*pygame.cursors.diamond)
 
     #fill background
     screen.fill(screen.map_rgb((40, 40, 90)))

examples/oldalien.py

     "An enhanced sort of sprite class"
     def __init__(self, image):
         self.image = image
-        self.rect = rect((0, 0), image.get_size())
+        self.rect = image.get_rect()
         
     def update(self):
         "update the sprite state for this frame"
         
     def erase(self, screen, background):
         "gets the sprite off of the screen"
-        pos = self.rect.topleft
-        r = screen.blit(background, pos, pos, self.rect.size)
+        r = screen.blit(background, self.rect.topleft, self.rect)
         dirtyrects.append(r)
 
 
 
     # Create the background
     background = pygame.surface(SCREENRECT.size)
-    for x in range(0, SCREENRECT.width, Img.background.get_size()[0]):
+    for x in range(0, SCREENRECT.width, Img.background.get_width()):
         background.blit(Img.background, (x, 0))
     screen.blit(background, (0,0))
     pygame.display.flip()
+##    PyGame - Python Game Library
+##    Copyright (C) 2000  Pete Shinners
+##
+##    This library is free software; you can redistribute it and/or
+##    modify it under the terms of the GNU Library General Public
+##    License as published by the Free Software Foundation; either
+##    version 2 of the License, or (at your option) any later version.
+##
+##    This library is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+##    Library General Public License for more details.
+##
+##    You should have received a copy of the GNU Library General Public
+##    License along with this library; if not, write to the Free
+##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+##    Pete Shinners
+##    pete@shinnerso.org
+
+"""Set of cursor resources available for use. These cursors come
+in a sequence of values that are needed as the arguments for
+pygame.mouse.set_cursor(). to dereference the sequence in place
+and create the cursor in one step, call like this;
+pygame.mouse.set_cursor(*pygame.cursors.arrow)"""
+
+#default pygame black arrow
+arrow = ((16, 16), (0, 0),
+    (0x00,0x00,0x40,0x00,0x60,0x00,0x70,0x00,0x78,0x00,0x7C,0x00,0x7E,0x00,0x7F,0x00,
+     0x7F,0x80,0x7C,0x00,0x6C,0x00,0x46,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00),
+    (0x40,0x00,0xE0,0x00,0xF0,0x00,0xF8,0x00,0xFC,0x00,0xFE,0x00,0xFF,0x00,0xFF,0x80,
+     0xFF,0xC0,0xFF,0x80,0xFE,0x00,0xEF,0x00,0x4F,0x00,0x07,0x80,0x07,0x80,0x03,0x00))
+
+diamond = ((16, 16), (7, 7),
+    (0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0x60, 0x03, 0x30, 0x06, 0x18, 0x0c,
+     0x0c, 0x18, 0x06, 0x30, 0x0c, 0x18, 0x18, 0x0c, 0x30, 0x06, 0x60, 0x03,
+     0xc0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00),
+    (0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0x78, 0x0f, 0x3c, 0x1e,
+     0x1e, 0x3c, 0x0f, 0x78, 0x1e, 0x3c, 0x3c, 0x1e, 0x78, 0x0f, 0xf0, 0x07,
+     0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00))
+
+
+
+
     /*DOC*/    "\n"
     /*DOC*/    "You will only be able to load the types of images supported by\n"
     /*DOC*/    "your build of SDL_image. This will always include GIF, BMP, PPM,\n"
-    /*DOC*/    "PCX, and TIF. SDL_image can also load JPG and PNG, but they are\n"
+    /*DOC*/    "PCX, and TGA. SDL_image can also load JPG, PNG, and TIF, but they are\n"
     /*DOC*/    "optional.\n"
     /*DOC*/ ;
 
     /*DOC*/    "Sound objects, you can access the Channel objects with functions\n"
     /*DOC*/    "like pygame.mixer.get_channel().\n"
     /*DOC*/    "\n"
+    /*DOC*/    "The mixer defaults to supporting 8 simultaneous soundfiles.\n"
+    /*DOC*/    "You can change the number of available sound channels at any\n"
+    /*DOC*/    "time with the set_num_channels() function.\n"
+    /*DOC*/    "\n"
     /*DOC*/    "All loaded Sound objects are resampled to match the same format\n"
     /*DOC*/    "that pygame.mixer is initialized to. The current SDL resampling\n"
     /*DOC*/    "functions are not that good, so it is best if you initialize\n"
     /*DOC*/    "pygame.mixer to the same format as your sound resources. Also\n"
     /*DOC*/    "setting the mixer frequency to even multiples of your sound\n"
     /*DOC*/    "resources will result in a clean conversion.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "The mixer also contains a special channel for music. You can\n"
+    /*DOC*/    "control the music channel through pygame.mixer.music./\n"
     /*DOC*/ ;
 
 void initmixer()
 {
-	PyObject *module, *dict, *apiobj;
+	PyObject *module, *dict, *apiobj, *music;
 	static void* c_api[PYGAMEAPI_MIXER_NUMSLOTS];
 
 	PyType_Init(PySound_Type);
 
 	/*imported needed apis*/
 	import_pygame_base();
+
+	music = PyImport_ImportModule("pygame.mixer_music");
+	if(music) 
+		PyModule_AddObject(module, "music", music);
+	else /*music module not compiled? cleanly ignore*/
+		PyErr_Clear();
 }
 
 
 
 
+    /*DOC*/ static char doc_mouse_set_cursor[] =
+    /*DOC*/    "pygame.mouse.set_cursor(size, hotspot, xormasks, andmasks) -> None\n"
+    /*DOC*/    "state of shape of the mouse cursor\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "When the mouse cursor is visible, it will be displayed\n"
+    /*DOC*/    "as a black and white bitmap using the given bitmask arrays.\n"
+    /*DOC*/    "The size is a sequence containing the cursor with and height.\n"
+    /*DOC*/    "Hotspot is a sequence containing the cursor hotspot position.\n"
+    /*DOC*/    "xormasks is a sequence of bytes containing the cursor xor data\n"
+    /*DOC*/    "masks. Lastly is andmasks, a sequence of bytes containting the\n"
+    /*DOC*/    "cursor bitmask data.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "Width must be a multiple of 8, and the mask arrays must be the\n"
+    /*DOC*/    "correct size for the given width and height. Otherwise an exception.\n"
+    /*DOC*/ ;
+
+static PyObject* mouse_set_cursor(PyObject* self, PyObject* args)
+{
+	int w, h, spotx, spoty;
+	PyObject *xormask, *andmask;
+	Uint8 *xordata=NULL, *anddata=NULL;
+	int xorsize, andsize, loop;
+	short val;
+	SDL_Cursor *lastcursor, *cursor = NULL;
+
+	if(!PyArg_ParseTuple(args, "(ii)(ii)OO", &w, &h, &spotx, &spoty, &xormask, &andmask))
+		return NULL;
+
+	VIDEO_INIT_CHECK();
+
+	if(!PySequence_Check(xormask) || !PySequence_Check(andmask))
+		return RAISE(PyExc_TypeError, "xormask and andmask must be sequences");
+
+	if(w % 8)
+		return RAISE(PyExc_ValueError, "Cursor width must be divisible by 8.");
+
+	xorsize = PySequence_Length(xormask);
+	andsize = PySequence_Length(andmask);
+
+	if(xorsize != w*h/8 || andsize != w*h/8)
+		return RAISE(PyExc_ValueError, "bitmasks must be sized width*height/8");
+
+	xordata = (Uint8*)malloc(xorsize);
+	anddata = (Uint8*)malloc(andsize);
+
+	for(loop = 0; loop < xorsize; ++loop)
+	{
+		if(!ShortFromObjIndex(xormask, loop, &val))
+			goto interror;
+		xordata[loop] = (Uint8)val;
+		if(!ShortFromObjIndex(andmask, loop, &val))
+			goto interror;
+		anddata[loop] = (Uint8)val;
+	}
+
+	cursor = SDL_CreateCursor(xordata, anddata, w, h, spotx, spoty);
+	free(xordata);
+	free(anddata);
+	xordata = NULL;
+	anddata = NULL;
+
+	if(!cursor)
+		return RAISE(PyExc_SDLError, SDL_GetError());
+
+	lastcursor = SDL_GetCursor();
+	SDL_SetCursor(cursor);	
+	SDL_FreeCursor(lastcursor);
+
+	RETURN_NONE;
+
+interror:
+	if(xordata) free(xordata);
+	if(anddata) free(anddata);
+	return RAISE(PyExc_TypeError, "Invalid number in mask array");
+}
+
+
+    /*DOC*/ static char doc_mouse_get_cursor[] =
+    /*DOC*/    "pygame.mouse.get_cursor() -> size, hotspot, xormasks, andmasks\n"
+    /*DOC*/    "get mouse cursor data\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "The mouse cursor data is the same as those passed into set_cursor.\n"
+    /*DOC*/ ;
+
+static PyObject* mouse_get_cursor(PyObject* self, PyObject* args)
+{
+	SDL_Cursor *cursor = NULL;
+	PyObject* xordata, *anddata;
+	int size, loop, w, h, spotx, spoty;
+
+	if(!PyArg_ParseTuple(args, ""))
+		return NULL;
+
+	VIDEO_INIT_CHECK();
+
+	cursor = SDL_GetCursor();
+	if(!cursor)
+		return RAISE(PyExc_SDLError, SDL_GetError());
+
+	w = cursor->area.w;
+	h = cursor->area.h;
+	spotx = cursor->hot_x;
+	spoty = cursor->hot_y;
+
+	size = cursor->area.w * cursor->area.h / 8;
+	xordata = PyTuple_New(size);
+	if(!xordata)
+		return NULL;
+	anddata = PyTuple_New(size);
+	if(!anddata)
+	{
+		Py_DECREF(anddata);
+		return NULL;
+	}
+
+	for(loop = 0; loop < size; ++loop)
+	{
+		PyTuple_SET_ITEM(xordata, loop, PyInt_FromLong(cursor->data[loop]));
+		PyTuple_SET_ITEM(anddata, loop, PyInt_FromLong(cursor->mask[loop]));
+	}
+
+	return Py_BuildValue("((ii)(ii)OO)", w, h, spotx, spoty, xordata, anddata);
+}
+
+
+
+
 static PyMethodDef mouse_builtins[] =
 {
 	{ "set_pos", mouse_set_pos, 1, doc_mouse_set_pos },
 	{ "get_pressed", mouse_get_pressed, 1, doc_mouse_get_pressed },
 	{ "set_visible", mouse_set_visible, 1, doc_mouse_set_visible },
 	{ "get_focused", mouse_get_focused, 1, doc_mouse_get_focused },
+	{ "set_cursor", mouse_set_cursor, 1, doc_mouse_set_cursor },
+	{ "get_cursor", mouse_get_cursor, 1, doc_mouse_get_cursor },
 
 	{ NULL, NULL }
 };
 }
 
 
-static void autoquit()
-{
-	if(SDL_WasInit(SDL_INIT_AUDIO))
-	{
-		if(current_music)
-		{
-			Mix_FreeMusic(current_music);
-			current_music = NULL;
-		}
-	}
-	PyMixer_AutoQuit();
-}
-
-
-static PyObject* autoinit(PyObject* self, PyObject* arg)
-{
-	PyObject* ret = PyMixer_AutoInit(self, arg);
-	if(PyObject_IsTrue(ret))
-		Mix_HookMusicFinished(endmusic_callback);
-	return ret;
-}
-
-
-    /*DOC*/ static char doc_quit[] =
-    /*DOC*/    "pygame.music.quit() -> None\n"
-    /*DOC*/    "uninitialize music module\n"
-    /*DOC*/    "\n"
-    /*DOC*/    "Stops playback of any music and uninitializes the module.\n"
-    /*DOC*/ ;
-
-static PyObject* quit(PyObject* self, PyObject* arg)
-{
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	autoquit();
-
-	RETURN_NONE
-}
-
-
-    /*DOC*/ static char doc_init[] =
-    /*DOC*/    "pygame.music.init([freq, [size, [stereo]]]) -> None\n"
-    /*DOC*/    "initialize the music module\n"
-    /*DOC*/    "\n"
-    /*DOC*/    "Initializes the music module. Since the music requires use of the\n"
-    /*DOC*/    "mixer, the mixer module will also be initialized with this call.\n"
-    /*DOC*/    "See the mixer init function for more details on the arguments.\n"
-    /*DOC*/    "Don't be fooled though, just because the mixer module is\n"
-    /*DOC*/    "initialized, does not mean the music is initialized.\n"
-    /*DOC*/ ;
-
-static PyObject* init(PyObject* self, PyObject* arg)
-{
-	PyObject* result;
-	int value;
-
-	result = autoinit(self, arg);
-	value = PyObject_IsTrue(result);
-	Py_DECREF(result);
-	if(!value)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	RETURN_NONE
-}
-
-
-    /*DOC*/ static char doc_get_init[] =
-    /*DOC*/    "pygame.music.get_init() -> bool\n"
-    /*DOC*/    "query the music module\n"
-    /*DOC*/    "\n"
-    /*DOC*/    "Returns true if the music module is initialized.\n"
-    /*DOC*/ ;
-
-static PyObject* get_init(PyObject* self, PyObject* arg)
-{
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	return PyInt_FromLong(SDL_WasInit(SDL_INIT_AUDIO));
-}
-
-
 
 
 
 
 
     /*DOC*/ static char doc_get_busy[] =
-    /*DOC*/    "pygame.music.get_busy() -> bool\n"
+    /*DOC*/    "pygame.mixer.music.get_busy() -> bool\n"
     /*DOC*/    "query state of the music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Returns true if music is currently playing\n"
 
 
     /*DOC*/ static char doc_fadeout[] =
-    /*DOC*/    "pygame.music.fadeout(millisec) -> None\n"
+    /*DOC*/    "pygame.mixer.music.fadeout(millisec) -> None\n"
     /*DOC*/    "fadeout current music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Fades out the current playing music and stops it over the given\n"
 
 
     /*DOC*/ static char doc_stop[] =
-    /*DOC*/    "pygame.music.stop() -> None\n"
+    /*DOC*/    "pygame.mixer.music.stop() -> None\n"
     /*DOC*/    "stop the playing music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Stops playback of the current music.\n"
 
 
     /*DOC*/ static char doc_pause[] =
-    /*DOC*/    "pygame.music.pause() -> None\n"
+    /*DOC*/    "pygame.mixer.music.pause() -> None\n"
     /*DOC*/    "pause the playing music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Temporarily stops the current music.\n"
 
 
     /*DOC*/ static char doc_unpause[] =
-    /*DOC*/    "pygame.music.unpause() -> None\n"
+    /*DOC*/    "pygame.mixer.music.unpause() -> None\n"
     /*DOC*/    "restarts the paused music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Restarts playback of the current music object when paused.\n"
 
 
     /*DOC*/ static char doc_rewind[] =
-    /*DOC*/    "pygame.music.rewind() -> None\n"
+    /*DOC*/    "pygame.mixer.music.rewind() -> None\n"
     /*DOC*/    "restarts music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Restarts playback of the current music.\n"
 
 
     /*DOC*/ static char doc_set_volume[] =
-    /*DOC*/    "pygame.music.set_volume(val) -> None\n"
+    /*DOC*/    "pygame.mixer.music.set_volume(val) -> None\n"
     /*DOC*/    "set music volume\n"
     /*DOC*/    "\n"
     /*DOC*/    "Sets the current volume for the music. Value is\n"
 
 
     /*DOC*/ static char doc_get_volume[] =
-    /*DOC*/    "pygame.music.get_volume() -> val\n"
+    /*DOC*/    "pygame.mixer.music.get_volume() -> val\n"
     /*DOC*/    "query music volume\n"
     /*DOC*/    "\n"
     /*DOC*/    "Get the current volume for the music. Value is\n"
 
 
     /*DOC*/ static char doc_set_endevent[] =
-    /*DOC*/    "pygame.music.set_endevent([eventid]) -> None\n"
+    /*DOC*/    "pygame.mixer.music.set_endevent([eventid]) -> None\n"
     /*DOC*/    "sets music finished event\n"
     /*DOC*/    "\n"
     /*DOC*/    "When the music has finished playing, you can optionally have\n"
 
 
     /*DOC*/ static char doc_get_endevent[] =
-    /*DOC*/    "pygame.music.get_endevent([eventid]) -> int\n"
+    /*DOC*/    "pygame.mixer.music.get_endevent([eventid]) -> int\n"
     /*DOC*/    "query the current music finished event\n"
     /*DOC*/    "\n"
     /*DOC*/    "When the music has finished playing, you can optionally have\n"
 
 
     /*DOC*/ static char doc_load[] =
-    /*DOC*/    "pygame.music.load(filename) -> None\n"
+    /*DOC*/    "pygame.mixer.music.load(filename) -> None\n"
     /*DOC*/    "load current music\n"
     /*DOC*/    "\n"
     /*DOC*/    "Load a music object as the current music. The music only handles\n"
 
 static PyMethodDef music_builtins[] =
 {
-	{ "__PYGAMEinit__", autoinit, 1, doc_init },
-	{ "init", init, 1, doc_init },
-	{ "quit", quit, 1, doc_quit },
-	{ "get_init", get_init, 1, doc_get_init },
-
 	{ "set_endevent", set_endevent, 1, doc_set_endevent },
 	{ "get_endevent", get_endevent, 1, doc_get_endevent },
 
 
 
 
-    /*DOC*/ static char doc_pygame_music_MODULE[] =
+    /*DOC*/ static char doc_pygame_mixer_music_MODULE[] =
     /*DOC*/    "The music module is tied closely to the pygame.mixer module. It\n"
     /*DOC*/    "is an optional module since it depends on the SDL_mixer library.\n"
+    /*DOC*/    "You should not manually import the music library. Instead it is\n"
+    /*DOC*/    "automatically included as a part of the mixer library. The default\n"
+    /*DOC*/    "module path to music is pygame.mixer.music.\n"
     /*DOC*/    "\n"
     /*DOC*/    "The difference between playback of music and playback of sounds\n"
     /*DOC*/    "is that the music object is not loaded and decoded all at once,\n"
     /*DOC*/    "loaded from special file-like objects through python.\n"
     /*DOC*/ ;
 
-void initmusic()
+void initmixer_music()
 {
 	PyObject *module, *dict;
 
     /* create the module */
-	module = Py_InitModule3("music", music_builtins, doc_pygame_music_MODULE);
+	module = Py_InitModule3("mixer_music", music_builtins, doc_pygame_mixer_music_MODULE);
 	dict = PyModule_GetDict(module);
 
 	/*imported needed apis*/
 	import_pygame_base();
-	import_pygame_mixer();
 }
 
 static PyTypeObject PyRect_Type = { 
 	PyObject_HEAD_INIT(0)
 	0,							/*size*/
-	"rect",						/*name*/
+	"Rect",						/*name*/
 	sizeof(PyRectObject),		/*basicsize*/
 	0,							/*itemsize*/
 	/* methods */
 static PyObject* surf_set_clip(PyObject* self, PyObject* args)
 {
 	SDL_Surface* surf = PySurface_AsSurface(self);
-	GAME_Rect *rect, temp;
-	PyObject* r = NULL;
+	GAME_Rect *rect=NULL, temp;
 	int result;
-	
-	if(!PyArg_ParseTuple(args, "|O", &r))
-		return NULL;
 
-	if(!r)
-		rect = NULL;
-	else if(!(rect = GameRect_FromObject(r, &temp)))
-		return RAISE(PyExc_ValueError, "invalid rectstyle object");
-
+	if(PyTuple_Size(args))
+	{
+		rect = GameRect_FromObject(args, &temp);
+		if(!rect)
+			return RAISE(PyExc_ValueError, "invalid rectstyle object");
+	}
 	result = SDL_SetClipRect(surf, (SDL_Rect*)rect);
 	if(result == -1)
 		return RAISE(PyExc_SDLError, SDL_GetError());
 
 
     /*DOC*/ static char doc_surf_blit[] =
-    /*DOC*/    "Surface.blit(source, destoffset, [srcoffset, [size]]) -> Rect\n"
+    /*DOC*/    "Surface.blit(source, destoffset, [sourcerect]) -> Rect\n"
     /*DOC*/    "copy a one Surface to another.\n"
     /*DOC*/    "\n"
     /*DOC*/    "The blitting will transfer one surface to another. It will\n"
     /*DOC*/    "support is available, it will be used. The given source is the\n"
     /*DOC*/    "Surface to copy from. The destoffset is a 2-number-sequence that\n"
     /*DOC*/    "specifies where on the destination Surface the blit happens.\n"
-    /*DOC*/    "Without srcoffset and size supplied, the blit will copy the\n"
+    /*DOC*/    "When sourcerect isn't supplied, the blit will copy the\n"
     /*DOC*/    "entire source surface. If you would like to copy only a portion\n"
-    /*DOC*/    "of the source, use the srcoffset and size arguements to control\n"
+    /*DOC*/    "of the source, use the sourcerect argument to control\n"
     /*DOC*/    "what area is copied.\n"
     /*DOC*/    "\n"
     /*DOC*/    "The blit is subject to be clipped by the active clipping\n"
 static PyObject* surf_blit(PyObject* self, PyObject* args)
 {
 	SDL_Surface* src, *dest = PySurface_AsSurface(self);
-	PyObject* srcobject;
-	int w, h, dx, dy, sx, sy;
-	SDL_Rect dest_rect, src_rect;
-	int result;
+	GAME_Rect* src_rect, temp;
+	PyObject* srcobject, *argrect = NULL;
+	int dx, dy, result;
+	SDL_Rect dest_rect;
 
-	dx = dy = sx = sy = w = h = 0;
-
-	if(!PyArg_ParseTuple(args, "O!(ii)|(ii)(ii)", &PySurface_Type, &srcobject,
-				&dx, &dy, &sx, &sy, &w, &h))
+	if(!PyArg_ParseTuple(args, "O!(ii)|O", &PySurface_Type, &srcobject, &dx, &dy, &argrect))
 		return NULL;
 	src = PySurface_AsSurface(srcobject);
 
-	if(w && h)
+	if(argrect)
 	{
-		dest_rect.w = src_rect.w = (unsigned short)w;
-		dest_rect.h = src_rect.h = (unsigned short)h;
+		if(!(src_rect = GameRect_FromObject(argrect, &temp)))
+			return RAISE(PyExc_TypeError, "Invalid rectstyle argument");
 	}
 	else
 	{
-		dest_rect.w = src_rect.w = src->w;
-		dest_rect.h = src_rect.h = src->h;
+		temp.x = temp.y = 0;
+		temp.w = src->w;
+		temp.h = src->h;
+		src_rect = &temp;
 	}
+
 	dest_rect.x = (short)dx;
 	dest_rect.y = (short)dy;
-	src_rect.x = (short)sx;
-	src_rect.y = (short)sy;
+	dest_rect.w = (unsigned short)src_rect->w;
+	dest_rect.h = (unsigned short)src_rect->h;
 
-	result = SDL_BlitSurface(src, &src_rect, dest, &dest_rect);
+	result = SDL_BlitSurface(src, (SDL_Rect*)src_rect, dest, &dest_rect);
 	if(result == -1)
 		return RAISE(PyExc_SDLError, SDL_GetError());
 
 }
 
 
+    /*DOC*/ static char doc_surf_get_flags[] =
+    /*DOC*/    "Surface.get_flags() -> flags\n"
+    /*DOC*/    "query the surface width\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "Returns the current state flags for the surface.\n"
+    /*DOC*/ ;
+
+static PyObject* surf_get_flags(PyObject* self, PyObject* args)
+{
+	SDL_Surface* surf = PySurface_AsSurface(self);
+	return PyInt_FromLong(surf->flags);
+}
+
+
+
+    /*DOC*/ static char doc_surf_get_pitch[] =
+    /*DOC*/    "Surface.get_pitch() -> pitch\n"
+    /*DOC*/    "query the surface pitch\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "The surface pitch is the number of bytes used in each\n"
+    /*DOC*/    "scanline. This function should rarely needed, mainly for\n"
+    /*DOC*/    "any special-case debugging.\n"
+    /*DOC*/ ;
+
+static PyObject* surf_get_pitch(PyObject* self, PyObject* args)
+{
+	SDL_Surface* surf = PySurface_AsSurface(self);
+	return PyInt_FromLong(surf->pitch);
+}
+
 
 
     /*DOC*/ static char doc_surf_get_size[] =
 	{"fill",			surf_fill,			1, doc_surf_fill },
 	{"blit",			surf_blit,			1, doc_surf_blit },
 
-/*	{"get_flags",		surf_get_flags,		1, doc_surf_get_flags },*/
+	{"get_flags",		surf_get_flags,		1, doc_surf_get_flags },
 	{"get_size",		surf_get_size,		1, doc_surf_get_size },
 	{"get_width",		surf_get_width,		1, doc_surf_get_width },
 	{"get_height",		surf_get_height,	1, doc_surf_get_height },
 	{"get_rect",		surf_get_rect,		1, doc_surf_get_rect },
-/*	{"get_pitch",		surf_get_pitch,		1, doc_surf_get_pitch },*/
+	{"get_pitch",		surf_get_pitch,		1, doc_surf_get_pitch },
 	{"get_bitsize",		surf_get_bitsize,	1, doc_surf_get_bitsize },
 	{"get_bytesize",	surf_get_bytesize,	1, doc_surf_get_bytesize },
 	{"get_masks",		surf_get_masks,		1, doc_surf_get_masks },
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.