Anonymous avatar Anonymous committed 6c23d68

ready for 0.3 (need more testing on new config.py)

Comments (0)

Files changed (21)

 	they are similar to the pysdl interface (which is too similar 
 	to the C interface)
 
-Surfarray:
-	Doesn't support all surface types between all array types. Best 
-	support is for 32bit surfaces.
 
-
-There are likely plenty of others. This is an early release, and much
-testing is pending.
+There are likely others. This is an early-ish release, and much
+testing is still pending.
 
 
 Pete Shinners       -       pete@shinners.org
 pygame credits
 Thanks to everyone who made this possible, including:
 
-- Jan Ekhol, Ray Kelm, and Peter Nicolai for initial design help
+- Jan Ekhol, Ray Kelm, and Peter Nicolai for initial design advise
 
 - David Clark for packaging and help with releases
 
   http://www.libsdl.org
 
 
-
-
-
  And a big hand to everyone else who gave me appreciation,
  advice, and suggestions, especially the good folks on the
  old PySDL mailing list.
 Version: 0.3
+November 20, 2000
+(Installation instructions and more in the "docs" directory...)
+
+
+With the 0.3 release things are looking really good. We've reached
+the point where full python games are approachable with pygame.
+Thanks to all that have helped push things along this far. 
+
+
 
 pygame is a cross-platfrom library designed to make it easy to write
 multimedia software, such as games, in Python.
 
-Website and Source code are at: http://pygame.seul.org
-
-Installation instructions are located in docs/install.txt
+Website and sourcecode are at: http://pygame.seul.org
 
 
 This library is distributed under GNU LGPL version 2, which can be
 found in the file  "COPYING".  I reserve the right to place future
 versions of this library under a different license.
 
-The best way to learn how to use SDL is to check out the example files
-the "examples" subdirectory. There are also full docstrings provided
-with the modules, and a rough breakdown of that is currently in the
-"docs" directory.
+The best way to learn how to use pygame is to check out the example files
+the "examples" subdirectory. All modules, functions, and objects in the
+pygame package contain helpful docstrings. Full HTML reference and 
+tutorials are also included.
 
 The programs in the "examples" subdirectory are in the public domain.
 
 
-October 10, 2000
---
 Written by:
 	Pete Shinners				(pete@shinners.org)
 
 
 
-
-
-
-
-
 PyGame heavily dependent on both Python and SDL. Sourcecode for both
 of these is available from their web sites.
 http://www.pythonlabs.com
 surface src/surface.c $(SDL)
 time src/time.c $(SDL)
 
+
 #the following modules are optional. you will want to compile
 #everything you can, but you can ignore ones you don't have
 #dependencies for, just comment them out
 mixer_music src/music.c $(SDL) $(MIXER)
 
 
-#the following are placeholders. setup.py can use
-#them to help auto-copy needed DLLs into the pygame
-#installation folder. if you aren't going to use this,
-#you can likely just leave these lines alone
+
+#the following are placeholders. setup.py can use them to help
+#auto-copy needed DLLs into the pygame installation folder.
+#you can simply ignore these lines under other OS, no need to
+#comment out.
 COPYLIB_smpeg $(SMPEG)
 At this point the biggest needs are to get the functionality for
 all of SDL and the other libraries fully covered. We're almost there,
 but still need to get the more esoteric functions all wrapped up.
-The functions you'll need for 95% of your projects is already done.
+The functions you'll need for 95% of your projects are already done.
 
 Until that point, consider the current interface to be a bit flexible.
 Things could change that will break code relying on older versions. Any
 changes will be easy to make. There will be warning of coming changes,
 but just know that it will likely happen.
+(with the 0.3 release, the interface cement is drying!)(not joy and cd)
 
 Here are some main things i'd like to have done (or at least well
 looked at) by the time 1.0 rolls around. Most of these are ideas
 #This is a list of changes in pygame's history.
 
+Nov 20, 2000
+	Added Surface.save() to create BMPs.
+
 Nov 16, 2000
 	Surface.set_clip() fixed when passing no args [BUG]
 
