--
-- 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.
--
private with Ada.Real_Time;
private with Ada.Strings.Unbounded;
--private with Entities;
package Game_Views.Keen is
type Keen_View is new Game_View with private;
type A_Keen_View is access all Keen_View'Class;
procedure New_Game( this : not null access Keen_View'Class );
-- Quits the game, closing the application. Make sure game session data is
-- saved before this point, if it needs to be saved.
procedure Quit( this : not null access Keen_View'Class );
private
use Ada.Real_Time;
use Ada.Strings.Unbounded;
type Keen_View is new Game_View with
record
-- true if a game is currently in-session
gameInProgress : Boolean := False;
-- paused automatically by the gui. this indicates that the gui
-- should resume the game because the pause command was not given by
-- the user. (ex: auto pause when showing progress board or entering
-- the menu)
autoPaused : Boolean := False;
-- player can pause/resume the game. the gui may lock the pause
-- feature temporarily so the user can't directly pause/resume.
pauseEnabled : Boolean := True;
-- true when loading is in progress. this occurs between levels.
loading : Boolean := False;
-- loading screen is being displayed.
loadingScreen : Boolean := False;
-- time when the loading screen is to be hidden, if loading has
-- finished. if this equals Time_First, loading has not begun.
loadingScreenComplete : Time := Time_First;
-- the name of the music for the current world. this is set when the
-- 'music' world property changes and played when the world loading
-- dialog is closed.
worldMusic : Unbounded_String;
end record;
procedure Construct( this : access Keen_View );
-- Pauses the game automatically if it isn't already paused, or unpauses the
-- game if it was paused automatically and not by the player.
procedure Auto_Pause( this : not null access Keen_View'Class;
pause : Boolean );
procedure Handle_Close_Request( this : access Keen_View );
-- Inherited from the Event_Listener interface. Handles events that the view
-- is registered to receive.
procedure Handle_Event( this : access Keen_View;
evt : in out A_Event;
resp : out Response_Type );
pragma Precondition( evt /= null );
-- This is called when the application starts and stops loading resources.
procedure Handle_Loading( this : access Keen_View; loading : Boolean );
-- This is called when the paused state of the Game changes.
procedure Handle_Paused( this : access Keen_View; paused : Boolean );
-- Returns True if gameplay is paused.
function Is_Paused( this : not null access Keen_View'Class ) return Boolean;
-- Queues an event to pause or resume the game. The user must be allowed to
-- pause or resume the game or else 'force' must be set to True. Note that
-- the paused state of the game remains unchanged until Handle_Paused is
-- called.
procedure Pause_Game( this : not null access Keen_View'Class;
pause : Boolean;
force : Boolean := False );
-- This is called to start the view and attach it to the application
-- framework on startup.
procedure Start_View( this : access Keen_View );
-- This is called to stop the view and detach it from the application
-- framework on shutdown.
procedure Stop_View( this : access Keen_View );
-- Inherited from the Process interface. This will be called regularly after
-- the view is started.
procedure Tick( this : access Keen_View; time : Tick_Time );
end Game_Views.Keen;