1. with Entities;                          use Entities; 
  2.  
  3. limited with Game_Views; 
  4.  
  5. private with Tiles.Libraries; 
  6.  
  7. package Widgets.Sprites is 
  8.  
  9.     type Sprite is new Widget with private; 
  10.     type A_Sprite is access all Sprite'Class; 
  11.  
  12.     function Create_Sprite( view     : not null access Game_Views.Game_View'Class; 
  13.                             eid      : Entity_Id; 
  14.                             class    : String; 
  15.                             x, y     : Float; 
  16.                             physical : Boolean; 
  17.                             libName  : String; 
  18.                             frame    : Natural ) return A_Sprite; 
  19.     pragma Precondition( class'Length > 0 ); 
  20.     pragma Precondition( libName'Length > 0 ); 
  21.     pragma Postcondition( Create_Sprite'Result /= null ); 
  22.  
  23.     procedure Center_At( this : not null access Sprite'Class; x, y : Float ); 
  24.  
  25.     function Get_Class( this : not null access Sprite'Class ) return String; 
  26.     pragma Postcondition( Get_Class'Result'Length > 0 ); 
  27.  
  28.     function Get_Entity_Id( this : not null access Sprite'Class ) return Entity_Id; 
  29.  
  30.     function Get_X( this : not null access Sprite'Class ) return Float; 
  31.  
  32.     function Get_Y( this : not null access Sprite'Class ) return Float; 
  33.  
  34.     procedure Set_Frame( this : not null access Sprite'Class; frame : Natural ); 
  35.  
  36.     function Is_Updatable( this : not null access Sprite'Class ) return Boolean; 
  37.  
  38.     procedure Resize( this   : not null access Sprite'Class; 
  39.                       width, 
  40.                       height : Natural ); 
  41.  
  42.     procedure Set_Selected( this : access Sprite; selected : Boolean ); 
  43.  
  44. private 
  45.  
  46.     use Tiles.Libraries; 
  47.  
  48.     type Sprite is new Widget with 
  49.         record 
  50.             eid         : Entity_Id := INVALID_ID; 
  51.             class       : Unbounded_String; 
  52.             x, y        : Float := 0.0; 
  53.             physical    : Boolean := False; 
  54.             lib         : A_Tile_Library := null; 
  55.             frame       : Natural := 0; 
  56.             updatable   : Integer := 0;       -- accepts updates if = 0 
  57.             interactive : Boolean := False; 
  58.             selected    : Boolean := False; 
  59.         end record; 
  60.  
  61.     procedure Construct( this     : access Sprite; 
  62.                          view     : not null access Game_Views.Game_View'Class; 
  63.                          eid      : Entity_Id; 
  64.                          class    : String; 
  65.                          x, y     : Float; 
  66.                          physical : Boolean; 
  67.                          libName  : String; 
  68.                          frame    : Natural ); 
  69.     pragma Precondition( class'Length > 0 ); 
  70.     pragma Precondition( libName'Length > 0 ); 
  71.  
  72.     procedure Delete( this : in out Sprite ); 
  73.  
  74.     procedure Draw_Content( this : access Sprite; dc : Drawing_Context ); 
  75.  
  76.     function Get_Min_Height( this : access Sprite ) return Natural; 
  77.  
  78.     function Get_Min_Width( this : access Sprite ) return Natural; 
  79.  
  80. end Widgets.Sprites;