with Entities; use Entities;
limited with Game_Views;
private with Tiles.Libraries;
package Widgets.Sprites is
type Sprite is new Widget with private;
type A_Sprite is access all Sprite'Class;
function Create_Sprite( view : not null access Game_Views.Game_View'Class;
eid : Entity_Id;
class : String;
x, y : Float;
physical : Boolean;
libName : String;
frame : Natural ) return A_Sprite;
pragma Precondition( class'Length > 0 );
pragma Precondition( libName'Length > 0 );
pragma Postcondition( Create_Sprite'Result /= null );
procedure Center_At( this : not null access Sprite'Class; x, y : Float );
function Get_Class( this : not null access Sprite'Class ) return String;
pragma Postcondition( Get_Class'Result'Length > 0 );
function Get_Entity_Id( this : not null access Sprite'Class ) return Entity_Id;
function Get_X( this : not null access Sprite'Class ) return Float;
function Get_Y( this : not null access Sprite'Class ) return Float;
procedure Set_Frame( this : not null access Sprite'Class; frame : Natural );
function Is_Updatable( this : not null access Sprite'Class ) return Boolean;
procedure Resize( this : not null access Sprite'Class;
width,
height : Natural );
procedure Set_Selected( this : access Sprite; selected : Boolean );
private
use Tiles.Libraries;
type Sprite is new Widget with
record
eid : Entity_Id := INVALID_ID;
class : Unbounded_String;
x, y : Float := 0.0;
physical : Boolean := False;
lib : A_Tile_Library := null;
frame : Natural := 0;
updatable : Integer := 0;
interactive : Boolean := False;
selected : Boolean := False;
end record;
procedure Construct( this : access Sprite;
view : not null access Game_Views.Game_View'Class;
eid : Entity_Id;
class : String;
x, y : Float;
physical : Boolean;
libName : String;
frame : Natural );
pragma Precondition( class'Length > 0 );
pragma Precondition( libName'Length > 0 );
procedure Delete( this : in out Sprite );
procedure Draw_Content( this : access Sprite; dc : Drawing_Context );
function Get_Min_Height( this : access Sprite ) return Natural;
function Get_Min_Width( this : access Sprite ) return Natural;
end Widgets.Sprites;