1 from pyglet
.window
import Window
,key
2 from pyglet
.gl
.gl
import *
14 def __init__ (self
, cfg
):
15 Window
.__init
__ (self
,
16 fullscreen
= cfg
['window.fullscreen'] != 'false')
18 from level
import level
19 self
.menu
= menu (self
)
20 self
.lvl
= level (cfg
)
24 More keypress stuff goes here. For example a key
25 to bring up the overlay, relay key events to the
26 game-in-progress, etc.
28 def on_key_press(self
,symbol
,mod
):
29 if symbol
== key
.ESCAPE
:
31 elif symbol
== key
.ASCIITILDE
:
32 self
.menu
.active
= not self
.menu
.active
33 elif self
.menu
.active
:
34 self
.menu
.handleKey (symbol
)
37 Resize events should be propegated to the level, so it knows that the
38 view size has changed.
41 #def on_resize(self, size, ):
46 Routine to shutdown the game.
53 Bring up the overlay for the game, including
54 save-game,load-game, exit, options, and anything
55 else that may be needed.
58 def show_overlay (self
):
65 glBindTexture (GL_TEXTURE_2D
, 0)
66 glBegin (GL_TRIANGLE_STRIP
)
67 glColor4d (0, 0, 0, 0.5)
76 glOrtho (-self
.width
/ 2,
79 self
.height
/ 2, -1, 1)
86 This should most likely disconnect the 'time' handler
87 from the 'time' events. This way the game doesn't know that
91 def pause_game (self
):