From d64ea3c18599d3df0065b6466c90bbdf0411bd56 Mon Sep 17 00:00:00 2001 From: slm Date: Thu, 05 Aug 2010 04:56:35 +0000 Subject: Deleted depreciated directories of tests - finalized the prototype of the Drawable Object test to be included in the complete test kit. --- (limited to 'DrawableObjectTests/Spritesheet.py') diff --git a/DrawableObjectTests/Spritesheet.py b/DrawableObjectTests/Spritesheet.py deleted file mode 100755 index ddb18a8..0000000 --- a/DrawableObjectTests/Spritesheet.py +++ /dev/null @@ -1,31 +0,0 @@ -import pygame - -class Spritesheet: - """ - Class from http://www.scriptedfun.com/transcript-2-using-sprite-sheets-and-drawing-the-background/ - - This class can be used to seporate images from the sprite sheet - """ - def __init__(self, filename): - self.sheet = pygame.image.load(filename).convert() - - def imgat(self, rect, myColorKey = None): - rect = pygame.Rect(rect) - image = pygame.Surface(rect.size).convert() - if myColorKey == None: myColorKey = image.get_at((0,0)) - image.set_colorkey(myColorKey) - image.blit(self.sheet, (0, 0), rect) - return image - - def imgsat(self, rects, myColorKey = None): - imgs = [] - for rect in rects: - imgs.append(self.imgat(rect, myColorKey)) - return imgs - - def img_extract( self, cols, rows, width, height, myColorKey = None): - rect_list = [] - for y in range(0, rows): - for x in range(0, cols): - rect_list.append( (width*x, height*y, width, height,) ) - return self.imgsat( rect_list, myColorKey) \ No newline at end of file -- cgit v0.9.1