1. pygame
  2. Untitled project
  3. pygame

Commits

pygame  committed ad329e5

filled drawing clip fix and rect comparisons

  • Participants
  • Parent commits 000b709
  • Branches default

Comments (0)

Files changed (5)

File README.TXT

View file
 ----
 At some point it would be nice to add support for more external
 python libraries, here are some ideas...
- - more collision detection stuff: pixel2pixel, point2poly, etc
  - smarten the config.py and setup.py stuff
-
-
+ - wide line drawing should be drawn as a polygon?
+ - make object constructors (Rect, Surface) the actual type
 
 
 CREDITS
 - Ed Boraas and Francis Irving for Debian packaging
 - Maxim Sobolev for FreeBSD port maintenance
 - Bob Ippolito for the MacOS porting
-- Jan Ekhol, Ray Kelm, and Peter Nicolai for initial reviews
+- Jan Ekhol, Ray Kelm, and Peter Nicolai for early design reviews
 - Our list of valiant bug fixers:
 	Niki Spahiev, Gordon Tyler,
-	Dave Wallace, and John Popplewell
+	Dave Wallace, John Popplewell
 - And our dutiful bug hunters:
 	Angus, Guillaume Proux, Frank Raiser,
 	Austin Henry, Kaweh Kazemi, Arturo Aldama

File WHATSNEW

View file
 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+November 3, 2001
+        filled shape drawing now clips properly [BUG]
+        Rect object correctly compare (==,<,>)
+
 November 2, 2001
 	pygame.time.get_ticks() returns 0 before pygame.init()
 

File config_unix.py

View file
 """Config on Unix"""
-#would be nice if it auto-discovered which other modules where available
 
 import os, sys, shutil, string
 from glob import glob
         self.checkhead = checkhead
         self.cflags = ''
     
-    def configure(self, incdir, libdir):
-
-        inc = os.path.join(incdir, self.checkhead)
-        lib = os.path.join(libdir, self.checklib)
-
-        if not os.path.isfile(inc):
-            newdir = os.path.join(os.path.split(incdir)[0], string.lower(self.name))
-            inc = os.path.join(newdir, self.checkhead)
-            if os.path.isfile(inc):
-                self.inc_dir = newdir
-
-        if os.path.isfile(inc) and glob(lib):
+    def configure(self, incdirs, libdirs):
+        incname = self.checkhead
+        libnames = self.checklib, string.lower(self.name)
+        
+        for dir in incdirs:
+            path = os.path.join(dir, incname)
+            if os.path.isfile(path):
+                self.inc_dir = dir
+        for dir in libdirs:
+            for name in libnames:
+                path = os.path.join(dir, name)
+                if os.path.isfile(path):
+                    self.lib_dir = dir
+                
+        if self.lib_dir and self.inc_dir:
             print self.name + '        '[len(self.name):] + ': found'
             self.found = 1
         else:
 
     print 'Hunting dependencies...'
     if localbase:
-        incdir = localbase + '/include/SDL11'
-        libdir = localbase + '/lib'
+        incdirs = [localbase + '/include/SDL']
+        libdirs = [localbase + '/lib']
     else:
-        incdir = libdir = ''
+        incdirs = []
+        libdirs = []
         for arg in configinfo.split():
             if arg[:2] == '-I':
-                incdir = arg[2:]
+                incdirs.append(arg[2:])
             elif arg[:2] == '-L':
-                libdir = arg[2:]
+                libdirs.append(arg[2:])
     for d in DEPS:
-        d.configure(incdir, libdir)
+        d.configure(incdirs, libdirs)
 
-    DEPS[0].inc_dir = None
-    DEPS[0].lib_dir = None
+    DEPS[0].inc_dirs = []
+    DEPS[0].lib_dirs = []
     DEPS[0].cflags = configinfo
 
     return DEPS

File src/draw.c

View file
 	default: /*case 4*/
 		for(; pixel <= end; pixel+=4) {
 			*(Uint32*)pixel = color;
-/*			  *(Uint32*)pixel = ~(*(Uint32*)pixel)*31;
-*/		  }break;
+		  }break;
 	}
 }
 
 	if(y1 < surf->clip_rect.y || y1 >= surf->clip_rect.y + surf->clip_rect.h)
 		return;
 
-	if ( x2 < x1 )
+	if( x2 < x1 )
 	{
-	 int temp = x1;
-	 x1 = x2; x2 = temp;
+                int temp = x1;
+                x1 = x2; x2 = temp;
 	}
 
-	if(y1 < surf->clip_rect.y || y1 > surf->clip_rect.y + surf->clip_rect.h)
-		return;
 	x1 = max(x1, surf->clip_rect.x);
 	x2 = min(x2, surf->clip_rect.x + surf->clip_rect.w-1);
+
+        if(x2 < surf->clip_rect.x || x1 >= surf->clip_rect.x + surf->clip_rect.w)
+                return;
+
 	if(x1 == x2)
-		set_at( surf, x1, y1, color);
+		set_at(surf, x1, y1, color);
 	else
 		drawhorzline(surf, color, x1, y1, x2);
 }

File src/rect.c

View file
 		return self->r.x < orect->x ? -1 : 1;
 	if(self->r.y != orect->y)
 		return self->r.y < orect->y ? -1 : 1;
-	if(self->r.x != orect->x)
+	if(self->r.w != orect->w)
 		return self->r.w < orect->w ? -1 : 1;
-	if(self->r.x != orect->x)
+	if(self->r.h != orect->h)
 		return self->r.h < orect->h ? -1 : 1;
 
 	return 0;