Index

Package: Games

Description

package Games is

Classes

Game (abstract)

type Game is abstract new Limited_Object and
                              Event_Listener and
                              Game_State and
                              Process with private;

Ancestors:

Immediate Children:

Games.Keen.Keen_Game

Primitive operations:

Add_Event_Listeners
Construct (overriding Objects.Construct)
Delete (overriding Objects.Delete)
End_Game
Events.Listeners.To_String (Inherited)
Get_Process_Name (overriding Processes.Get_Process_Name)
Handle_Event (overriding Events.Listeners.Handle_Event)
New_Game
Objects.To_String (Inherited)
Pause
Remove_Event_Listeners
Tick (overriding Processes.Tick)
The Game class is parent object in the Game Logic system, which is responsible for managing the game session and all the interactions between entities during gameplay. The Game provides a Process_Manager to run the game logic, a Corral to receive events sent to listeners in the game logic, an association of modifyable game session variables, and game session persistence. The Game object itself is a Process and Event_Listener that is attached to its own Process_Manager and Corral facilities. The Game class also provides a limited interface, Game_State, which allow objects to reference it and access game state information and game session variables without a full view of the Game class, which in some cases would cause circular dependencies or allow unnecessary exposing of information.

Types

A_Game

type A_Game is access all Game'Class;

Subprograms & Entries

Create_Game

function Create_Game return A_Game;
Creates a new Game object using the registered allocator. If no allocator has been registered, an exception will be raised.

Game_Var_Add

procedure Game_Var_Add
( this: not null access Game'Class;
var: String;
val: Integer );
Adds integer 'val' to game session variable 'var'. A Game_Var_Changed event is queued. An exception is raised on error.

Get_Corral

function Get_Corral
( this: not null access Game'Class ) return A_Corral;
Returns the Game's event Corral. It is created during Game construction.

Get_Game_Var

function Get_Game_Var
( this: access Game;
var: String ) return Integer;
Returns the value of game session var 'var' as an integer. An exception will be raised on error.

Load_World

procedure Load_World
( this: access Game;
name: String );
Unloads the current world and attaches a newly loaded world to the game framework. If an error occurs, an exception will be raised and the current world will not change.

Set_View

procedure Set_View
( this: not null access Game'Class;
view: in out A_Game_View );
Sets the game's view. 'view' is consumed and then owned by the Game object. If the view has already been set, a Constraint_Error will be raised and 'view' will not be modified.

Start

procedure Start
( this: access Game );
Starts the game logic and attaches it to the framework. If the Game's view has not been set, a Constraint_Error will be raised.

Stop

procedure Stop
( this: not null access Game'Class );
Stops the game logic and detaches it from the framework.

Delete

procedure Delete
( this: in out A_Game );
Deletes the Game.