Index

Package: World

Description

package Events.World 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

Create_World_Event

type Create_World_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A command to create a new, empty world.

Load_World_Event

type Load_World_Event is new Event with private;

Ancestors:

Primitive operations:

Construct (overriding Events.Construct)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A command to load a world from disk.

World_Loaded_Event

type World_Loaded_Event is new Event with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct
Delete (overriding Objects.Delete)
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Construct (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A notification that a world has been loaded/created/resized.

World_Property_Event

type World_Property_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
An event involving a world property value.

Resize_World_Event

type Resize_World_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A command to resize the world map.

Set_Tile_Event

type Set_Tile_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A command to set the tile id at a specific location.

Tile_Changed_Event

type Tile_Changed_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A notification that a tile in the map changed.

World_Modified_Event

type World_Modified_Event is new Event with private;

Ancestors:

Primitive operations:

Events.Construct (Inherited)
Events.To_String (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
A notification that the world has been modified somehow.

Types

A_Create_World_Event

type A_Create_World_Event is access all Create_World_Event'Class;

A_Load_World_Event

type A_Load_World_Event is access all Load_World_Event'Class;

A_World_Loaded_Event

type A_World_Loaded_Event is access all World_Loaded_Event'Class;

A_World_Property_Event

type A_World_Property_Event is access all World_Property_Event'Class;

A_Resize_World_Event

type A_Resize_World_Event is access all Resize_World_Event'Class;

A_Set_Tile_Event

type A_Set_Tile_Event is access all Set_Tile_Event'Class;

A_Tile_Changed_Event

type A_Tile_Changed_Event is access all Tile_Changed_Event'Class;

A_World_Modified_Event

type A_World_Modified_Event is access all World_Modified_Event'Class;

Constants & Global variables

CREATE_WORLD_ID (Events.Event_Id)

CREATE_WORLD_ID : constant Event_Id := To_Event_Id( "Create_World" );

LOAD_WORLD_ID (Events.Event_Id)

LOAD_WORLD_ID : constant Event_Id := To_Event_Id( "Load_World" );

WORLD_LOADED_ID (Events.Event_Id)

WORLD_LOADED_ID : constant Event_Id := To_Event_Id( "World_Loaded" );

SET_WORLD_PROPERTY_ID (Events.Event_Id)

SET_WORLD_PROPERTY_ID : constant Event_Id := To_Event_Id( "Set_World_Property" );
A command to set the value of a world property.

WORLD_PROPERTY_CHANGED_ID (Events.Event_Id)

WORLD_PROPERTY_CHANGED_ID : constant Event_Id := To_Event_Id( "World_Property_Changed" );
A notification that a world property changed.

RESIZE_WORLD_ID (Events.Event_Id)

RESIZE_WORLD_ID : constant Event_Id := To_Event_Id( "Resize_World" );

SET_TILE_ID (Events.Event_Id)

SET_TILE_ID : constant Event_Id := To_Event_Id( "Set_Tile" );

TILE_CHANGED_ID (Events.Event_Id)

TILE_CHANGED_ID : constant Event_Id := To_Event_Id( "Tile_Changed" );

WORLD_MODIFIED_ID (Events.Event_Id)

WORLD_MODIFIED_ID : constant Event_Id := To_Event_Id( "World_Modified" );

Subprograms & Entries

Get_Domain

function Get_Domain
( this: not null access Create_World_Event'Class ) return String;
Returns the domain of the world to create (map, platform, etc.)

Get_Height

function Get_Height
( this: not null access Create_World_Event'Class ) return Positive;
Returns the height of the new world in tiles.

Get_Library_Name

function Get_Library_Name
( this: not null access Create_World_Event'Class ) return String;
Returns the name of the library to be used for tiles.

Get_Width

function Get_Width
( this: not null access Create_World_Event'Class ) return Positive;
Returns the width of the new world in tiles.

Get_Filename

function Get_Filename
( this: not null access Load_World_Event'Class ) return String;
Returns the filename of the world to load.

Get_Height

function Get_Height
( this: not null access World_Loaded_Event'Class ) return Positive;
Returns the height of the world in tiles.

Get_Layers

function Get_Layers
( this: not null access World_Loaded_Event'Class ) return A_Layer_Array;
Returns the world map as an array of tile layers.

Get_Library_Name

function Get_Library_Name
( this: not null access World_Loaded_Event'Class ) return String;
Returns the name of the library used for tiles.

Get_Tile_Width

function Get_Tile_Width
( this: not null access World_Loaded_Event'Class ) return Positive;
Returns the width of a tile in the world in pixels.

Get_Width

function Get_Width
( this: not null access World_Loaded_Event'Class ) return Positive;
Returns the width of the world in tiles.

Get_Property_Name

function Get_Property_Name
( this: not null access World_Property_Event'Class ) return String;
Returns the name of the property.

Get_Value

function Get_Value
( this: not null access World_Property_Event'Class ) return Value_Ptr;
Returns the property's value.

Get_Height

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

Get_Width

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

Get_Layer

function Get_Layer
( this: not null access Set_Tile_Event'Class ) return Integer;
Returns the layer of the tile to set.

Get_Tile_ID

function Get_Tile_ID
( this: not null access Set_Tile_Event'Class ) return Natural;
Returns new tile id to set.

Get_X

function Get_X
( this: not null access Set_Tile_Event'Class ) return Float;
Returns the X coordinate of the tile to set.

Get_Y

function Get_Y
( this: not null access Set_Tile_Event'Class ) return Float;
Returns the Y coordinate of the tile to set.

Get_Layer

function Get_Layer
( this: not null access Tile_Changed_Event'Class ) return Integer;
Returns the map layer of the tile that changed.

Get_Tile_ID

function Get_Tile_ID
( this: not null access Tile_Changed_Event'Class ) return Natural;
Returns the new tile id.

Get_X

function Get_X
( this: not null access Tile_Changed_Event'Class ) return Natural;
Returns the X coordinate of the tile that changed.

Get_Y

function Get_Y
( this: not null access Tile_Changed_Event'Class ) return Natural;
Returns the Y coordinate of the tile that changed.

Trigger_Create_World

procedure Trigger_Create_World
( width, height: Positive;
libName, domain: String );
Creates a new, empty world synchronously. An exception is raised on error.

Queue_Load_World

procedure Queue_Load_World
( filename: String );
Load a world from disk asynchronously.

Trigger_Load_World

procedure Trigger_Load_World
( filename: String );
Loads a world from disk synchronously. An exception is raised on error.

Queue_World_Loaded

procedure Queue_World_Loaded
( width, height, tileWidth: Positive;
layers: not null A_Layer_Array;
libName: String );
A world has been loaded into the Game, by loading from disk, by creating a new world, etc.

Trigger_Resize_World

procedure Trigger_Resize_World
( width, height: Positive );
Resizes the world sychronously. An exception is raised on failure. (ie: parameters rejected)

Queue_Set_Tile

procedure Queue_Set_Tile
( layer: Integer;
x, y: Float;
-- world pixel coordinates tile_id: Natural );
Set a tile in the world by location (layer, x, y).

Queue_Set_World_Property

procedure Queue_Set_World_Property
( name: String;
value: Value_Ptr'Class );
Asynchronously sets a world property 'name' to 'value'. The value will be copied.

Queue_Tile_Changed

procedure Queue_Tile_Changed
( layer: Integer;
x, y: Natural;
tile_id: Natural );
A tile in the world has changed.

Queue_World_Modified

procedure Queue_World_Modified;
Something about the world has changed. This is an indication that the world has changed since it was loaded from disk.

Queue_World_Property_Changed

procedure Queue_World_Property_Changed
( name: String;
value: Value_Ptr'Class );
Notifies listeners that the property 'name' of the world has changed. The property's new value is 'value'. The value will be copied.