Index

Package: Worlds

Description

package Worlds is

Classes

World_Object (abstract)

type World_Object is abstract new Object and Event_Listener and Process with private;

Ancestors:

Immediate Children:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct
Delete (overriding Objects.Delete)
Events.Listeners.To_String (Inherited)
Get_Filename
Get_Process_Name (overriding Processes.Get_Process_Name)
Handle
Handle
Handle
Handle
Handle
Handle
Handle
Handle
Handle
Handle
Handle_Event (overriding Events.Listeners.Handle_Event)
Initialize
Object_Input
Object_Read (overriding Objects.Object_Read)
Object_Write (overriding Objects.Object_Write)
Objects.Construct (Inherited)
Objects.To_String (Inherited)
On_Attach
On_Detach
Queue_Load_Events
Set_Property
Spawn_Entity
Tick (overriding Processes.Tick)

Types

A_World

type A_World is access all World_Object'Class;

Constants & Global variables

FILE_NOT_FOUND

FILE_NOT_FOUND,
    READ_EXCEPTION,
    WRITE_EXCEPTION : exception;

READ_EXCEPTION

READ_EXCEPTION,
    WRITE_EXCEPTION : exception;

WRITE_EXCEPTION

WRITE_EXCEPTION : exception;

Subprograms & Entries

Create_World

function Create_World
( width, height: Positive;
libName, domain: String ) return A_World;
Creates a new empty world. An exception is raised on error.

Load_World

function Load_World
( name: String ) return A_World;
Loads a world from disk. An exception is raised on error.

Attach_To_Framework

procedure Attach_To_Framework
( this: not null access World_Object'Class;
corral: not null A_Corral;
pman: not null A_Process_Manager );
Attaches the world to the game framework to send and receive events and execute as a process.

Detach_From_Framework

procedure Detach_From_Framework
( this: not null access World_Object'Class );
Detaches the world from the game framework, removing itself as an event listener and ceasing execution as a process.

Examine_Entities

procedure Examine_Entities
( this: not null access World_Object'Class;
examine: not null access procedure( e : not null A_Entity ) );
Iterate through all of the entities in the world, examining each.

Get_Entity

function Get_Entity
( this: access World_Object;
id: Entity_Id ) return A_Entity;
Returns a reference to an entity with the given id, or null if the entity doesn't exist.

Get_Filename

function Get_Filename
( this: access World_Object ) return String;
The name of the file that this world was loaded from (including the file extension), if it was loaded. If this world was not loaded from disk or has not been saved to the disk yet then an empty string will be returned.

Get_Height

function Get_Height
( this: not null access World_Object'Class ) return Positive;
Returns the actual map height in pixels.

Get_Height_Tiles

function Get_Height_Tiles
( this: not null access World_Object'Class ) return Positive;
Returns the height of the map in tiles.

Get_Library

function Get_Library
( this: not null access World_Object'Class ) return A_Tile_Library;
Returns the world's reference to its tile library. Do not modify it.

Get_Music

function Get_Music
( this: not null access World_Object'Class ) return String;
Returns the name of the background music track.

Get_Player

function Get_Player
( this: not null access World_Object'Class ) return A_Player;
Returns a reference to the world's current player entity. Do not modify it.

Get_Tile_Id

function Get_Tile_Id
( this: not null access World_Object'Class;
layer, x, y: Integer ) return Natural;
Returns the id of the tile at the specified location.

Get_Title

function Get_Title
( this: not null access World_Object'Class ) return String;
Returns the title of the world.

Get_Width

function Get_Width
( this: not null access World_Object'Class) return Positive;
Returns the actual map width in pixels.

Get_Width_Tiles

function Get_Width_Tiles
( this: not null access World_Object'Class ) return Positive;
Returns the width of the map in tiles.

Resize

procedure Resize
( this: not null access World_Object'Class;
width, height: Positive );
Resizes the map. An exception is raised on error.

Save

procedure Save
( this: not null access World_Object'Class;
name: String;
overwrite: Boolean := True );
Writes the world in its current state to a file on disk. An exception is raised on error.

Set_Property

procedure Set_Property
( this: access World_Object;
name, value: String );
basic properties: "filename" : the filename "domain" : determines player movement, physical rules "title" : the readable name of the world "music" : the background music track name

Set_Tile

procedure Set_Tile
( this: access World_Object;
layer: Integer;
x, y: Integer;
id: Natural;
notify: Boolean := True );
If 'notify' is True, Tile_Changed and World_Modified events will be sent.

Spawn_Entity

procedure Spawn_Entity
( this: access World_Object;
id: String;
x, y: Float;
width, height: Natural := 0;
xv, yv: Float := 0.0 );
Spawns an entity of the given class id into the world. If 'width' or 'height' are equal to 0, the entity's natural width and height will be used.

Tile_Width

function Tile_Width
( this: not null access World_Object'Class ) return Positive;

Object_Input (abstract)

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

Copy

function Copy
( src: A_World ) return A_World;

Delete

procedure Delete
( this: in out A_World );

Valid_Domain

function Valid_Domain
( domain: String ) return Boolean;

World_Extension

function World_Extension return String;