1. private with Allegro.Keyboard; 
  2. private with Entities; 
  3. private with Events.Game; 
  4. private with Events.World; 
  5.  
  6. package Game_Views.Keen is 
  7.  
  8.     type Keen_View is new Game_View with private; 
  9.     type A_Keen_View is access all Keen_View'Class; 
  10.  
  11. private 
  12.  
  13.     use Allegro.Keyboard; 
  14.     use Entities; 
  15.     use Events.Game; 
  16.     use Events.World; 
  17.  
  18.     type Boolean_Key_Array is array (1..KEY_MAX) of Boolean; 
  19.  
  20.     type Keen_View is new Game_View with 
  21.         record 
  22.             -- true if a game is currently in-session 
  23.             gameInProgress : Boolean := False; 
  24.  
  25.             -- paused automatically by the gui. this indicates that the gui 
  26.             -- should resume the game because the pause command was not given by 
  27.             -- the user. (ex: auto pause when showing progress board or entering 
  28.             -- the menu) 
  29.             autoPaused : Boolean := False; 
  30.  
  31.             -- player can pause/resume the game. the gui may lock the pause 
  32.             -- feature temporarily so the user can't directly pause/resume. 
  33.             pauseEnabled : Boolean := True; 
  34.  
  35.             -- the id of the player entity, for sending impulses. 
  36.             playerId : Entity_Id := INVALID_ID; 
  37.  
  38.             -- events from these keys sent to the scene should be ignored until 
  39.             -- the next key press event. 
  40.             ignoreKey : Boolean_Key_Array := Boolean_Key_Array'(others => False); 
  41.         end record; 
  42.  
  43.     procedure Handle( this : not null access Keen_View'Class; 
  44.                       evt  : not null A_Game_Var_Changed_Event ); 
  45.  
  46.     procedure Handle( this : not null access Keen_View'Class; 
  47.                       evt  : not null A_Scroll_View_Event ); 
  48.  
  49.     procedure Handle( this : not null access Keen_View'Class; 
  50.                       evt  : not null A_World_Property_Changed_Event ); 
  51.  
  52.     procedure Handle_Close_Request( this : access Keen_View ); 
  53.  
  54.     procedure Handle_Event( this : access Keen_View; 
  55.                             evt  : in out A_Event; 
  56.                             resp : out Response_Type ); 
  57.     pragma Precondition( evt /= null ); 
  58.  
  59.     -- This is called when the application starts and stops loading resources. 
  60.     procedure Handle_Loading( this : access Keen_View; loading : Boolean ); 
  61.  
  62.     -- This is called when a new world is loaded by the Game. 
  63.     procedure Handle( this : not null access Keen_View'Class; 
  64.                       evt  : not null A_New_World_Event ); 
  65.  
  66.     -- This is called when the paused state of the Game changes. 
  67.     procedure Handle_Paused( this : access Keen_View; paused : Boolean ); 
  68.  
  69.     procedure Start( this : access Keen_View ); 
  70.  
  71.     procedure Stop( this : access Keen_View ); 
  72.  
  73.     -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  74.  
  75.     procedure Action_New_Game( this : not null access Keen_View'Class ); 
  76.  
  77.     procedure Action_Resume_Game( this : not null access Keen_View'Class ); 
  78.  
  79.     procedure Action_Quit( this : not null access Keen_View'Class ); 
  80.  
  81.     -- Pauses the game automatically if it isn't already paused, or unpauses the 
  82.     -- game if it was paused automatically and not by the player. 
  83.     procedure Auto_Pause( this  : not null access Keen_View'Class; 
  84.                           pause : Boolean ); 
  85.  
  86.     -- Queues an event to pause or resume the game. The user must be allowed to 
  87.     -- pause or resume the game or else 'force' must be set to True. Note that 
  88.     -- the paused state of the game remains unchanged until Handle_Paused is 
  89.     -- called. 
  90.     procedure Pause_Game( this  : not null access Keen_View'Class; 
  91.                           pause : Boolean; 
  92.                           force : Boolean := False ); 
  93.  
  94.     -- Creates all of the widgets required for the game view. This should only 
  95.     -- be called once as part of Game_View object construction. 
  96.     procedure Populate_View( this  : not null access Keen_View'Class; 
  97.                              xres, 
  98.                              yres  : Positive; 
  99.                              scale : Positive ); 
  100.  
  101.     -- Returns the gui to the menu from gameplay, pausing the game automatically. 
  102.     procedure Return_To_Menu( this : not null access Keen_View'Class ); 
  103.  
  104.     -- Puts 'text' into the loading message box, splitting text into multiple 
  105.     -- lines on whitespace boundaries as necessary. 
  106.     procedure Set_Loading_Text( this : not null access Keen_View'Class; 
  107.                                 text : String ); 
  108.  
  109. end Game_Views.Keen;