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