#!/usr/bin/python
############
# Load_Image.py 
# This is a function that can be 
# used to load an image using Pygame 
############ 

import os, sys
import pygame
from pygame.locals import *

def load_image(name, colorkey=None):

	fullname = os.path.join('data', name)
	try:
		Image=pygame.image.load(fullname)
	except pygame.error, message:
		print 'Cannot load:', name
		raise SystemExit, message
	image=image.convert()
	if colorkey is not None:
		if colorkey is -1:
			colorkey = image.get_at((0,0))
		image.set_colorkey(colorkey, RLEACCEL)
	return image, image.get_rect()



