class hshell.HShell(albow.shell.Shell)

HShell is a subclass of the Albow Shell class providing the default user interface of a Humerus game.

Class Attributes

You can either define these as class attributes in your HShell subclass, or assign them as instance attributes during initialization.
game_title
The title of your game, for displaying to users.
has_level_editor = False
In games which do not have a built-in level editor, this should be false. It is redefined as true when you use an HEShell.

Attributes

about_screen = None
Optional. An Albow Screen object providing an "About" screen for your game.
main_menu_screen = None
Optional. A MainMenuScreen (or other Screen object) implementing your game's main menu,
play_screen = None
Optional. An Albow Screen object providing the playing area for your game.

Constructor

HShell(game, options)
Attaches the HShell to the specified game (an HGame or subclass) and options (an Options instance or subclass).

Abstract Methods

default_startup()
This is called when the game is started with no filename argument. By default, it shows the main menu screen. You can override it to customize the way the game starts up when not restoring a saved game.
screen_runs_game(screen)
Returns true if the game should run while the given screen is active. The default implementation returns true for the play_screen and false for any others.

Methods

run()
Handles any command line options and then enters the main event loop. Retains control until the user quits.
show_screen(screen)
Switches to the given screen, or if it is None, does nothing.
show_about_screen()
Switches to the "About" screen, if any.
show_main_menu_screen()
Switches to the main menu screen, if any.
show_play_screen()
Switches to the playing area screen, if any.
The following methods implement the commands found on the default main menu screen. You may also want to call them yourself if you provide other ways of invoking these commands.
about_cmd()
Implementation of the "About" menu command.
new_game_cmd()
Implementation of the "New Game" menu command.
load_game_cmd()
Implementation of the "Load Game" menu command.
save_game_cmd()
Implementation of the "Save Game" menu command.
resume_game_cmd()
Implementation of the "Resume Game" command. Switches to the playing screen if a level is being played.
restart_level_cmd()
Implementation of the "Restart Level" command.
open_level_set_cmd()
Implementation of the "Play Custom Levels" menu command.
quit_cmd()
Implementation of the "Quit" menu command. 
You probably won't need to call or override the following methods.
load_file(path)
Loads the specified file, which may be either a level file, a level set, or a saved game file. If it is a level file, loads the level and starts playing it. If it is a level set, loads and starts the first level from it. If it is a saved game, restores the game.
load_game_file(path)
Restores a saved game from the specified file. If an error occurs, it is reported to the user. Returns true if successful.
load_level_file(path)
Loads the specified level file. If an error occurs, it is reported to the user. Returns true if successful.
load_level_set(path)
Makes the specified directory the current level set and loads the first level. If an error occurs, it is reported to the user. Returns true if successful.
load_next_uncompleted_level()
Loads the next uncompleted level. If there are no more levels, sets game.level to None. If an error occurs, it is reported to the user. Returns true if successful.
ask_save()
Asks whether to save any unsaved game progress. Reports errors to the user. Returns true unless cancelled or an error occured.
begin_frame()
Calls the begin_frame() method of the current screen. Also, if the screen is one such that the game should run while it is active, calls the begin_frame() method of the game object.
---