Index

Package: Tiles

Description

package Tiles is

Classes

Tile_Object (abstract)

type Tile_Object is abstract new Object with private;

Ancestors:

Immediate Children:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct (overriding Objects.Construct)
Delete (overriding Objects.Delete)
Object_Input
Object_Output
Object_Read (overriding Objects.Object_Read)
Object_Write (overriding Objects.Object_Write)
Objects.To_String (Inherited)
Set_Attribute
A Tile_Object represents a tile, the most basic element of a world map. It is uniquely identified within its library by an integer Id. Each tile is represented by a bitmap, can be animated using bitmaps from other tiles, and contains a set of attributes the define how entities interact with it in the world.

Types

Tile_Id_Array

type Tile_Id_Array is array (Integer range <>) of Natural;
An array of tile ids

A_Tile_Id_Array

type A_Tile_Id_Array is access all Tile_Id_Array;

A_Tile

type A_Tile is access all Tile_Object'Class;

Constants & Global variables

ATTRIBUTE_ERROR

ATTRIBUTE_ERROR : exception;

Subprograms & Entries

Initialize

procedure Initialize;
Initializes the Tiles system, allowing tile libraries to be loaded.

Finalize

procedure Finalize;
Finalizes the Tiles system before application exit. Calling this without calling Initialize first will have no effect.

A_Tile_Id_Array_Input

function A_Tile_Id_Array_Input
( stream: access Root_Stream_Type'Class ) return A_Tile_Id_Array;

A_Tile_Id_Array_Output

procedure A_Tile_Id_Array_Output
( stream: access Root_Stream_Type'Class;
tia: A_Tile_Id_Array );

Copy

function Copy
( src: A_Tile_Id_Array ) return A_Tile_Id_Array;
Returns a copy of 'src'.

Delete

procedure Delete is new Ada.Unchecked_Deallocation
( Tile_Id_Array, A_Tile_Id_Array );
Deletes the Tile_Id_Array.

Create_Tile

function Create_Tile return A_Tile;
Creates a new tile using register allocator. Returns null if no allocator has been registered.

Get_Anm_Delay

function Get_Anm_Delay
( this: not null access Tile_Object'Class ) return Time_Span;
Returns the animation frame delay for the tile.

Get_Id

function Get_Id
( this: not null access Tile_Object'Class ) return Natural;
Returns the id of the tile within its library.

Get_Name

function Get_Name
( this: not null access Tile_Object'Class ) return String;
Returns the name (bitmap filename) of the tile. Tile names are not unique within a library.

Get_Next_Frame

function Get_Next_Frame
( this: not null access Tile_Object'Class ) return Natural;
Returns the id of the next frame in the tile's animation if it's a frame in a single shot animation.

Get_Frame_List

function Get_Frame_List
( this: not null access Tile_Object'Class ) return A_Tile_Id_Array;
Returns a reference to the tile's looped animation frame list, or null if the tile does not have a looping animation. Do not delete the array, it belongs to the tile.

Is_Animated

function Is_Animated
( this: not null access Tile_Object'Class ) return Boolean;
Returns True if the file is animated.

Object_Input (abstract)

function Object_Input
( stream: access Root_Stream_Type'Class ) return Tile_Object is abstract;

Object_Output (abstract)

procedure Object_Output
( stream: access Root_Stream_Type'Class;
obj: Tile_Object ) is abstract;

Set_Attribute

procedure Set_Attribute
( this: in out Tile_Object;
found: out Boolean;
name: String;
val: String := "" );
Sets an attribute on the tile by name. Only certain attribute names are supported and each has its own value constraints. False is returned in 'found' if the attribute name is not recognized. An exception is raised if the value is invalid or if there is a semantic error caused by setting the attribute.

Set_Id

procedure Set_Id
( this: access Tile_Object;
id: Natural );
Sets the id of the tile. Tile ids are unique within a library. Adding this tile to a library that already contains a tile with the same id will result in an error.

Set_Name

procedure Set_Name
( this: access Tile_Object;
name: String );
Sets the name (bitmap filename) of the tile. Tile names are not unique within a library.

Delete

procedure Delete
( this: in out A_Tile );
Deletes the Tile.