+#!/usr/bin/env python
+
+"""Quick tool to help setup the needed paths and flags
+in your Setup file. This will call the appropriate sub-config
+scripts automatically.
+"""
+
+import sys, os, shutil
+
+if sys.platform == 'win32':
+    print 'Using WINDOWS configuration...\n'
+    import config_win as CFG
+else:
+    print 'Using UNIX configuration...\n'
+    import config_unix as CFG
+
+
+
+def confirm(message):
+    reply = raw_input('\n' + message + ' [y/N]:')
+    if reply and reply[0].lower() == 'y':
+        return 1
+    return 0
+
+
+def main():
+    if os.path.isfile('Setup'):
+        if confirm('Backup existing "Setup" file'):
+            shutil.copyfile('Setup', 'Setup.bak')
+    if os.path.isdir('build'):
+        if confirm('Remove old build directory (force recompile)'):
+            shutil.rmtree('build', 0)
+
+    CFG.main()
+
+    print """Doublecheck that the new "Setup" file looks correct, then
+run "python setup.py install" to build and install pygame."""
+    
+
+if __name__ == '__main__': main()
+
+
+
+"""Config on Unix"""
+#would be nice if it auto-discovered which other modules where available
+
+import os, sys, shutil
+from glob import glob
+
+configcommand = 'sdl-config --version --cflags --libs'
+
+    
+
+def writesetupfile(flags):
+    origsetup = open('Setup.in', 'r')
+    newsetup = open('Setup', 'w')
+    while 1:
+        line = origsetup.readline()
+        if not line: break
+        if line.startswith('SDL = '):
+            line = 'SDL = ' + flags
+        newsetup.write(line)
+    
+
+def main():
+    configinfo = "-I/usr/include/SDL -D_REENTRANT -lSDL"
+    print 'calling "sdl-config"'
+    try:
+        configinfo = os.popen(configcommand).readlines()
+        print 'Found SDL version:', configinfo[0]
+        configinfo = ' '.join(configinfo[1:])
+        configinfo = configinfo.split()
+        configinfo = ' '.join(configinfo)
+        print 'Flags:', configinfo
+    except:
+        raise SystemExit, """Cannot locate command, "sdl-config". Default SDL compile
+flags have been used, which will likely require a little editing."""
+
+    print '\n--Creating new "Setup" file...'
+    writesetupfile(configinfo)
+    print '--Finished'
+
+
+    
+if __name__ == '__main__':
+    print """This is the configuration subscript for Unix.
+Please run "config.py" for full configuration."""
+
+"""Config on Windows"""
+
+import os, sys, shutil
+from glob import glob
+
+huntpaths = ['..', '..'+os.sep+'..', '..'+os.sep+'*', \
+             '..'+os.sep+'..'+os.sep+'*']
+
+
+class Dependency:
+    inc_hunt = ['include']
+    lib_hunt = [os.path.join('VisualC', 'SDL', 'Release'),
+                os.path.join('VisualC', 'Release'),
+                'Release', 'lib']
+    def __init__(self, name, wildcard, lib, required = 0):
+        self.name = name
+        self.wildcard = wildcard
+        self.required = required
+        self.paths = []
+        self.path = None
+        self.inc_dir = None
+        self.lib_dir = None
+        self.lib = lib
+        self.varname = '$('+name+')'
+        self.line = ""
+                 
+    def hunt(self):
+        parent = os.path.abspath('..')
+        for p in huntpaths:
+            found = glob(os.path.join(p, self.wildcard))
+            found.sort() or found.reverse()  #reverse sort
+            for f in found:
+                if f[:5] == '..'+os.sep+'..' and os.path.abspath(f)[:len(parent)] == parent:
+                    continue
+                if os.path.isdir(f):
+                    self.paths.append(f)
+
+    def choosepath(self):
+        if not self.paths:
+            print 'Path for ', self.name, 'not found.'
+            if self.required: print 'Too bad that is a requirement! Hand-fix the "Setup"'
+        elif len(self.paths) == 1:
+            self.path = self.paths[0]
+            print 'Path for '+self.name+':', self.path
+        else:
+            print 'Select path for '+self.name+':'
+            for i in range(len(self.paths)):
+                print '  ', i+1, '=', self.paths[i]
+            print '  ', 0, '= <Nothing>'
+            choice = raw_input('Select 0-'+`len(self.paths)`+' (1=default):')
+            if not choice: choice = 1
+            else: choice = int(choice)
+            if(choice):
+                self.path = self.paths[choice-1]
+
+    def findhunt(self, base, paths):
+        for h in paths:
+            hh = os.path.join(base, h)
+            if os.path.isdir(hh):
+                return hh.replace('\\', '/')
+        return base.replace('\\', '/')
+
+    def configure(self):
+        self.hunt()
+        self.choosepath()
+        if self.path:
+            self.inc_dir = self.findhunt(self.path, Dependency.inc_hunt)
+            self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt)
+
+    def buildline(self, basepath):
+        inc = lid = lib = " "
+        if basepath:
+            if self.inc_dir: inc = ' -I$(BASE)'+self.inc_dir[len(basepath):]
+            if self.lib_dir: lid = ' -L$(BASE)'+self.lib_dir[len(basepath):]
+        else:
+            if self.inc_dir: inc = ' -I' + self.inc_dir
+            if self.lib_dir: lid = ' -L' + self.lib_dir
+        if self.lib: lib = ' -l'+self.lib
+        self.line = self.name+' =' + inc + lid + lib
+            
+        
+
+DEPS = (
+    Dependency('SDL', 'SDL-[0-9].*', 'SDL', 1),
+    Dependency('FONT', 'SDL_ttf-[0-9].*', 'SDL_ttf'),
+    Dependency('IMAGE', 'SDL_image-[0-9].*', 'SDL_image'),
+    Dependency('MIXER', 'SDL_mixer-[0-9].*', 'SDL_mixer'),
+#copy only dependencies
+    Dependency('SMPEG', 'smpeg-[0-9].*', 'smpeg')
+)
+
+
+
+
+    
+
+def writesetupfile(DEPS, basepath):
+    origsetup = open('Setup.in', 'r')
+    newsetup = open('Setup', 'w')
+    line = ''
+    while line.find('#--StartConfig') == -1:
+        newsetup.write(line)
+        line = origsetup.readline()
+    while line.find('#--EndConfig') == -1:
+        line = origsetup.readline()
+    if basepath:
+        newsetup.write('BASE=' + basepath + '\n')
+    for d in DEPS:
+        newsetup.write(d.line + '\n')
+    while line:
+        line = origsetup.readline()
+        useit = 1
+        for d in DEPS:
+            if line.find(d.varname)!=-1 and not d.path:
+                useit = 0
+                newsetup.write('#'+line)
+                break
+        if useit:          
+            newsetup.write(line)
+    
+
+def main():
+    global DEPS
+
+    allpaths = []
+    for d in DEPS:
+        d.configure()
+        if d.path:
+            allpaths.append(d.inc_dir)
+            allpaths.append(d.lib_dir)
+
+    basepath = os.path.commonprefix(allpaths)
+    lastslash = basepath.rfind('/')
+    if(lastslash < 3 or len(basepath) < 3):
+        basepath = ""
+    else:
+        basepath = basepath[:lastslash]
+
+    for d in DEPS:
+        d.buildline(basepath)
+
+    writesetupfile(DEPS, basepath)
+    
+
+if __name__ == '__main__':
+    print """This is the configuration subscript for Windows.
+Please run "config.py" for full configuration."""
+

