blob: dd4ffff10e7f860242223c09f5710fb2289b6daa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#! /usr/bin/env python
import os, sys
import pygame
from pygame.locals import *
def load_image(name, colorkey=None):
fullname = os.path.join('data')
fullname = os.path.join(fullname, name)
try:
image = pygame.image.load(fullname)
except pygame.error, message:
print 'Cannot load image:', fullname
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()
|