Index

Package: Sprites

Description

package Widgets.Sprites is

Classes

Sprite

type Sprite is new Widget with private;

Ancestors:

Immediate Children:

Primitive operations:

Construct
Delete (overriding Widgets.Delete)
Draw_Content (overriding Widgets.Draw_Content)
Get_Min_Height (overriding Widgets.Get_Min_Height)
Get_Min_Width (overriding Widgets.Get_Min_Width)
Objects.Construct (Inherited)
Set_Selected
Widgets.Activate_Popup (Inherited)
Widgets.Bring_To_Front (Inherited)
Widgets.Construct (Inherited)
Widgets.Draw (Inherited)
Widgets.Find_Widget (Inherited)
Widgets.Get_Color (Inherited)
Widgets.Get_Process_Name (Inherited)
Widgets.Get_View (Inherited)
Widgets.Get_Window (Inherited)
Widgets.Handle_Ancestor_Hidden (Inherited)
Widgets.Handle_Ancestor_Unhidden (Inherited)
Widgets.Handle_Blur (Inherited)
Widgets.Handle_Click (Inherited)
Widgets.Handle_Descendant_Hidden (Inherited)
Widgets.Handle_Descendant_Unhidden (Inherited)
Widgets.Handle_Disabled (Inherited)
Widgets.Handle_Enabled (Inherited)
Widgets.Handle_Enter (Inherited)
Widgets.Handle_Exit (Inherited)
Widgets.Handle_Focus (Inherited)
Widgets.Handle_Hidden (Inherited)
Widgets.Handle_Key_Held (Inherited)
Widgets.Handle_Key_Press (Inherited)
Widgets.Handle_Key_Release (Inherited)
Widgets.Handle_Mouse_Held (Inherited)
Widgets.Handle_Mouse_Move (Inherited)
Widgets.Handle_Mouse_Press (Inherited)
Widgets.Handle_Mouse_Release (Inherited)
Widgets.Handle_Mouse_Scroll (Inherited)
Widgets.Handle_Resize (Inherited)
Widgets.Handle_Unhidden (Inherited)
Widgets.Pack (Inherited)
Widgets.Set_Color (Inherited)
Widgets.Set_Dirty (Inherited)
Widgets.Set_Parent (Inherited)
Widgets.Set_Zoom (Inherited)
Widgets.To_String (Inherited)
Widgets.Translate_To_Content (Inherited)
Widgets.Translate_To_Window (Inherited)
A Sprite is the visible representation of an Entity. It is a partially transparent widget, drawn as a tile from a tile library, that is added to a Scene container widget.

Types

A_Sprite

type A_Sprite is access all Sprite'Class;

Subprograms & Entries

Create_Sprite

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;
Creates a new Sprite. 'eid' is the id of the entity it represents. Class is the class of entity it represents. 'x', 'y' are the location of the center of the widget in pixels. 'physical' indicates if the entity obeys the laws of physics. 'libName' is the name of the tile library to be used for the sprite's images. 'frame' is the id of the current frame in the tile library to display.

Center_At

procedure Center_At
( this: not null access Sprite'Class;
x, y: Float );
Centers the sprite at 'x', 'y' in pixels. The sprite will update its known location of its entity.

Get_Class

function Get_Class
( this: not null access Sprite'Class ) return String;
Returns the sprite's entity's class.

Get_Entity_Id

function Get_Entity_Id
( this: not null access Sprite'Class ) return Entity_Id;
Returns the Entity_Id of the Sprite's entity.

Get_X

function Get_X
( this: not null access Sprite'Class ) return Float;
Returns the x location of the Sprite's entity; located at the center of the widget.

Get_Y

function Get_Y
( this: not null access Sprite'Class ) return Float;
Returns the y location of the Sprite's entity; located at the center of the widget.

Set_Frame

procedure Set_Frame
( this: not null access Sprite'Class;
frame: Natural );
Sets the tile id of the Sprite's current frame.

Is_Updatable

function Is_Updatable
( this: not null access Sprite'Class ) return Boolean;

Resize

procedure Resize
( this: not null access Sprite'Class;
width, height: Natural );
Resizes the Sprite to 'width', 'height' while keeping the widget centered at its entity's location. If 'width' or 'height' is 0, the value will not be changed. (ex: width => 10, height => 0 will change only the width.)

Set_Selected

procedure Set_Selected
( this: access Sprite;
selected: Boolean );
Notifies the sprite of its selected state. This doesn't actually select/unselect the widget; that can only be done by its Window.