Commits

Anonymous committed 31390ea

clean liquid example, remove uberball example

  • Participants
  • Parent commits a6de2d4

Comments (0)

Files changed (8)

 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+February 24, 2004
+    no longer parachute SIGPIPE, like SDL 1.2.7
+
 February 15, 2004
     small cleanups to internal Sprite and Group
 

File examples/data/bong.wav

Binary file removed.

File examples/data/liquid.bmp

Old
Old image
New
New image

File examples/liquid.py

 from pygame.locals import *
 from math import sin
 
+def main():
+    #initialize and setup screen
+    pygame.init()
+    screen = pygame.display.set_mode((640, 480), HWSURFACE|DOUBLEBUF)
 
-#initialize and setup screen
-pygame.init()
-screen = pygame.display.set_mode((640, 480), HWSURFACE|DOUBLEBUF, 8)
+    #load image and quadruple
+    imagename = os.path.join('data', 'liquid.bmp')
+    bitmap = pygame.image.load(imagename)
+    bitmap = pygame.transform.scale2x(bitmap)
+    bitmap = pygame.transform.scale2x(bitmap)
 
-#load image
-imagename = os.path.join('data', 'liquid.bmp')
-bitmap = pygame.image.load(imagename)
+    #get the image and screen in the same format
+    if screen.get_bitsize() == 8:
+        screen.set_palette(bitmap.get_palette())
+    else:
+        bitmap = bitmap.convert()
 
-#get the image and screen in the same format
-if screen.get_bitsize() == 8:
-    screen.set_palette(bitmap.get_palette())
-else:
-    bitmap = bitmap.convert()
+    #prep some variables
+    anim = 0.0
 
-#prep some variables
-anim = 0.0
+    #mainloop
+    xblocks = range(0, 640, 20)
+    yblocks = range(0, 480, 20)
+    stopevents = QUIT, KEYDOWN, MOUSEBUTTONDOWN
+    while 1:
+        for e in pygame.event.get():
+            if e.type in stopevents:
+                return
 
-#mainloop
-while not pygame.event.peek([QUIT, KEYDOWN, MOUSEBUTTONDOWN]):
-    anim = anim + 0.4
-    for x in range(0, 640, 20):
-        for y in range(0, 480, 20):
+        anim = anim + 0.2
+        for x in xblocks:
             xpos = (x + (sin(anim + x * .01) * 15)) + 20
-            ypos = (y + (sin(anim + y * .01) * 15)) + 20
-            screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
-    pygame.display.flip()
+            for y in yblocks:
+                ypos = (y + (sin(anim + y * .01) * 15)) + 20
+                screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
+
+        pygame.display.flip()
+
+
+if __name__ == '__main__': main()
 
 
 
 """BTW, here is the code from the BlitzBasic example this was derived
-from. This code runs a little faster, yet reads a lot slower. again
-i've snipped the sound and text stuff out.
+from. i've snipped the sound and text stuff out.
 -----------------------------------------------------------------
 ; Brad@freedom2000.com
 
 ; Load a bmp pic (800x600) and slice it into 1600 squares
-Graphics 640,480					
-SetBuffer BackBuffer()				
-bitmap$="f2kwarp.bmp"					
+Graphics 640,480
+SetBuffer BackBuffer()
+bitmap$="f2kwarp.bmp"
 pic=LoadAnimImage(bitmap$,20,15,0,1600)
 
 ; use SIN to move all 1600 squares around to give liquid effect
 For y=0 To 599 Step 15
 For x = 0 To 799 Step 20
 f=f+1:If f=1600 Then f=0
-DrawBlock pic,(x+(Sin(w+x)*40))/1.7+80,(y+(Sin(w+y)*40))/1.7+60,f 
+DrawBlock pic,(x+(Sin(w+x)*40))/1.7+80,(y+(Sin(w+y)*40))/1.7+60,f
 Next:Next:Flip:Cls
 Until KeyDown(1)
 """

File examples/uberball.py

