with Events;
with Values; use Values;
pragma Elaborate_All( Events );
package Events.Game is
END_GAME_ID : constant Event_Id := To_Event_Id( "End_Game" );
type End_Game_Event is new Event with private;
type A_End_Game_Event is access all End_Game_Event'Class;
function Is_Completed( this : not null access End_Game_Event'Class ) return Boolean;
GAME_PAUSED_ID : constant Event_Id := To_Event_Id( "Game_Paused" );
type Game_Paused_Event is new Event with private;
type A_Game_Paused_Event is access all Game_Paused_Event'Class;
function Is_Paused( this : not null access Game_Paused_Event'Class ) return Boolean;
GAME_STATE_ID : constant Event_Id := To_Event_Id( "Game_State" );
type Game_State_Event is new Event with private;
type A_Game_State_Event is access all Game_State_Event'Class;
function Is_Interrupted( this : not null access Game_State_Event'Class ) return Boolean;
function Is_Playing( this : not null access Game_State_Event'Class ) return Boolean;
GAME_VAR_CHANGED_ID : constant Event_Id := To_Event_Id( "Game_Var_Changed" );
type Game_Var_Changed_Event is new Event with private;
type A_Game_Var_Changed_Event is access all Game_Var_Changed_Event'Class;
function Get_Value( this : access Game_Var_Changed_Event ) return Value_Ptr;
pragma Postcondition( Get_Value'Result /= Values.Nul );
function Get_Var( this : not null access Game_Var_Changed_Event'Class ) return String;
LOADING_WORLD_ID : constant Event_Id := To_Event_Id( "Loading_World" );
type Loading_Event is new Event with private;
type A_Loading_Event is access all Loading_Event'Class;
function Get_Error( this : not null access Loading_Event'Class ) return String;
function Is_Loading( this : not null access Loading_Event'Class ) return Boolean;
NEW_GAME_ID : constant Event_Id := To_Event_Id( "New_Game" );
PAUSE_GAME_ID : constant Event_Id := To_Event_Id( "Pause_Game" );
type Pause_Game_Event is new Event with private;
type A_Pause_Game_Event is access all Pause_Game_Event'Class;
function Is_Paused( this : not null access Pause_Game_Event'Class ) return Boolean;
PLAYER_DIED_ID : constant Event_Id := To_Event_Id( "Player_Died" );
SCROLL_VIEW_ID : constant Event_Id := To_Event_Id( "Scroll_View" );
type Scroll_View_Event is new Event with private;
type A_Scroll_View_Event is access all Scroll_View_Event'Class;
function Get_X( this : not null access Scroll_View_Event'Class ) return Float;
function Get_Y( this : not null access Scroll_View_Event'Class ) return Float;
VIEW_READY_ID : constant Event_Id := To_Event_Id( "View_Ready" );
procedure Queue_End_Game( completed : Boolean );
procedure Queue_Game_Paused( paused : Boolean );
procedure Queue_Game_State( playing : Boolean; interrupted : Boolean := False );
procedure Queue_Game_Var_Changed( var : String; val : Value_Ptr'Class );
pragma Precondition( var'Length > 0 );
pragma Precondition( Value_Ptr(val) /= Values.Nul );
procedure Queue_Loading_World( loading : Boolean; error : String := "" );
pragma Precondition( not loading or else error'Length = 0 );
procedure Queue_New_Game;
procedure Queue_Pause_Game( paused : Boolean );
procedure Queue_Player_Died;
procedure Queue_Scroll_View( x, y : Float );
procedure Queue_View_Ready;
private
type End_Game_Event is new Event with
record
completed : Boolean := True;
end record;
procedure Construct( this : access End_Game_Event; completed : Boolean );
function To_String( this : access End_Game_Event ) return String;
type Game_Paused_Event is new Event with
record
paused : Boolean := True;
end record;
procedure Construct( this : access Game_Paused_Event; paused : Boolean );
function To_String( this : access Game_Paused_Event ) return String;
type Game_State_Event is new Event with
record
playing : Boolean := True;
interrupted : Boolean := False;
end record;
procedure Construct( this : access Game_State_Event;
playing : Boolean;
interrupted : Boolean );
function To_String( this : access Game_State_Event ) return String;
type Game_Var_Changed_Event is new Event with
record
var : Unbounded_String;
val : Value_Ptr;
end record;
procedure Adjust( this : access Game_Var_Changed_Event );
procedure Construct( this : access Game_Var_Changed_Event;
var : String;
val : Value_Ptr'Class );
pragma Precondition( var'Length > 0 );
pragma Precondition( Value_Ptr(val) /= Values.Nul );
function To_String( this : access Game_Var_Changed_Event ) return String;
type Loading_Event is new Event with
record
loading : Boolean;
error : Unbounded_String;
end record;
procedure Construct( this : access Loading_Event;
name : String;
loading : Boolean;
error : String );
function To_String( this : access Loading_Event ) return String;
type Pause_Game_Event is new Event with
record
paused : Boolean := True;
end record;
procedure Construct( this : access Pause_Game_Event; paused : Boolean );
type Scroll_View_Event is new Event with
record
x, y : Float := 0.0;
end record;
procedure Construct( this : access Scroll_View_Event; x, y : Float );
end Events.Game;