Debian Codegraph @

scripts/schedules/control.py

raw symbols SCIP
1 #
2 # $Id$
3 #
4 # (C) Copyright 2001/2002 Kai Sterker <[email protected]>
5 # Part of the Adonthell Project http://adonthell.linuxgames.com
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY.
11 #
12 # See the COPYING file for more details
13 #
14
15 from adonthell import *
16
17 class control(object):
18
19 def run (self):
20 # -- bring up the main menu
21 if input_has_been_pushed (SDLK_ESCAPE):
22 import main_menu
23
24 # -- create main menu without animation,
25 # with saving and background enabled
26 menu = main_menu.main_menu (True, True, True)
27
28 # -- Stop updating the player
29 gamedata_player ().set_schedule_active (False)
30 gamedata_engine ().set_control_active (False)
31
32 # -- open the main menu
33 gamedata_engine ().main (menu, "game_menu")
34
35 # -- main menu closed -> see what to do
36 if menu.get_result () == 6:
37 # -- quit the game
38 gamedata_engine ().main_quit ()
39 else:
40 # -- continue
41 gamedata_player ().set_schedule_active (True)
42 gamedata_engine ().set_control_active (True)
43
44 win_container.__del__ (menu)
45
46
47 # -- shortcut to the load screen
48 elif input_has_been_pushed (SDLK_l):
49 s = data_screen (LOAD_SCREEN)
50 s.set_activate (True)
51
52 # -- Stop updating the player
53 gamedata_player ().set_schedule_active (False)
54 gamedata_engine ().set_control_active (False)
55
56 # -- open the load screen
57 gamedata_engine ().main (s, "load_screen")
58
59 # -- continue
60 gamedata_player ().set_schedule_active (True)
61 gamedata_engine ().set_control_active (True)
62
63
64 # -- and to the save screen
65 elif input_has_been_pushed (SDLK_s):
66 s = data_screen (SAVE_SCREEN)
67 s.set_activate (True)
68
69 # -- Stop updating the player
70 gamedata_player ().set_schedule_active (False)
71 gamedata_engine ().set_control_active (False)
72
73 # -- open the save screen
74 gamedata_engine ().main (s, "save_screen")
75
76 # -- continue
77 gamedata_player ().set_schedule_active (True)
78 gamedata_engine ().set_control_active (True)
79
80
81 # -- python console
82 elif input_has_been_pushed (SDLK_TAB):
83 import console
84
85 c = console.console (globals ())
86 c.set_activate (True)
87
88 # -- Stop updating the player
89 gamedata_player ().set_schedule_active (False)
90 gamedata_engine ().set_control_active (False)
91
92 # -- open the console
93 gamedata_engine ().main (c, "console")
94
95 # -- continue
96 gamedata_player ().set_schedule_active (True)
97 gamedata_engine ().set_control_active (True)