confighelp.py

-#!/usr/bin/env python
-
-"""Quick tool to help setup the needed paths and flags
-in your Setup file. This is not usually needed on linux,
-unless you have your dependencies compiled but not installed.
-It is best to make sure the dependencies are already compiled
-before running this script, otherwise the link directories
-will probably not find the correct directory.
-"""
-
-import os, sys, shutil
-from glob import glob
-
-huntpaths = ['..', '..'+os.sep+'..', '..'+os.sep+'*', \
-             '..'+os.sep+'..'+os.sep+'*']
-
-
-class Dependency:
-    inc_hunt = ['include']
-    lib_hunt = [os.path.join('VisualC', 'SDL', 'Release'),
-                os.path.join('VisualC', 'Release'),
-                'Release', 'lib']
-    def __init__(self, name, wildcard, lib, required = 0):
-        self.name = name
-        self.wildcard = wildcard
-        self.required = required
-        self.paths = []
-        self.path = None
-        self.inc_dir = None
-        self.lib_dir = None
-        self.lib = lib
-        self.varname = '$('+name+')'
-        self.line = ""
-                 
-    def hunt(self):
-        parent = os.path.abspath('..')
-        for p in huntpaths:
-            found = glob(os.path.join(p, self.wildcard))
-            found.sort() or found.reverse()  #reverse sort
-            for f in found:
-                if f[:5] == '..'+os.sep+'..' and os.path.abspath(f)[:len(parent)] == parent:
-                    continue
-                if os.path.isdir(f):
-                    self.paths.append(f)
-
-    def choosepath(self):
-        if not self.paths:
-            print 'Path for ', self.name, 'not found.'
-            if self.required: print 'Too bad that is a requirement! Hand-fix the "Setup"'
-        elif len(self.paths) == 1:
-            self.path = self.paths[0]
-            print 'Path for '+self.name+':', self.path
-        else:
-            print 'Select path for '+self.name+':'
-            for i in range(len(self.paths)):
-                print '  ', i+1, '=', self.paths[i]
-            print '  ', 0, '= <Nothing>'
-            choice = raw_input('Select 0-'+`len(self.paths)`+' (1=default):')
-            if not choice: choice = 1
-            else: choice = int(choice)
-            if(choice):
-                self.path = self.paths[choice-1]
-
-    def findhunt(self, base, paths):
-        for h in paths:
-            hh = os.path.join(base, h)
-            if os.path.isdir(hh):
-                return hh.replace('\\', '/')
-        return base.replace('\\', '/')
-
-    def configure(self):
-        self.hunt()
-        self.choosepath()
-        if self.path:
-            self.inc_dir = self.findhunt(self.path, Dependency.inc_hunt)
-            self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt)
-
-    def buildline(self, basepath):
-        inc = lid = lib = " "
-        if basepath:
-            if self.inc_dir: inc = ' -I$(BASE)'+self.inc_dir[len(basepath):]
-            if self.lib_dir: lid = ' -L$(BASE)'+self.lib_dir[len(basepath):]
-        else:
-            if self.inc_dir: inc = ' -I' + self.inc_dir
-            if self.lib_dir: lid = ' -L' + self.lib_dir
-        if self.lib: lib = ' -l'+self.lib
-        self.line = self.name+' =' + inc + lid + lib
-            
-        
-
-DEPS = (
-    Dependency('SDL', 'SDL-[0-9].*', 'SDL', 1),
-    Dependency('FONT', 'SDL_ttf-[0-9].*', 'SDL_ttf'),
-    Dependency('IMAGE', 'SDL_image-[0-9].*', 'SDL_image'),
-    Dependency('MIXER', 'SDL_mixer-[0-9].*', 'SDL_mixer'),
-#optional copied libs
-    Dependency('SMPEG', 'smpeg-[0-9].*', 'smpeg')
-)
-
-
-
-
-
-def confirm(message):
-    reply = raw_input('\n' + message + ' [y/N]:')
-    if reply and reply[0].lower() == 'y':
-        return 1
-    return 0
-    
-
-def writesetupfile(DEPS, basepath):
-    origsetup = open('Setup.in', 'r')
-    newsetup = open('Setup', 'w')
-    line = ''
-    while line.find('#--StartConfig') == -1:
-        newsetup.write(line)
-        line = origsetup.readline()
-    while line.find('#--EndConfig') == -1:
-        line = origsetup.readline()
-    if basepath:
-        newsetup.write('BASE=' + basepath + '\n')
-    for d in DEPS:
-        newsetup.write(d.line + '\n')
-    while line:
-        line = origsetup.readline()
-        useit = 1
-        for d in DEPS:
-            if line.find(d.varname)!=-1 and not d.path:
-                useit = 0
-                newsetup.write('#'+line)
-                break
-        if useit:          
-            newsetup.write(line)
-    
-
-def main():
-    global DEPS
-    print __doc__
-    
-    if os.path.isfile('Setup'):
-        if confirm('Backup existing "Setup" file'):
-            shutil.copyfile('Setup', 'Setup.bak')
-
-    allpaths = []
-    for d in DEPS:
-        d.configure()
-        if d.path:
-            allpaths.append(d.inc_dir)
-            allpaths.append(d.lib_dir)
-
-    basepath = os.path.commonprefix(allpaths)
-    lastslash = basepath.rfind('/')
-    if(lastslash < 3 or len(basepath) < 3):
-        basepath = ""
-    else:
-        basepath = basepath[:lastslash]
-
-    for d in DEPS:
-        d.buildline(basepath)
-
-    print '\n--Creating new "Setup" file...'
-    writesetupfile(DEPS, basepath)
-    print '--Finished'
-    
-    if os.path.isdir('build'):
-        if confirm('Remove old build files (force recompile)'):
-            shutil.rmtree('build', 0)
-
-if __name__ == '__main__': main()
-
 <font size=+1><b>Text File Documentation</b></font><br><li><a href=init.txt>init</a> - Information about importing and initializing pygame
 </li>
 <li><a href=install.txt>install</a> - Quickie build instructions for building and installing pygame