-#!/usr/bin/env python
-
-"""
-�berBall python source by Geoff Howland.  04-28-02
-
-All rights to this code and source and name are placed in the public domain.
-
-This is meant to be an example of how to use Python for creating games, and being my first project
-in Python could have some things that could have been organized better, but I think it handles most
-of the situations pretty elegantly.  The code was originally based on the 'chimp.py' example that
-with PyGame examples as it was the most basic example to do full drawing/events.  Most, but not all,
-of that code has been rewriten though so it probably wont be much to compare.
-
-If you're interested in independent game development you can take a look at my website Ludum Dare:
-http://ludumdare.com/
-
-Hope this helps some people!
-
--Geoff Howland
-ghowland@lupinegames.com
-
-
-On May 21, 2002, this was slightly cleaned up to be included with the pygame
-examples. Changes mainly include better use of the pygame.sprite module. All
-graphic resources are now rendered during runtime instead of loaded from disk.
-"""
-
-
-#Import Modules
-import os, pygame
-from pygame.locals import *
-from random import randint
-
-if not pygame.font: raise SystemExit, "Requires pygame.font module"
-if not pygame.mixer: print 'Warning, sound disabled'
-
-
-#functions to create our resources
-
-def load_sound(name):
-	class NoneSound:
-		def play(self): pass
-	if not pygame.mixer or not pygame.mixer.get_init():
-		return NoneSound()
-	fullname = os.path.join('data', name)
-	try:
-		sound = pygame.mixer.Sound(fullname)
-	except pygame.error, message:
-		print 'Cannot load sound:', fullname
-		raise SystemExit, message
-	return sound
-
-def render_block(size, color, width=1):
-        hicolor = map(lambda x: x+40, color)
-        locolor = map(lambda x: x-20, color)
-        surf = pygame.Surface(size)
-        r = surf.get_rect()
-        smallr = r.inflate(-width-1, -width-1)
-        surf.fill(color)
-        pygame.draw.lines(surf, locolor, 0, (smallr.topright, smallr.bottomright, smallr.bottomleft), width)
-        pygame.draw.lines(surf, hicolor, 0, (r.bottomleft, r.topleft, r.topright), width)
-        return surf, r
-
-def render_ball(radius, color):
-        hicolor = map(lambda x: x+50, color)
-        radius = radius
-        size = radius * 2
-        surf = pygame.Surface((size, size))
-        pygame.draw.circle(surf, color, (radius, radius), radius)
-        half = radius/2
-        surf.set_at((half, half+1), hicolor)
-        surf.set_at((half+1, half), hicolor)
-        surf.set_colorkey(0)
-        return surf, surf.get_rect()
-        
-
-def render_powerup(color):
-        if not pygame.font:
-            surf = pygame.Surface((30, 30))
-            surf.fill(color)
-            return surf, surf.get_rect()
-        
-        font = pygame.font.Font(None, 15)
-        font.set_bold(1)
-        surf = font.render(":-)", 0, color)
-        surf2 = pygame.transform.rotate(surf, -90)
-        r = surf2.get_rect()
-        pygame.draw.rect(surf2, color, r, 1)
-        return surf2, r
-
-
-class PlayGameState:
-	"Class for the game's play state variables and control functions."
-	def __init__(self):
-		self.menuMode = 0
-		self.score = 0
-		self.level = 1
-		self.effectCurrent = 0
-		self.effectDuration = 0
-
-	def NewGame(self):
-		self.menuMode = 2 # Game
-		self.score = 0
-		self.level = 1
-		self.effectCurrent = 0
-		self.effectDuration = 0
-		
-		# Load level
-
-	def ScoreAdd(self, scoreAdd):
-		self.score = self.score + scoreAdd
-
-#classes for our game objects
-class Paddle(pygame.sprite.Sprite):
-	"""moves a clenched paddle on the screen, following the mouse"""
-	def __init__(self):
-		pygame.sprite.Sprite.__init__(self) #call Sprite initializer
-		self.image, self.rect = render_block((50, 15), (200, 180, 120), 2)
-
-	def update(self):
-		"move the paddle based on the mouse position"
-		pos = pygame.mouse.get_pos()	# This should really be passed the mouse position
-		self.rect.midtop = pos
-		self.rect.bottom = 440		# Lock Paddle at the bottom of the screen
-
-
-#classes for our game objects
-class Brick(pygame.sprite.Sprite):
-	"""moves a clenched paddle on the screen, following the mouse"""
-	colors = (200, 50, 50),  (50, 200, 50), (50, 50, 200), (200, 200, 50)
-	def __init__(self, type, x, y):
-		pygame.sprite.Sprite.__init__(self) #call Sprite initializer
-		self.type = type
-		self.image, self.rect = render_block((30, 10), Brick.colors[type])
-		self.active = 1
-		self.rect.left = (x * self.rect.width) + 5
-		self.rect.top = y * self.rect.height
-		self.posX = x
-		self.posY = y
-
-#classes for our game objects
-class PowerUp(pygame.sprite.Sprite):
-	"""moves a clenched paddle on the screen, following the mouse"""
-	colors = (150, 50, 50), (50, 150, 50)
-	def __init__(self, type, speed, x, y):
-		pygame.sprite.Sprite.__init__(self) #call Sprite initializer
-		self.type = type
-		self.speed = speed
-		self.image, self.rect = render_powerup(PowerUp.colors[type])
-		self.rect.left = x
-		self.rect.top = y
-
-	def update(self):
-		# Fall
-		self.rect.top = self.rect.top + self.speed
-
-	def collide (self, test):
-		if self.rect.colliderect (test.rect):
-			return 1
-
-		return 0
-			
-class Ball(pygame.sprite.Sprite):
-	"""moves a monkey critter across the screen. it can spin the
-	   monkey when it is punched."""
-	radii = 8, 4
-	def __init__(self, size,x=300,y=200):
-		pygame.sprite.Sprite.__init__(self) #call Sprite intializer
-		self.size = size
-		self.image, self.rect = render_ball(Ball.radii[size], (50, 200, 200))
-		screen = pygame.display.get_surface()
-		self.area = screen.get_rect()
-		self.area.left = self.area.left - 5
-		
-		self.rect.centerx = x
-		self.rect.centery = y
-		self.moveX = 4 + (2 * size)
-		self.moveY = 4 + (2 * size)
-		self.lastRect = self.rect
-
-	def changeType(self):
-		size = not self.size
-		self.size = size
-		x = self.rect.centerx
-		y = self.rect.centery
-		self.image, self.rect = render_ball(Ball.radii[size], (50, 200, 200))
-		self.rect.centerx = x
-		self.rect.centery = y
-		
-		# Set the speed based on the size, and keep its direction
-		if size:
-			self.moveX = self.moveX * 2
-			self.moveY = self.moveY * 2
-		else:
-			self.moveX = self.moveX / 2
-			self.moveY = self.moveY / 2
-
-	def update(self):
-		self.lastRect = self.rect
-		newpos = self.rect.move((self.moveX, self.moveY))
-		if not self.area.contains(newpos):
-			if self.rect.centerx < 0 or self.rect.centerx > self.area.right:
-				self.moveX = -self.moveX
-			if self.rect.centery < 0 or self.rect.centery > self.area.bottom:
-				self.moveY = -self.moveY
-			newpos = self.rect.move((self.moveX, self.moveY))
-
-		self.rect = newpos
-
-	def collidePaddle (self, test):
-		horReverse = 0
-		## Collision from right
-		if self.lastRect.right < test.rect.left and self.lastRect.bottom > test.rect.top:
-			self.rect.right = test.rect.left
-			self.moveX = -self.moveX
-			horReverse = 1
-			
-		## Collision from left			
-		if self.lastRect.left > test.rect.right and self.lastRect.bottom > test.rect.top:
-			self.rect.left = test.rect.right
-			self.moveX = -self.moveX
-			horReverse = 1
-
-		## Collision from above			
-		if not horReverse and self.moveY > 0:
-			self.rect.bottom = test.rect.top
-			# If we haven't done a horizontal reverse then do a gradient angle change
-			if not horReverse:
-				if self.rect.centerx < test.rect.centerx:
-					self.moveX = ((self.rect.centerx - test.rect.centerx) / (test.rect.width / 2.0)) * 4.0
-					if self.moveX >= -1:
-						self.moveX = -1
-				else:
-					self.moveX = ((self.rect.centerx - test.rect.centerx) / (test.rect.width / 2.0)) * 4.0
-					if self.moveX <= 1:
-						self.moveX = 1
-		
-			self.moveY = -self.moveY
-
-	def collide (self, test):
-		horReverse = 0
-		# Collision from right
-		if self.lastRect.right < test.rect.left and self.lastRect.bottom > test.rect.top:
-			self.rect.right = test.rect.left-1
-			self.moveX = -self.moveX
-			horReverse = 1
-			
-		# Collision from left			
-		if self.lastRect.left > test.rect.right and self.lastRect.bottom > test.rect.top:
-			self.rect.left = test.rect.right+1
-			self.moveX = -self.moveX
-			horReverse = 1
-
-		# Collision from above			
-		if not horReverse and self.moveY > 0:
-			self.rect.bottom = test.rect.top
-			self.moveY = -self.moveY
-
-		# Collision from below			
-		if not horReverse and self.moveY < 0:
-			self.rect.top = test.rect.bottom
-			self.moveY = -self.moveY
-
-
-class GameMode:
-	"""This handles all the game mode activities, playing, scoring, dying, drawing, etc."""
-	def __init__(self, gameControlObj, screenRect):
-		self.gameControl = gameControlObj	# Mode can change to another mode by itself
-		
-		# Create rect bonudaries for the screen
-		self.screenBoundary = screenRect
-		self.powerchance = 3
-		
-		# Create fonts
-		self.fontScore = pygame.font.Font(None, 26)
-		self.fontLives = pygame.font.Font(None, 26)
-		
-		# Create sounds
-		self.bong_sound = load_sound('bong.wav')
-		
-		self.reset ()
-
-	def reset(self):
-		# Create and clear the gameState
-		self.gameState = PlayGameState()
-		
-		# Create paddle for player
-		self.paddle = Paddle()
-		self.allsprites = pygame.sprite.RenderUpdates(self.paddle)
-
-		# Create balls
-		self.allballs = pygame.sprite.Group((Ball(1), Ball(0)))
-		self.allsprites.add(self.allballs)
-
-		# Create bricks
-		self.allbricks = pygame.sprite.Group()
-		for y in range(8):
-			for x in range(21):
-				type = randint(0,3)
-				brick = Brick(type, x, y)
-				brick.add((self.allbricks, self.allsprites))
-
-		# Power ups
-		self.allpowerups = pygame.sprite.Group()
-
-	def eventHandle(self):
-		if self.gameControl.gameEvent.keystate[K_ESCAPE]:
-			self.gameControl.setMode (0)
-		return 0
-		
-	def update(self):
-		# Update all the sprite objects we've added to this comprehensive list
-		self.allsprites.update()
-
-		# If we're under the paddle
-		bottom = self.screenBoundary.bottom
-		for powerUp in self.allpowerups.sprites():
-			if powerUp.rect.bottom > bottom:
-				powerUp.kill()
-		for ball in self.allballs.sprites():
-			if ball.rect.bottom > bottom:
-				ball.kill()
-
-		# Check balls against blocks
-		collisiondict = pygame.sprite.groupcollide(self.allballs, self.allbricks, 0, 1)
-		for ball,bricks in collisiondict.items():
-			for brick in bricks:
-				ball.collide(brick)
-				self.bong_sound.play()
-				self.gameState.ScoreAdd (10)
-				# Randomly create a power up
-				if not randint(0, self.powerchance):
-					self.powerchance = len(self.allballs) * 2
-					center = brick.rect.center
-					powerUp = PowerUp(randint(0,1), randint(3,7), center[0], center[1])
-					powerUp.add((self.allpowerups, self.allsprites))
-				else:
-					self.powerchance = self.powerchance - 1
-
-		# Check balls against paddle
-		for ball in pygame.sprite.spritecollide(self.paddle, self.allballs, 0):
-			ball.collidePaddle(self.paddle)
-			self.bong_sound.play()
-			self.gameState.ScoreAdd(10)
-
-		# Check powerups against paddle
-		for powerUp in pygame.sprite.spritecollide(self.paddle, self.allpowerups, 1):
-			ball.collidePaddle(self.paddle)
-			self.bong_sound.play()
-			if powerUp.type == 1: # Double the balls
-				for ball in self.allballs.sprites():
-					newBall = Ball (ball.size, ball.rect.centerx, ball.rect.centery)
-					newBall.moveX = -ball.moveX
-					newBall.moveY = -ball.moveY
-					newBall.add((self.allballs, self.allsprites))
-			else: # Convert the balls
-				for ball in self.allballs.sprites():
-					ball.changeType()
-
-		# If all the balls are gone
-		if not self.allballs:
-			self.gameControl.setMode(0)	# Back to the main menu
-
-	def draw(self, background, screen):
-		#Draw Everything
-		screen.blit(background, (0, 0))
-		self.allsprites.draw(screen)
-		
-		# Draw score
-		textScore = self.fontScore.render(str(self.gameState.score), 1, (255, 255, 255))
-		textposScore = textScore.get_rect()
-		textposScore.bottom = background.get_rect().bottom - 5
-		textposScore.left = background.get_rect().left + 10
-		screen.blit(textScore, textposScore)
-
-		# Draw balls
-		textLives = self.fontLives.render(str(len(self.allballs)), 1, (255, 255, 255))
-		textposLives = textLives.get_rect()
-		textposLives.bottom = background.get_rect().bottom - 5
-		textposLives.right = background.get_rect().right - 10
-		screen.blit(textLives, textposLives)
-
-class MainMenuMode:
-	"""This handles all the main menu activities of quitting, or starting a game, checking high score"""
-	def __init__(self, gameControlObj, screenRect):
-		self.gameControl = gameControlObj	# Mode can change to another mode by itself
-		self.screenBoundary = screenRect
-		self.menuSelect = 0
-		self.menuMax = 3
-
-		# Create fonts
-		self.fontMenu = pygame.font.Font(None, 30)
-
-	def reset(self):
-		return
-
-	def eventHandle(self):
-		# Check for quit
-		if self.gameControl.gameEvent.keystate[K_ESCAPE]:
-			self.gameControl.setMode (-1)	# -1 is exit the game
-	
-		# Move selection up and down
-		if self.gameControl.gameEvent.newkeys[K_DOWN] and self.menuSelect < self.menuMax-1:
-			self.menuSelect = self.menuSelect + 1
-			
-		if self.gameControl.gameEvent.newkeys[K_UP] and self.menuSelect > 0:
-			self.menuSelect = self.menuSelect - 1
-		
-		# Process current selection
-		if self.gameControl.gameEvent.newkeys[K_RETURN]:
-			if self.menuSelect == 0:
-				self.gameControl.setMode (2)
-			if self.menuSelect == 1:
-				self.gameControl.setMode (1)
-			if self.menuSelect == 2:
-				self.gameControl.setMode (-1)	# -1 is exit the game
-		
-	def update(self):
-		return
-
-	def draw(self, background, screen):
-		#Draw Everything
-		screen.blit(background, (0, 0))
-		
-		# Draw options - New Game
-		color = (255, 255, 255)
-		if self.menuSelect == 0:
-			color = (0, 255, 0)
-		textMenu = self.fontMenu.render("New Game", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.bottom = background.get_rect().centery - textPosMenu.height
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-		lastBottom = textPosMenu.bottom
-
-		# Draw options - High Score
-		color = (255, 255, 255)
-		if self.menuSelect == 1:
-			color = (0, 255, 0)
-		textMenu = self.fontMenu.render("High Scores", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.top = lastBottom+10
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-		lastBottom = textPosMenu.bottom
-
-		# Draw options - Quit
-		color = (255, 255, 255)
-		if self.menuSelect == 2:
-			color = (0, 255, 0)
-		textMenu = self.fontMenu.render("Quit", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.top = lastBottom+10
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-
-class HighScoreMenuMode:
-	"""This handles all the main menu activities of quitting, or starting a game, checking high score"""
-	def __init__(self, gameControlObj, screenRect):
-		self.gameControl = gameControlObj	# Mode can change to another mode by itself
-		self.screenBoundary = screenRect
-
-		# Create fonts
-		self.fontMenu = pygame.font.Font(None, 30)
-
-	def reset(self):
-		return
-
-	def eventHandle(self):
-		# Quit on any keys
-		if self.gameControl.gameEvent.keystate[K_RETURN]:
-			self.gameControl.setMode (0)
-		if self.gameControl.gameEvent.keystate[K_SPACE]:
-			self.gameControl.setMode (0)
-		
-	def update(self):
-		return
-
-	def draw(self, background, screen):
-		#Draw Everything
-		screen.blit(background, (0, 0))
-		
-		# This could be more dynamic and function, but I dont really feel like it right now.
-		
-		# Draw options - New Game
-		color = (255, 255, 255)
-		textMenu = self.fontMenu.render("High Scores", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.bottom = background.get_rect().centery - textPosMenu.height
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-		lastBottom = textPosMenu.bottom
-
-		# Draw options - High Score
-		color = (255, 255, 255)
-		textMenu = self.fontMenu.render("----", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.top = lastBottom+10
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-		lastBottom = textPosMenu.bottom
-
-		# Draw options - Quit
-		color = (255, 255, 255)
-		textMenu = self.fontMenu.render("----", 1, color)
-		textPosMenu = textMenu.get_rect()
-		textPosMenu.top = lastBottom+10
-		textPosMenu.left = background.get_rect().centerx - textPosMenu.width/2
-		screen.blit(textMenu, textPosMenu)
-
-class GameEvent:
-	"""Event system wrapped so that it is based on time things were pressed.  
-		Otherwise repeats occur that we dont desire."""
-		
-	def __init__(self):
-		# Run update to init all the variables
-		self.keystate = None
-		self.update()
-
-	def update(self):
-		pygame.event.pump() #keep messages alive
-
-		# Get the key state
-		if self.keystate:
-			oldstate = self.keystate
-			self.keystate = pygame.key.get_pressed()
-			self.newkeys = map(lambda o,c: c and not o, oldstate, self.keystate)
-		else:
-			self.keystate = pygame.key.get_pressed()
-			self.newkeys = self.keystate
-
-		# Get the mouse data
-		self.mousePos = pygame.mouse.get_pos()
-		self.mouseButtons = pygame.mouse.get_pressed()
-
-	        # Get the time
-	        self.ticks = pygame.time.get_ticks()
-
-class GameControl:
-	"""This saves the state that the game is in: what mode we're in, etc.  
-		This is different than GameState because it deals with the play state."""
-	def __init__(self):
-		self.gameEvent = GameEvent()
-		self.modeCur = 0
-		self.modes = []
-		return
-		
-	def addMode(self, newMode):
-		"""Insert the new mode into the modes list"""
-		self.modes.insert (len(self.modes), newMode)
-		
-	def setMode(self, newMode):
-		"""Set the new mode, and reset it"""
-		self.modeCur = newMode
-		
-		# If we didn't set the mode to exit
-		if self.modeCur != -1:
-			self.modes[self.modeCur].reset()		
-
-	def update(self):
-		"""Update the current mode and events"""
-		self.gameEvent.update()
-		
-		if self.modeCur != -1:
-			self.modes[self.modeCur].eventHandle()
-			
-		if self.modeCur != -1:
-			self.modes[self.modeCur].update()
-
-	def draw(self, background, screen):
-		if self.modeCur != -1:
-			self.modes[self.modeCur].draw(background, screen)
-
-
-def main():
-	"""this function is called when the program starts.
-	   it initializes everything it needs, then runs in
-	   a loop until the function returns."""
-	   
-	#Initialize Everything
-	pygame.init()
-	screen = pygame.display.set_mode((640, 480))
-	pygame.display.set_caption('�berBall')
-	pygame.mouse.set_visible(0)
-	pygame.event.set_grab(1)
-	
-	#Create The Backgound
-	background = pygame.Surface(screen.get_size())
-	background = background.convert()
-	background.fill((0, 0, 0))
-	
-	#Put Text On The Background, Centered
-	if pygame.font:
-		font = pygame.font.Font(None, 36)
-		text = font.render("�berBall", 1, (255, 255, 255))
-		textpos = text.get_rect()
-		textpos.centerx = background.get_rect().centerx
-		background.blit(text, textpos)
-		lastBot = textpos.bottom
-		
-		font = pygame.font.Font(None, 20)
-		text = font.render("by Geoff Howland", 1, (255, 255, 255))
-		textpos = text.get_rect()
-		textpos.centerx = background.get_rect().centerx
-		textpos.top = lastBot + 10
-		background.blit(text, textpos)
-
-
-	# Create clock to lock framerate
-	clock = pygame.time.Clock()
-
-	# Create the game control object and add the game modes
-	gameControl = GameControl()
-	gameControl.addMode( MainMenuMode (gameControl, screen.get_rect()) )
-	gameControl.addMode( HighScoreMenuMode (gameControl, screen.get_rect()) )
-	gameControl.addMode( GameMode (gameControl, screen.get_rect()) )
-
-	# Main Loop
-	while 1:
-		# Lock the framerate
-		clock.tick(60)
-	
-		# Handle the modes
-		gameControl.update()
-		gameControl.draw(background, screen)
-
-		# Handle game exit
-		if gameControl.modeCur == -1:
-			return
-
-		# Flip to front
-		pygame.display.flip()
-
-
-#this calls the 'main' function when this script is executed
-if __name__ == '__main__': main()

File lib/sprite.py

 ##    pygame - Python Game Library
 ##    Copyright (C) 2000-2003  Pete Shinners
-##
+##              (C) 2004 Joe Wreschnig
 ##    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
 ## specific ones that aren't quite so general but fit into common
 ## specialized cases.
 
-
-import sys
-if sys.hexversion < 0x020200a1:
-    class object:
-        "null class for pre-python2.2 compatability"
-
-
-
 class Sprite(object):
     """the base class for your visible game objects.
        The sprite class is meant to be used as a base class
        or more groups. The kill() method simply removes this
        sprite from all groups."""
 
-    def __init__(self, group=()):
-        """__init__(group=())
-           initialize a sprite object
+    def __init__(self, *groups):
+        """initialize a sprite object
 
            You can initialize a sprite by passing it a
            group or sequence of groups to be contained in."""
-        self.__g = {}
-        self.add(group)
+        self.__g = {} # The groups the sprite is in
+        if groups: self.add(groups)
 
-    def add(self, group):
-        """add(group)
-           add a sprite to container
+    def add(self, *groups):
+        """add a sprite to container
 
            Add the sprite to a group or sequence of groups."""
         has = self.__g.has_key
-        if hasattr(group, '_spritegroup'):
-            if not has(group):
-                group.add_internal(self)
-                self.add_internal(group)
-        else:
-            groups = group
-            for group in groups:
+        for group in groups:
+            if hasattr(group, '_spritegroup'):
                 if not has(group):
                     group.add_internal(self)
                     self.add_internal(group)
+            else: self.add(*group)
 
-    def remove(self, group):
-        """remove(group)
-           remove a sprite from container
+    def remove(self, *groups):
+        """remove a sprite from container
 
            Remove the sprite from a group or sequence of groups."""
         has = self.__g.has_key
-        if hasattr(group, '_spritegroup'):
-            if has(group):
-                group.remove_internal(self)
-                self.remove_internal(g)
-        else:
-            for g in group:
-                if has(g):
-                    g.remove_internal(self)
-                    self.remove_internal(g)
+        for group in groups:
+            if hasattr(group, '_spritegroup'):
+                if has(group):
+                    group.remove_internal(self)
+                    self.remove_internal(group)
+            else: self.remove(*group)
 
     def add_internal(self, group):
         self.__g[group] = 0
         pass
 
     def kill(self):
-        """kill()
-           end life of sprite, remove from all groups
+        """end life of sprite, remove from all groups
 
            Removes the sprite from all the groups that contain
            it. The sprite is still fine after calling this kill()
         self.__g.clear()
 
     def groups(self):
-        """groups() -> list
-           list used sprite containers
+        """list used sprite containers
 
            Returns a list of all the groups that contain this
            sprite."""
         return self.__g.keys()
 
     def alive(self):
-        """alive() -> bool
-           ask the life of a sprite
+        """ask the life of a sprite
 
            Returns true if this sprite is a member of any groups."""
-        return len(self.__g)
+        return (len(self.__g) != 0)
 
     def __repr__(self):
         return "<%s sprite(in %d groups)>" % (self.__class__.__name__, len(self.__g))
 
+class AbstractGroup(object):
+    # dummy val to identify sprite groups, and avoid infinite recursion.
+    _spritegroup = True
 
-
-class Group(object):
-    """the Group class is a container for sprites
-       This is the base sprite group class. It does everything
-       needed to behave as a normal group. You can easily inherit
-       a new group class from this if you want to add more features."""
-    _spritegroup = 1 #dummy val to identify sprite groups
-
-    def __init__(self, sprite=()):
-        """__init__(sprite=())
-           instance a Group
-
-           You can initialize a group by passing it a
-           sprite or sequence of sprites to be contained."""
+    def __init__(self):
         self.spritedict = {}
-        if sprite:
-            self.add(sprite)
-
-    def copy(self):
-        """copy() -> Group
-           copy a group with all the same sprites
-
-           Returns a copy of the group that is the same class
-           type, and has the same contained sprites."""
-        return self.__class__(self.spritedict.keys())
+        self.lostsprites = []
 
     def sprites(self):
-        """sprites() -> iterator
-           return an object to loop over each sprite
-
-           Returns an object that can be looped over with
-           a 'for' loop. (For now it is always a list, but
-           newer version of python could return different
-           objects, like iterators.)
-
-           Group is now a python iterator itself, easier to
-           loop over sprites like that."""
         return self.spritedict.keys()
 
-    def __iter__(self):
-        return iter(self.spritedict.iterkeys())
-
-    def add(self, sprite):
-        """add(sprite)
-           add sprite to group
-
-           Add a sprite or sequence of sprites to a group."""
-        has = self.spritedict.has_key
-        if hasattr(sprite, '_spritegroup'):
-            for sprite in sprite.sprites():
-                if not has(sprite):
-                    self.spritedict[sprite] = 0
-                    sprite.add_internal(self)
-        else:
-            try: len(sprite) #see if its a sequence
-            except (TypeError, AttributeError):
-                if not has(sprite):
-                        self.spritedict[sprite] = 0
-                        sprite.add_internal(self)
-            else:
-                for sprite in sprite:
-                    if not has(sprite):
-                        self.spritedict[sprite] = 0
-                        sprite.add_internal(self)
-
-    def remove(self, sprite):
-        """remove(sprite)
-           remove sprite from group
-
-           Remove a sprite or sequence of sprites from a group."""
-        has = self.spritedict.has_key
-        if hasattr(sprite, '_spritegroup'):
-            for sprite in sprite.sprites():
-                if has(sprite):
-                    self.remove_internal(sprite)
-                    sprite.remove_internal(self)
-        else:
-            try: len(sprite) #see if its a sequence
-            except (TypeError, AttributeError):
-                if has(sprite):
-                    self.remove_internal(sprite)
-                    sprite.remove_internal(self)
-            else:
-                for sprite in sprite:
-                    if has(sprite):
-                        self.remove_internal(sprite)
-                        sprite.remove_internal(self)
-
     def add_internal(self, sprite):
         self.spritedict[sprite] = 0
 
     def remove_internal(self, sprite):
-        del self.spritedict[sprite]
+        r = self.spritedict[sprite]
+        if r != 0:
+            self.lostsprites.append(r)
+        del(self.spritedict[sprite])
 
-    def has(self, sprite):
-        """has(sprite) -> bool
-           ask if group has sprite
+    def has_internal(self, sprite):
+        return self.spritedict.has_key(sprite)
+
+    def copy(self):
+        """copy a group with all the same sprites
+
+           Returns a copy of the group that is the same class
+           type, and has the same contained sprites."""
+        return self.__class__(self.sprites())
+
+    def __iter__(self):
+        return iter(self.sprites())
+
+    def __contains__(self, sprite):
+        return self.has(sprite)
+
+    def add(self, *sprites):
+        """add sprite to group
+
+           Add a sprite or sequence of sprites to a group."""
+        for sprite in sprites:
+            # It's possible that some sprite is also an iterator.
+            # If this is the case, we should add the sprite itself,
+            # and not the objects it iterates over.
+            if isinstance(sprite, Sprite):
+                if not self.has_internal(sprite):
+                    self.add_internal(sprite)
+                    sprite.add_internal(self)
+            try:
+                # See if sprite is an iterator, like a list or sprite
+                # group.
+                for spr in sprite:
+                    self.add(spr)
+            except (TypeError, AttributeError):
+                # Not iterable, this is probably a sprite that happens
+                # to not subclass Sprite. Alternately, it could be an
+                # old-style sprite group.
+                if hasattr(sprite, '_spritegroup'):
+                    for spr in sprite.sprites():
+                        if not self.has_internal(spr):
+                            self.add_internal(spr)
+                            spr.add_internal(self)
+                elif not self.has_internal(sprite):
+                    self.add_internal(sprite)
+                    sprite.add_internal(self)
+
+    def remove(self, *sprites):
+        """remove sprite from group
+
+           Remove a sprite or sequence of sprites from a group."""
+        # This function behaves essentially the same as Group.add.
+        # Check for Spritehood, check for iterability, check for
+        # old-style sprite group, and fall back to assuming
+        # spritehood.
+        for sprite in sprites:
+            if isinstance(sprite, Sprite):
+                if not self.has_internal(sprite):
+                    self.remove_internal(sprite)
+                    sprite.remove_internal(self)
+            try:
+                for spr in sprite: self.add(spr)
+            except (TypeError, AttributeError):
+                if hasattr(sprite, '_spritegroup'):
+                    for spr in sprite.sprites():
+                        if not self.has_internal(spr):
+                            self.add_internal(spr)
+                            spr.remove_internal(self)
+                elif not self.has_internal(sprite):
+                    self.add_internal(sprite)
+                    sprite.add_internal(self)
+
+    def has(self, *sprites):
+        """ask if group has a sprite or sprites
 
            Returns true if the given sprite or sprites are
            contained in the group"""
+        # Again, this follows the basic pattern of Group.add and
+        # Group.remove.
         has = self.spritedict.has_key
-        if hasattr(sprite, '_spritegroup'):
-            for sprite in sprite.sprites():
-                if not has(sprite):
-                    return 0
-        else:
-            try: len(sprite) #see if its a sequence
+        for sprite in sprites:
+            if isinstance(sprite, Sprite):
+                return self.has_internal(sprite)
+            try:
+                for spr in sprite:
+                    if not self.has(sprite):
+                        return False
+                    return True
             except (TypeError, AttributeError):
-                return has(sprite)
-            else:
-                for sprite in sprite:
-                    if not has(sprite):
-                        return 0
-        return 1
-
-        if hasattr(sprite, '_spritegroup'):
-            return sprite in has(sprite)
-        sprites = sprite
-        for sprite in sprites:
-            if not has(sprite):
-                return 0
-        return 1
-
-    def empty(self):
-        """empty()
-           remove all sprites
-
-           Removes all the sprites from the group."""
-        for s in self.spritedict.keys():
-            self.remove_internal(s)
-            s.remove_internal(self)
-        self.spritedict.clear()
+                if hasattr(sprite, '_spritegroup'):
+                    for spr in sprite.sprites():
+                        if not self.has_internal(spr):
+                            return False
+                        return True
+                elif not has(sprite):
+                    return False
+        return True
 
     def update(self, *args):
-        """update(...)
-           call update for all member sprites
+        """call update for all member sprites
 
            calls the update method for all sprites in the group.
            Passes all arguments on to the Sprite update function."""
-        if args:
-            for s in self.spritedict.keys():
-                s.update(*args)
-        else:
-            for s in self.spritedict.keys():
-                s.update()
-
-
-    def __nonzero__(self):
-        """__nonzero__() -> bool
-           ask if group is empty
-
-           Returns true if the group has any sprites. This
-           lets you check if the group has any sprites by
-           using it in a logical if statement."""
-        return len(self.spritedict)
-
-    def __len__(self):
-        """__len__() -> int
-           number of sprites in group
-
-           Returns the number of sprites contained in the group."""
-        return len(self.spritedict)
-
-    def __repr__(self):
-        return "<%s(%d sprites)>" % (self.__class__.__name__, len(self))
-
-##note that this GroupSingle class is not derived from any other
-##group class, it can make as a good example if you ever want to
-##create your own new group type.
-
-class GroupSingle(object):
-    """a group container that holds a single most recent item
-       This class works just like a regular group, but it only
-       keeps a single sprite in the group. Whatever sprite has
-       been added to the group last, will be the only sprite in
-       the group."""
-    _spritegroup = 1 #dummy val to identify groups
-
-    def __init__(self, sprite=()):
-        self.sprite = 0
-        self.add(sprite)
-
-    def copy(self):
-        if self.sprite is not 0:
-            return GroupSingle(self.sprite)
-        return GroupSingle()
-
-    def sprites(self):
-        if self.sprite is not 0:
-            return [self.sprite]
-        return []
-
-    def __iter__(self):
-        if self.sprite:
-            return iter((self.sprite,))
-        else:
-            return iter(())
-
-    def add(self, sprite):
-        if hasattr(sprite, '_spritegroup'):
-            for sprite in sprite.sprites(): pass
-        else:
-            try:
-                if not len(sprite): return #see if its a sequence
-                sprite = sprite[-1]
-            except (TypeError, AttributeError): pass
-        if sprite is not self.sprite:
-            self.add_internal(sprite)
-            sprite.add_internal(self)
-
-    def remove(self, sprite):
-        if hasattr(sprite, '_spritegroup'):
-            for sprite in sprite.sprites():
-                if self.sprite is sprite:
-                    self.sprite = 0
-                    sprite.remove_internal(self)
-                    break
-        else:
-            try:
-                if not len(sprite): return #see if its a sequence
-            except (TypeError, AttributeError):
-                if self.sprite is sprite:
-                    self.sprite = 0
-                    sprite.remove_internal(self)
-            else:
-                for sprite in sprite:
-                    if self.sprite is sprite:
-                        self.sprite = 0
-                        sprite.remove_internal(self)
-                        break
-
-    def add_internal(self, sprite):
-        if self.sprite is not 0:
-            self.sprite.remove_internal(self)
-        self.sprite = sprite
-
-    def remove_internal(self, sprite):
-        self.sprite = 0
-
-    def has(self, sprite):
-        return self.sprite is sprite
-
-    def empty(self):
-        if self.sprite is not 0:
-            self.sprite.remove_internal(self)
-            self.sprite = 0
-
-    def update(self, *args):
-        if self.sprite:
-            self.sprite.update(*args)
-
-    def __nonzero__(self):
-        return self.sprite is not 0
-
-    def __len__(self):
-        return self.sprite is not 0
-
-    def __repr__(self):
-        return "<%s(%d sprites)>" % (self.__class__.__name__, len(self))
-
-
-##these render groups are derived from the normal Group
-##class, they just add methods. the Updates and Clear versions
-##of drawing are more complex groups. They keep track of sprites
-##that have been drawn but are removed, and also keep track of
-##drawing info from each sprite, by storing it in the dictionary
-##values used to store the sprite. very sneaky, but a great
-##example for you if you ever need your own group class that
-##maintains its own data along with each sprite it holds.
-
-class RenderPlain(Group):
-    """a sprite group that can draw all its sprites
-       The RenderPlain group is just like a normal group,
-       it just adds a "draw" method. Any sprites used with
-       this group to draw must contain two member elements
-       named "image" and "rect". These are a pygame Surface
-       and Rect object that are passed to blit."""
+        for s in self.sprites(): s.update(*args)
 
     def draw(self, surface):
         """draw(surface)
-           draw all sprites onto a surface
+           draw all sprites onto the surface
 
            Draws all the sprites onto the given surface."""
-        spritedict = self.spritedict
+        sprites = self.sprites()
         surface_blit = surface.blit
-        for s in spritedict.keys():
-            surface_blit(s.image, s.rect)
-
-
-
-class RenderClear(Group):
-    """a group container that can draw and clear its sprites
-       The RenderClear group is just like a normal group,
-       but it can draw and clear the sprites. Any sprites
-       used in this group must contain member elements
-       named "image" and "rect". These are a pygame Surface
-       and Rect, which are passed to a blit call."""
-    def __init__(self, sprite=()):
-        Group.__init__(self, sprite)
-        self.lostsprites = []
-
-    def remove_internal(self, sprite):
-        r = self.spritedict[sprite]
-        if r is not 0:
-            self.lostsprites.append(r)
-        del self.spritedict[sprite]
-
-    def draw(self, surface):
-        """draw(surface)
-           draw all sprites onto a surface
-
-           Draws all the sprites onto the given surface."""
-        spritedict = self.spritedict
-        surface_blit = surface.blit
-        for s in spritedict.keys():
-            spritedict[s] = surface_blit(s.image, s.rect)
+        for spr in sprites:
+            self.spritedict[spr] = surface_blit(spr.image, spr.rect)
         self.lostsprites = []
 
     def clear(self, surface, bgd):
             for r in self.spritedict.values():
                 if r is not 0: surface_blit(bgd, r, r)
 
+    def empty(self):
+        """remove all sprites
 
+           Removes all the sprites from the group."""
+        # NOTE! This means self.sprites() can't return any internal
+        # sprite list itself, it must be a copy. Besides it being normally
+        # unsafe, doing so will cause this function to fail.
+        for s in self.sprites():
+            self.remove_internal(s)
+            s.remove_internal(self)
 
-class RenderUpdates(RenderClear):
-    """a sprite group that can draw and clear with update rectangles
-       The RenderUpdates is derived from the RenderClear group
-       and keeps track of all the areas drawn and cleared. It
-       also smartly handles overlapping areas between where a
-       sprite was drawn and cleared when generating the update
-       rectangles."""
+    def __nonzero__(self):
+        """ask if group is empty
 
-    def draw(self, surface):
-        """draw(surface)
-           draw all sprites onto the surface
+           Returns true if the group has any sprites. This
+           lets you check if the group has any sprites by
+           using it in a logical if statement."""
+        return (len(self.sprites()) == 0)
 
-           Draws all the sprites onto the given surface. It
-           returns a list of rectangles, which should be passed
-           to pygame.display.update()"""
-        spritedict = self.spritedict
-        surface_blit = surface.blit
-        dirty = self.lostsprites
-        self.lostsprites = []
-        dirty_append = dirty.append
-        for s, r in spritedict.items():
-            newrect = surface_blit(s.image, s.rect)
-            if r is 0:
-                dirty_append(newrect)
-            else:
-                if newrect.colliderect(r):
-                    dirty_append(newrect.union(r))
-                else:
-                    dirty_append(newrect)
-                    dirty_append(r)
-            spritedict[s] = newrect
-        return dirty
+    def __len__(self):
+        """__len__() -> int
+           number of sprites in group
 
+           Returns the number of sprites contained in the group."""
+        return len(self.sprites())
+
+    def __repr__(self):
+        return "<%s(%d sprites)>" % (self.__class__.__name__, len(self))
+
+class Group(AbstractGroup):
+    """the Group class is a container for sprites
+       This is the base sprite group class. It does everything
+       needed to behave as a normal group. You can easily inherit
+       a new group class from this if you want to add more features."""
+
+    def __init__(self, *sprites):
+        """instantiate a Group
+
+           You can initialize a group by passing it a sprite, many sprites,
+           or sequencs of sprites (or any combination of sprites and sequences
+           of sprites)."""
+        AbstractGroup.__init__(self)
+        self.add(*sprites)
+
+RenderPlain = Group
+RenderClear = Group
+
+class RenderUpdates(Group):
+   def draw(self, surface):
+       spritedict = self.spritedict
+       surface_blit = surface.blit
+       dirty = self.lostsprites
+       self.lostsprites = []
+       dirty_append = dirty.append
+       for s in self.sprites():
+           r = spritedict[s]
+           newrect = surface_blit(s.image, s.rect)
+           if r is 0:
+               dirty_append(newrect)
+           else:
+               if newrect.colliderect(r):
+                   dirty_append(newrect.union(r))
+               else:
+                   dirty_append(newrect)
+                   dirty_append(r)
+           spritedict[s] = newrect
+       return dirty
+
+class OrderedUpdates(RenderUpdates):
+    def __init__(self, *sprites):
+        self._spritelist = []
+        RenderUpdates.__init__(self, *sprites)
+
+    def sprites(self): return list(self._spritelist)
+
+    def add_internal(self, sprite):
+        RenderUpdates.add_internal(self, sprite)
+        self._spritelist.append(sprite)
+
+    def remove_internal(self, sprite):
+        RenderUpdates.remove_internal(self, sprite)
+        self._spritelist.remove(sprite)
+
+class GroupSingle(AbstractGroup):
+    """a group container that holds a single most recent item
+       This class works just like a regular group, but it only
+       keeps a single sprite in the group. Whatever sprite has
+       been added to the group last, will be the only sprite in
+       the group."""
+
+    def __init__(self, sprite = None):
+        self.__sprite = None
+        if sprite is not None: self.add(sprite)
+
+    def copy(self):
+        return GroupSingle(self._sprite)
+
+    def sprites(self):
+        if self.__sprite is not None: return [self.__sprite]
+        else: return []
+
+    def add_internal(self, sprite):
+        if self.__sprite is not None:
+            self.__sprite.remove_internal(self)
+        self.__sprite = sprite
+
+    def _get_sprite(self):
+        return self.__sprite
+
+    def _set_sprite(self, sprite):
+        sprite.add_internal(self)
+        self.add_internal(sprite)
+        return sprite
+
+    sprite = property(_get_sprite, _set_sprite, None,
+                      "The sprite contained in this group")
+
+    def remove_internal(self, sprite):
+        self.__sprite = None
+
+    def has_internal(self, sprite):
+        return (self.__sprite is sprite)
+
+    # Optimizations...
+    def __contains__(self, sprite): return (self.__sprite is sprite)
 
 def spritecollide(sprite, group, dokill):
     """pygame.sprite.spritecollide(sprite, group, dokill) -> list
                 crashed.append(s)
     return crashed
 
-
 def groupcollide(groupa, groupb, dokilla, dokillb):
     """pygame.sprite.groupcollide(groupa, groupb, dokilla, dokillb) -> dict
        collision detection between group and group
                 crashed[s] = c
     return crashed
 
-
 def spritecollideany(sprite, group):
     """pygame.sprite.spritecollideany(sprite, group) -> sprite
        finds any sprites that collide
 		case SIGQUIT:
 			signaltype = "(pygame parachute) Keyboard Abort"; break;
 #endif
-#ifdef SIGPIPE
-		case SIGPIPE:
-			signaltype = "(pygame parachute) Broken Pipe"; break;
-#endif
 		default:
 			signaltype = "(pygame parachute) Unknown Signal"; break;
 	}
 #ifdef SIGQUIT
 	SIGQUIT,
 #endif
-#if 0 /*lets disable sigpipe for now, games are likely not piping*/
-#ifdef SIGPIPE
-	SIGPIPE,
-#endif
-#endif
 	0 /*end of list*/
 };
 
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+#if 0
+/*movie module methods*/
+
+
+static PyObject* gomovie(PyObject* self, PyObject* arg)
+{
+	char* name = NULL;
+        FFMovie *movie;
+        int finished;
+	if(!PyArg_ParseTuple(arg, "s", &name))
+		return NULL;
+
+//        Py_BEGIN_ALLOW_THREADS
+
+        av_register_all();
+        movie = ffmovie_open(name, SDL_GetVideoSurface());
+
+    finished = 0;
+    while(!finished) {
+        SDL_Event event;
+        SDL_WaitEvent(&event);
+        switch(event.type) {
+        case SDL_KEYDOWN:
+            switch(event.key.keysym.sym) {
+            case SDLK_ESCAPE:
+            case SDLK_q:
+                ffmovie_close(movie);
+                finished = 1;
+                break;
+            case SDLK_p:
+            case SDLK_SPACE:
+                ffmovie_pause(movie);
+                break;
+            default:
+                break;
+            }
+            break;
+        }
+    }
+
+
+//        Py_END_ALLOW_THREADS
+	RETURN_NONE;
+}
+
+
+#if 0
+static PyObject* movie_getbusy(PyObject* self, PyObject* arg)
+{
+    return PyInt_FromLong(
+}
+
+
+#endif
+
+
+
+
+
+
+PYGAME_EXPORT
+void initffmovie(void)
+{
+	PyObject *module, *dict;
+
+//	PyType_Init(PyMovie_Type);
+
+	/* create the module */
+	module = Py_InitModule3("ffmovie", mixer_builtins, "ffmovie");
+	dict = PyModule_GetDict(module);
+
+
+	/*imported needed apis*/
+	import_pygame_base();
+//	import_pygame_surface();
+//	import_pygame_rwobject();
+//	import_pygame_rect();
+}
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 static PyMethodDef mixer_builtins[] =
 {
 	{ "Movie", Movie, 1, doc_Movie },