Index

Package: Libraries

Description

package Tiles.Libraries is

Classes

Tile_Library

type Tile_Library is new Limited_Object with private;

Ancestors:

Primitive operations:

Construct (overriding Objects.Construct)
Delete (overriding Objects.Delete)
Objects.To_String (Inherited)

Types

A_Tile_Library

type A_Tile_Library is access all Tile_Library'Class;

Subprograms & Entries

Initialize

procedure Initialize;
Initialize the tile library system. This must be called before loading a library.

Finalize

procedure Finalize;
Finalize the tile library system. No libraries can be loaded after this has been called. However, references to loaded libraries will remain valid and should still be unloaded after use.

Load_Library

function Load_Library
( name: String ) return A_Tile_Library;
Loads a library by name. This should be the base filename of the library, not including a file extension or any path information. Null will be returned if an error occurs.

Load_Library_Sync

function Load_Library_Sync
( name: String ) return A_Tile_Library;
Synchronously loads a library by name. This procedure will not return until the requested library has been fully loaded, or an error occurs. Null will be returned if an error occurs.

Unload_Library

procedure Unload_Library
( name: String );
Unloads a library by name. It will not be deallocated before all references have been unloaded.

Unload_Library

procedure Unload_Library
( lib: in out A_Tile_Library );
Unloads a library by reference. It will not be deallocated before all references have been unloaded.

Exists

function Exists
( this: not null access Tile_Library'Class;
id: Natural ) return Boolean;
Returns True if a tile with the given id exists in the library.

Get_Bitmap

function Get_Bitmap
( this: not null access Tile_Library'Class;
id: Natural ) return A_Bitmap;
Returns the bitmap for a tile with the given id, or null if the tile is not found, is not yet loaded, or failed to load its bitmap.

Get_Bitmap_Sync

function Get_Bitmap_Sync
( this: not null access Tile_Library'Class;
id: Natural ) return A_Bitmap;
Returns the bitmap for a tile with the given id, blocking if the tile hasn't been loaded into memory yet. null will be returned if the tile bitmap failed to load.

Get_Bitmap_At_Slot

function Get_Bitmap_At_Slot
( this: not null access Tile_Library'Class;
slot: Natural ) return A_Bitmap;
Returns the bitmap for a tile in the given tile slot, or null if the slot is empty or not yet loaded.

Get_Clip

function Get_Clip
( this: not null access Tile_Library'Class;
id: Natural ) return Clip_Type;
Returns the clip attribute of a tile.

Get_Id

function Get_Id
( this: not null access Tile_Library'Class;
name: String ) return Natural;
Returns the id of a tile by tile name.

Get_Id_At_Slot

function Get_Id_At_Slot
( this: not null access Tile_Library'Class;
slot: Natural ) return Natural;
Returns the id of the tile at the given slot.

Get_Name

function Get_Name
( this: not null access Tile_Library'Class ) return String;
Returns the name of the tile library.

Get_Matrix

function Get_Matrix
( this: not null access Tile_Library'Class;
num: Natural ) return A_Tile_Matrix;
Returns a reference to a tile matrix. Do not modify the matrix, it belongs to the library!

Get_Matrix_Count

function Get_Matrix_Count
( this: not null access Tile_Library'Class ) return Natural;
Returns the number of matrices in the library.

Get_Progress

function Get_Progress
( this: not null access Tile_Library'Class ) return Natural;
Returns the loading progress as a percentage. Values will be in the range of 0..100.

Get_Slot_For_ID

function Get_Slot_For_ID
( this: not null access Tile_Library'Class;
id: Natural ) return Natural;
Returns the slot number in the tile listing for the given tile id.

Get_Tile_Count

function Get_Tile_Count
( this: not null access Tile_Library'Class ) return Natural;
Returns the number of slots in the library (not necessarily the number of tiles in the library, since empty slots are also counted).

Get_Tile

function Get_Tile
( this: not null access Tile_Library'Class;
id: Natural ) return A_Tile;
Returns a reference to a tile by id, or 'null' if 'id' doesn't exist. Do not modify the tile, it belongs to the library.

Is_Loaded

function Is_Loaded
( this: not null access Tile_Library'Class ) return Boolean;
Returns True if the tile library has been loaded completely.