Index

Package: Indices

Description

private package Tiles.Indices is

Types

Tile_Index

type Tile_Index is private;
A Tile_Index indexes and organizes all the Tiles in a Tile_Library. It is stored in a tile library as a separate index file, alongside all the included bitmaps. In addition to indexing tiles by id, it contains tile matrices for repeated tile patterns and large multi-tile objects.

A_Tile_Index

type A_Tile_Index is access all Tile_Index;

Constants & Global variables

DUPLICATE_TILE

DUPLICATE_TILE : exception;
raised on attempt to add a tile with a duplicate id

Subprograms & Entries

Create_Tile_Index

function Create_Tile_Index return A_Tile_Index;
Creates a new empty tile index.

Load_Index

function Load_Index
( archive: not null A_Archive;
filename: String ) return A_Tile_Index;
Loads a tile index from an archive. Null will be returned if an error occurs.

Add_Matrix

procedure Add_Matrix
( index: not null A_Tile_Index;
matrix: in out A_Tile_Matrix );
Adds a new tile matrix to the index. 'matrix' will be consumed.

Add_Tile

procedure Add_Tile
( index: not null A_Tile_Index;
tile: in out A_Tile );
Adds a new tile to the index. 'tile' is consumed. If 'tile' is passed as null, a null tile is added to the tile list as a place holder. The exception DUPLICATE_TILE will be raised if a tile with the same id already exists in the index.

Delete

procedure Delete
( index: in out A_Tile_Index );
Deletes a tile index.

Get_Matrix

function Get_Matrix
( index: not null A_Tile_Index;
num: Natural ) return A_Tile_Matrix;
Returns a reference to a matrix in the index by ordinal number, base 1. If there is no matrix for 'num' then null will be returned.

Get_Matrix_Count

function Get_Matrix_Count
( index: not null A_Tile_Index ) return Natural;
Returns the number of matrices in the index.

Get_Progress

function Get_Progress
( index: not null A_Tile_Index ) return Natural;
Returns the load completion for the index in the range of 0..100

Get_Slot

function Get_Slot
( index: not null A_Tile_Index;
id: Natural ) return Natural;
Returns the slot number of a tile by id. The slot is determined by the order of the tiles in the index. The first tile is at slot 1. Zero will be returned if 'id' is not found in the index.

Get_Tile

function Get_Tile
( index: not null A_Tile_Index;
id: Natural ) return A_Tile;
Returns a tile reference by tile id, base 1. Do not modify the tile; it belongs to the index. Null will be returned if the tile is not found.

Get_Tile

function Get_Tile
( index: not null A_Tile_Index;
name: String ) return A_Tile;
Returns a tile reference by name. Do not modify the tile, it belongs to the index. Null will be returned if the tile is not found.

Get_Tile_At_Slot

function Get_Tile_At_Slot
( index: not null A_Tile_Index;
slot: Natural ) return A_Tile;
Returns a tile reference by slot number, base 1. Do not modify the tile; it belongs to the index. Null will be returned if the tile is not found.

Get_Tile_Count

function Get_Tile_Count
( index: not null A_Tile_Index ) return Natural;
Returns the number of tiles in the index.

Iterate_Tiles

procedure Iterate_Tiles
( index: not null A_Tile_Index;
examine: not null access procedure( tile : A_Tile ) );
Iterates across the tiles in the index by order of listing, from first to last.

Load_Complete

procedure Load_Complete
( index: not null A_Tile_Index );
Indicates to the index that all tiles have been loaded. This will unblock any threads waiting for the index to be fully loaded.

Load_Images

procedure Load_Images
( index: not null A_Tile_Index;
archive: not null A_Archive );
Loads all the bitmaps for all the tiles in the index.

Prioritize_Tile

procedure Prioritize_Tile
( index: not null A_Tile_Index;
tile: not null A_Tile );
Prioritizes a tile to be loaded before non-priority tiles.

Write_Index

function Write_Index
( index: not null A_Tile_Index;
filename: String ) return Boolean;
Writes the index to a file on disk, returning True on success.

Index_Extension

function Index_Extension return String;
Returns the file extension for tile index tiles, without a leading dot.

Index_Identifier

function Index_Identifier return String;
Returns a string that identifies the tile index file format. It is the first data found in the file.