view atc_utils.py @ 0:919a9eff76a3

Initial import
author Josef "Jeff" Sipek <jeffpc@optonline.net>
date Thu, 07 Jul 2005 01:00:05 +0000
parents
children 4c7bb645fd75
line wrap: on
line source

import pygame
import os
from math import *

def load_png(name):
	""" Load image and return image object"""
	fullname = os.path.join('data', name)
	try:
		image = pygame.image.load(fullname)
		if image.get_alpha() is None:
			image = image.convert()
		else:
			image = image.convert_alpha()
	except pygame.error, message:
        	print 'Cannot load image:', fullname
        	raise SystemExit, message
	return image, image.get_rect()

def todeg(rad):
	""" Convert radians to degrees """
	return rad*180.0/pi