-</li><br>&nbsp;<br><font size=+1><b>Tutorials</b></font><br><li><a href=tut/DisplayModes.html>tut/DisplayModes</a> - Setting Display Modes
+</li><br>&nbsp;<br><font size=+1><b>Tutorials</b></font><br><li><a href=tut/DisplayModes.html>tut/DisplayModes</a> - Choosing and Configuring Display Modes
 </li>
 
 <hr>
 Quickie build instructions for building and installing pygame
-Oct 23, 2000
+Nov 20, 2000
 -------------------------------------------------------------
 pygame is built and installed using the python distutils.
 
 for windows which will suit your needs on that platform).
 This is all you'll need for the base pygame installation.
 There are extra modules you can use which require other
-dependencies like Numeric python and many of the
-SDL daughter libraries, like SDL_image and SDL_ttf.
+dependencies like Numeric Python and many of the SDL
+daughter libraries, like SDL_image and SDL_ttf.
 
-The configuration is controlled by the "Setup" file. Copy
-the shipped "Setup.in" to "Setup". Edit this file in a standard
-text editor. You need to define some simple variables that
-control what flags are needed for each dependencies. If you are
-using linux, there is a good chance the flags will work as-is.
-Under windows you can edit them by hand, but it might be easier
-to run the "confighelp.py" script which will help you look 
-around the neighboring directory trees.
+If installing under Windows without a compiler, or without
+needing any of the pygame dependencies. You can download
+the Windows Precompiled Binaries Release. Download and
+extract this zipfile into the same directory as pygame.
+Now you don't need to worry about any of the Setup files,
+just type "python setup.py install" and you will be set.
+http://pygame.seul.org/ftp/pygame-dependencies.zip
+
+
+You control the compilation of pygame with the "Setup"
+file. The default Setup file is named "Setup.in". The
+file uses basic cross-compiler flags to configure pygame.
+
+The pygame installation also comes with a "config.py"
+script. This will create a Setup file based on the different
+setting of your platform. This should have little difficulty
+building you a proper "Setup" file to compile with.
 
 Once you are reasonably pleased with your "Setup" file, it's
 time to build and install with distutils. This is all handled
 the command "python setup.py install" and distutils will build
 and install everything you need.
 
