Index

Package: Sessions

Description

package Games.Sessions is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Game_Session (abstract)

type Game_Session is abstract new Object and
                                      Event_Listener and
                                      Game_State and
                                      Process with private;

Ancestors:

Immediate Children:

Games.Sessions.Keen.Keen_Session

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Events.Listeners.To_String (Inherited)
Get_Process_Name (overriding Processes.Get_Process_Name)
Handle_Event (overriding Events.Listeners.Handle_Event)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
Objects.To_String (Inherited)
On_End_Game
On_Load_World
On_New_Game
On_Pause
Tick (overriding Processes.Tick)

Types

Session_State

type Session_State is (Initial, Loading, Playing, Paused, Ended);

A_Game_Session

type A_Game_Session is access all Game_Session'Class;

Subprograms & Entries

Create_Game_Session

function Create_Game_Session
( game: not null A_Game ) return A_Game_Session;
Creates a new Game_Session object using the registered allocator.

Delete

procedure Delete
( this: in out A_Game_Session );

New_Game

procedure New_Game
( this: not null access Game_Session'Class );
Notifies the game session that it is beginning a new game from the beginning. This should be called by the Game class just after object construction. One Game_Session object corresponds to one game session, played from the beginning of the game until game over or victory. The game session may be saved and loaded several times over the course of the session, but it only begins with New_Game once.

End_Game

procedure End_Game
( this: not null access Game_Session'Class;
completed: Boolean );
Notifies the game session that it is ending. If 'completed' is True, the game session was ended by a loss or a victory, otherwise the game session was aborted by the player. This should be called by the Game class just before object deletion.

Get_Var

function Get_Var
( this: access Game_Session;
name: String ) return Value_Ptr;
Returns the value of session var 'name', or Null_Value if not defined.

Set_Var

procedure Set_Var
( this: access Game_Session;
name: String;
value: Value_Ptr'Class );
Sets session var 'name' to 'value'. A Game_Var_Changed event will be queued.

Get_Process_Name

function Get_Process_Name
( this: access Game_Session ) return String;
Returns the Process name of the Game_Session object.

Get_World

function Get_World
( this: not null access Game_Session'Class ) return A_World;
Returns a reference to the session's active world, or null if no world is active. The world is owned by this Game_Session.