Index

Package: Game

Description

package Events.Game 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

End_Game_Event

type End_Game_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)

Game_Paused_Event

type Game_Paused_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification that the game paused state has changed.

Game_State_Event

type Game_State_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification that the gameplay state has changed. This happens when a game session begins and ends.

Game_Var_Changed_Event

type Game_Var_Changed_Event is new Event with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct
Events.Construct (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification that a game session variable has changed.

Loading_Event

type Loading_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification regarding the loading state of a resource.

Pause_Game_Event

type Pause_Game_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A command to change the game paused state.

Scroll_View_Event

type Scroll_View_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A command to scroll the gaame view's viewport of the world.

Types

A_End_Game_Event

type A_End_Game_Event is access all End_Game_Event'Class;

A_Game_Paused_Event

type A_Game_Paused_Event is access all Game_Paused_Event'Class;

A_Game_State_Event

type A_Game_State_Event is access all Game_State_Event'Class;

A_Game_Var_Changed_Event

type A_Game_Var_Changed_Event is access all Game_Var_Changed_Event'Class;

A_Loading_Event

type A_Loading_Event is access all Loading_Event'Class;

A_Pause_Game_Event

type A_Pause_Game_Event is access all Pause_Game_Event'Class;

A_Scroll_View_Event

type A_Scroll_View_Event is access all Scroll_View_Event'Class;

Constants & Global variables

END_GAME_ID (Events.Event_Id)

END_GAME_ID : constant Event_Id := To_Event_Id( "End_Game" );
A command to end the game session.

GAME_PAUSED_ID (Events.Event_Id)

GAME_PAUSED_ID : constant Event_Id := To_Event_Id( "Game_Paused" );

GAME_STATE_ID (Events.Event_Id)

GAME_STATE_ID : constant Event_Id := To_Event_Id( "Game_State" );

GAME_VAR_CHANGED_ID (Events.Event_Id)

GAME_VAR_CHANGED_ID : constant Event_Id := To_Event_Id( "Game_Var_Changed" );

LOADING_WORLD_ID (Events.Event_Id)

LOADING_WORLD_ID : constant Event_Id := To_Event_Id( "Loading_World" );
A notification that the loading of a world by the game logic has begun or ended. If loading has ended, an error message is included on failure.

NEW_GAME_ID (Events.Event_Id)

NEW_GAME_ID : constant Event_Id := To_Event_Id( "New_Game" );
A command to begin a new game session.

PAUSE_GAME_ID (Events.Event_Id)

PAUSE_GAME_ID : constant Event_Id := To_Event_Id( "Pause_Game" );

PLAYER_DIED_ID (Events.Event_Id)

PLAYER_DIED_ID : constant Event_Id := To_Event_Id( "Player_Died" );
A notification that the player died.

SCROLL_VIEW_ID (Events.Event_Id)

SCROLL_VIEW_ID : constant Event_Id := To_Event_Id( "Scroll_View" );

VIEW_READY_ID (Events.Event_Id)

VIEW_READY_ID : constant Event_Id := To_Event_Id( "View_Ready" );
A notification that the view is ready for game play to begin after a new world has been loaded. After loading a new world, the game waits in the Loaded state until the view notifies it with this event.

Subprograms & Entries

Is_Completed

function Is_Completed
( this: not null access End_Game_Event'Class ) return Boolean;

Is_Paused

function Is_Paused
( this: not null access Game_Paused_Event'Class ) return Boolean;
Returns True if the gameplay has been paused or False if it has been resumed.

Is_Interrupted

function Is_Interrupted
( this: not null access Game_State_Event'Class ) return Boolean;
Returns True if gameplay is not in progress now because the game session was interrupted by the player, instead of ending naturally (winning or losing.) The game session can be interrupted to start a new game, load a saved game, or just end the current game session by choice.

Is_Playing

function Is_Playing
( this: not null access Game_State_Event'Class ) return Boolean;
Returns True if gameplay is in progress.

Get_Value

function Get_Value
( this: access Game_Var_Changed_Event ) return Value_Ptr;
Returns a copy of the variable's new value.

Get_Var

function Get_Var
( this: not null access Game_Var_Changed_Event'Class ) return String;
Returns the name of the variable that changed.

Get_Error

function Get_Error
( this: not null access Loading_Event'Class ) return String;
Returns an error message if the loading has ended due to a failure. An empty string will be returned otherwise.

Is_Loading

function Is_Loading
( this: not null access Loading_Event'Class ) return Boolean;
Returns True if loading is beginning or False if it has ended. If loading has ended, check Get_Error to determine if the load was successful.

Is_Paused

function Is_Paused
( this: not null access Pause_Game_Event'Class ) return Boolean;
Returns True if the command is to pause the gameplay, or False if the command is to resume gameplay.

Get_X

function Get_X
( this: not null access Scroll_View_Event'Class ) return Float;
Amount to scroll view in the X axis in world coordinates.

Get_Y

function Get_Y
( this: not null access Scroll_View_Event'Class ) return Float;
Amount to scroll view in the Y axis in world coordinates.

Queue_End_Game

procedure Queue_End_Game
( completed: Boolean );
Queues an End_Game event. 'completed' indicates the game session ended naturally, one way or another. If the game was aborted by the player via the menu, completed must be False.

Queue_Game_Paused

procedure Queue_Game_Paused
( paused: Boolean );
Queues a Game_Paused event.

Queue_Game_State

procedure Queue_Game_State
( playing: Boolean;
interrupted: Boolean := False );
Queues a Game_State event.

Queue_Game_Var_Changed

procedure Queue_Game_Var_Changed
( var: String;
val: Value_Ptr'Class );
Queues a Game_Var_Changed event.

Queue_Loading_World

procedure Queue_Loading_World
( loading: Boolean;
error: String := "" );
Queues a Loading_World event.

Queue_New_Game

procedure Queue_New_Game;
Queues a New_Game event.

Queue_Pause_Game

procedure Queue_Pause_Game
( paused: Boolean );
Queues a Pause_Game event.

Queue_Player_Died

procedure Queue_Player_Died;
Queues a Player_Died event.

Queue_Scroll_View

procedure Queue_Scroll_View
( x, y: Float );
Queues a Scroll_View event.

Queue_View_Ready

procedure Queue_View_Ready;
Queues a View_Ready event.