-When installing, the setup script will look for any of the
-dependency libraries in the library paths you have supplied.
-If you've needed to give the paths for the libraries, the
-setup assumes these dependencies are not in the runtime
-library paths directories. Because of this, it will copy
-these dependencies into the install directory. This will
-solve many DLL errors on windows. On unix systems, this
-can help too if you've built the libraries, but haven't
-installed them.
+On windows, distutils will copy the needed dependency DLL's
+it finds and place them in the final pygame installation folder.
+This should happen automatically. If you get missing DLL errors
+when importing the different pygame modules, it is likely python
+cannot find the needed dependency libraries. You will want to
+hand-copy the needed DLLs to somewhere on your windows path or
+into the installed pygame package directory.
 
 On unix, you will likely need to be root to install the
 library. The installation needs to create directories in

docs/ref/Surface.html

 check if the surface needs locking</td></tr>
 
 
+<tr><td><a href=#save>save</a></td><td> -
+save surface as BMP data</td></tr>
+
+
 <tr><td><a href=#set_alpha>set_alpha</a></td><td> -
 change alpha information</td></tr>
 
 outweight the overhead of just locking any surface before access.
 </ul><br>&nbsp;<br>
 
+<a name=save><font size=+2><b>save
+</b></font><br><font size=+1><tt>
+Surface.save(file) -> None
+</tt></font><ul>
+This will save your surface in the BMP format. The given file
+argument can be either a filename or a python file-like object
+to save the BMP image to.
+</ul><br>&nbsp;<br>
+
 <a name=set_alpha><font size=+2><b>set_alpha
 </b></font><br><font size=+1><tt>
 Surface.set_alpha([alpha, [flags]]) -> None

docs/tut/DisplayModes.html

 <!--
-Setting Display Modes
+Choosing and Configuring Display Modes
 --><html><head>
 
 <title>Pygame Tutorials - Setting Display Modes</title>

examples/Readme.txt

 aliens.py - This started off as a port of the SDL demonstration,
     Aliens. Now it has evolved into something sort of resembling
     fun. This demonstrates a lot of different uses of sprites and
