comparison gamelib/main.py @ 6:c0abad23a055

Add start, quit and toggle fullscreen buttons to menu.
author Simon Cross <hodgestar@gmail.com>
date Sun, 30 Aug 2009 13:25:04 +0000
parents 67b79658b047
children 99c4f2226314
comparison
equal deleted inserted replaced
5:67b79658b047 6:c0abad23a055
6 package. 6 package.
7 ''' 7 '''
8 8
9 import pygame 9 import pygame
10 from pgu import gui 10 from pgu import gui
11 from pygame.locals import SWSURFACE, QUIT, KEYDOWN, K_ESCAPE 11 from pygame.locals import SWSURFACE, QUIT, KEYDOWN, K_ESCAPE, USEREVENT
12 12
13 from mainmenu import MainMenu 13 from mainmenu import MainMenu
14 import constants 14 import constants
15 15
16 def gameloop(screen, app): 16 def gameloop(screen, app):
21 for e in pygame.event.get(): 21 for e in pygame.event.get():
22 if e.type is QUIT: 22 if e.type is QUIT:
23 done = True 23 done = True
24 elif e.type is KEYDOWN and e.key == K_ESCAPE: 24 elif e.type is KEYDOWN and e.key == K_ESCAPE:
25 done = True 25 done = True
26 elif e.type is USEREVENT:
27 print e.event
26 else: 28 else:
27 app.event(e) 29 app.event(e)
28 30
29 # Clear the screen and render the stars 31 # Clear the screen and render the stars
30 dt = clock.tick()/1000.0 32 dt = clock.tick()/1000.0