Index

Package: Tiles

Description

package Tiles is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Tile_Object

type Tile_Object is new Object with private;

Ancestors:

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)
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

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_Attribute

function Get_Attribute
( this: access Tile_Object'Class;
name: String ) return Value_Ptr;
Returns the value of the 'name' attribute of the tile, or Null if the attribute has not been defined.

Get_Bitmap

function Get_Bitmap
( this: access Tile_Object'Class ) return A_Allegro_Bitmap;
Returns null if the tile's bitmap file isn't found or hasn't loaded yet. If 'this' is null, null will be returned.

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.

Is_Loaded

function Is_Loaded
( this: not null access Tile_Object'Class ) return Boolean;
Returns True if the tile's bitmap has been loaded, successfully or otherwise.

Object_Input

function Object_Input
( stream: access Root_Stream_Type'Class ) return Tile_Object;
Reads a Tile_Object from a stream.

Object_Output

procedure Object_Output
( stream: access Root_Stream_Type'Class;
obj: Tile_Object );
Writes a Tile_Object to a stream.

Set_Attribute

procedure Set_Attribute
( this: not null access Tile_Object'Class;
name: String;
val: Value_Ptr'Class );
Sets an attribute on the tile by name. The value may be of any type.

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.