1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. private with Tiles; 
  10. private with Tiles.Libraries; 
  11.  
  12. package Widgets.Scoreboards is 
  13.  
  14.     type Scoreboard is new Widget with private; 
  15.     type A_Scoreboard is access all Scoreboard'Class; 
  16.  
  17.     function Create_Scoreboard( view    : not null access Game_Views.Game_View'Class; 
  18.                                 id      : String; 
  19.                                 libName : String ) return A_Scoreboard; 
  20.     pragma Precondition( id'Length > 0 ); 
  21.     pragma Precondition( libName'Length > 0 ); 
  22.     pragma Postcondition( Create_Scoreboard'Result /= null ); 
  23.  
  24.     procedure Set_Ammo( this : not null access Scoreboard'Class; ammo : Natural ); 
  25.  
  26.     procedure Set_Lives( this : not null access Scoreboard'Class; lives : Natural ); 
  27.  
  28.     procedure Set_Points( this : not null access Scoreboard'Class; points : Natural ); 
  29.  
  30. private 
  31.  
  32.     use Tiles; 
  33.     use Tiles.Libraries; 
  34.  
  35.     type Scoreboard is new Widget with 
  36.         record 
  37.             lib          : A_Tile_Library := null;    -- may be null if library cant load 
  38.             backgroundId : Natural := 0;              -- id of background tile 
  39.             digitId      : Tile_Id_Array(0..9) := (others => 0); 
  40.             ammo         : Integer := 0; 
  41.             lives        : Integer := 0; 
  42.             points       : Integer := 0; 
  43.         end record; 
  44.  
  45.     procedure Construct( this    : access Scoreboard; 
  46.                          view    : not null access Game_Views.Game_View'Class; 
  47.                          id      : String; 
  48.                          libName : String ); 
  49.     pragma Precondition( id'Length > 0 ); 
  50.     pragma Precondition( libName'Length > 0 ); 
  51.  
  52.     procedure Delete( this : in out Scoreboard ); 
  53.  
  54.     procedure Draw_Content( this : access Scoreboard ); 
  55.  
  56. end Widgets.Scoreboards;