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_levels = False
In games which do not have levels, this should be false. It is redefined as true when you use an HLShell.
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.

intro_screen = None
Optional. An Albow Screen object providing an introductory screen for your game. It is shown when beginning to play a new game.
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_intro_screen()
Switches to the introductory screen, if any.
show_play_screen()
Switches to the playing area screen, if any.

game_completed(result)
This method is called when the game is completed. By default, it simply switches to the main menu screen, but you can override it to take some other action such as showing a completion screen. It is passed the value returned by the game object's game_is_completed() method; you can use this to distinguish between different completion states, such as winning or losing.
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.

save_game_as_cmd()
Implementation of the "Save Game As..." 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 is expected to be a saved game file.
restore_game(path)
Restores a saved game from the specified file. If an error occurs, it is reported to the user.
ask_save()
Gives the user the chance to save any unsaved game progress. Reports errors to the user. Raises Cancel if cancelled or an error occurs.
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.
---