view atc.py @ 7:6311b69deba6

Include version number committer: Jeff Sipek <jeffpc@jeff.(none)> 1120698565 -0400
author Jeff Sipek <jeffpc@jeff.(none)>
date Thu, 07 Jul 2005 01:09:25 -0400
parents f346ce878117
children 7bb4cd2fa1bc
line wrap: on
line source

#!/usr/bin/python

#/*
# * ATC - Air Traffic Controller simulation game
# *
# * Copyright (C) 2004 Josef "Jeff" Sipek <jeffpc@optonline.net>
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# *
# * @(#) %M% %I% %E% %U%
# */

version = "0.10-pre1"

try:
	import sys
	import threading
	import pygame
	
	import atc_colors
	import atc_utils
	import atc_plane
	import atc_message
	
	import atc_single
except ImportError, err:
	print "Couldn't load module %s" % (err)
	sys.exit()

size = width, height = 800, 600

def main():
	""" Main fn to run the main thread """
	
	# Init
	pygame.init()
	screen = pygame.display.set_mode(size)
	pygame.display.set_caption('Air Traffic Controller (' + version + ')')
	
	# background music
	pygame.mixer.init()
	#atc_utils.playmusic("some.mp3");

	# Set background
	background = pygame.Surface(screen.get_size()).convert()
	background.fill(atc_colors.black)
	
	(splash_image, splash_rect) = atc_utils.load_png('data/image/splash.png')
	background.blit(splash_image, (0, 0))

	#blit!
	screen.blit(background, (0, 0))
	pygame.display.flip()

	optsel = 0
	menustr = ('single', 'multi', 'quit')
	
	while 1:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				sys.exit()
			if event.type == pygame.KEYDOWN:
				if event.key == pygame.K_UP:
					optsel = (optsel + 2) % 3
				if event.key == pygame.K_DOWN:
					optsel = (optsel + 1) % 3
				if event.key == pygame.K_RETURN:
					optsel = optsel | 0x10
				if optsel == 0x12:
					sys.exit()
		
		screen.blit(background, (0, 0))
		
		(menu_img, menu_rect) = atc_utils.load_png('data/image/menu_' + menustr[optsel & 3] + '.png')
		screen.blit(menu_img, (200, 200))
		
		pygame.display.flip()
		
		if (optsel & 0x10):
			optsel = optsel & 3
			if (optsel == 0): # single player
				atc_single.single(screen)
			if (optsel == 1): # multi player
				pass

if (__name__ == '__main__'):
	main()