-    optimized blitting.
+    optimized blitting. Also transparancy, colorkeys, fonts, sound,
+    music, and more. (PS, my high score is 117! goodluck)
 
 oldalien.py - This more closely resembles a port of the SDL Aliens
     demo. The code is a lot simpler, so it makes a better starting
     Numeric arrays, don't worry about the source for this one :]
 
 sound.py - Extremely basic testing of the mixer module. Load a
-	sound and play it. 
+	sound and play it. All from the command shell, no graphics.
 
+liquid.py - This example was created in a quick comparison with the
+	BlitzBasic gaming language. Nonetheless, it demonstrates a quick
+	8-bit setup (with colormap).
 
 data/ - directory with the resources for the examples
 sdllogos.zip - zipfile with unofficial sdl logos

examples/vgrade.py

     pygame.init()
     size = 640, 480
     screen = pygame.display.set_mode(size)
-    f = screen.get_flags()
-    print f
 
     pygame.event.set_blocked(MOUSEMOTION) #keep our queue cleaner
     pygame.time.set_timer(USEREVENT, 500)
 # To use:
 #       python setup.py install
 #
+
+morehelp = """
+You can copy the file, "Setup.in" to "Setup" and configure
+by hand. You can also run one of the configuration helper
+scripts to do this for you: configwin.py or configunix.py"""
+
+
 import os.path, glob, sys
 import distutils.sysconfig 
 from distutils.core import setup, Extension
 from distutils.extension import read_setup_file
 from distutils.ccompiler import new_compiler
 
+
 if sys.version_info[0] < 2:
     raise SystemExit, """pygame requires python 2.0 or higher"""
 
 try:
     extensions = read_setup_file('Setup')
 except IOError:
-    raise SystemExit, """Need a "Setup" file for compiling."""
+    raise SystemExit, 'Need a "Setup" file for compiling.' + morehelp
 
 #extra files to install
 data_files = []
 
 staticforward PyTypeObject PyVidInfo_Type;
 static PyObject* PyVidInfo_New(const SDL_VideoInfo* info);
-#define PyVidInfo_Check(x) ((x)->ob_type == &PyVidInfo_Type)
 
 
 /*quick internal test to see if gamma is supported*/
 	if(PyString_Check(file))
 	{
 		name = PyString_AsString(file);
+		Py_BEGIN_ALLOW_THREADS
 		surf = IMG_Load(name);
+		Py_END_ALLOW_THREADS
 	}
 	else
 	{
 
 
 
-
 static PyMethodDef image_builtins[] =
 {
 	{ "load", load, 1, doc_load },
 
 /* macros used throughout the source */
 #define RAISE(x,y) (PyErr_SetString((x), (y)), NULL)
-#define RETURN_NONE {Py_INCREF(Py_None); return Py_None;}
+#define RETURN_NONE return (Py_INCREF(Py_None), Py_None);
 #define PyType_Init(x) (((x).ob_type) = &PyType_Type)
 #define PYGAMEAPI_LOCAL_ENTRY "_PYGAME_C_API"
 #ifndef min
 
 
 
+    /*DOC*/ static char doc_surf_save[] =
+    /*DOC*/    "Surface.save(file) -> None\n"
+    /*DOC*/    "save surface as BMP data\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "This will save your surface in the BMP format. The given file\n"
+    /*DOC*/    "argument can be either a filename or a python file-like object\n"
+    /*DOC*/    "to save the BMP image to.\n"
+    /*DOC*/ ;
+
+static PyObject* surf_save(PyObject* self, PyObject* arg)
+{
+	SDL_Surface* surf = PySurface_AsSurface(self);
+	PyObject* file;
+	SDL_RWops *rw;
+	int result;
+	if(!PyArg_ParseTuple(arg, "O", &file))
+		return NULL;
+
+	VIDEO_INIT_CHECK();
+
+	if(PyString_Check(file))
+	{
+		char* name = PyString_AsString(file);
+		Py_BEGIN_ALLOW_THREADS
+		result = SDL_SaveBMP(surf, name);
+		Py_END_ALLOW_THREADS
+	}
+	else
+	{
+		if(!(rw = RWopsFromPython(file)))
+			return NULL;
+		Py_BEGIN_ALLOW_THREADS
+		result = SDL_SaveBMP_RW(surf, rw, 1);
+		Py_END_ALLOW_THREADS
+	}
+
+	if(result == -1)
+		return RAISE(PyExc_SDLError, SDL_GetError());
+
+	RETURN_NONE;
+}
+
+
+
 
 static struct PyMethodDef surface_methods[] =
 {
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.