Class TA3DGEApplication

Unit

Declaration

type TA3DGEApplication = class(TCustomApplication)

Description

Base for all A3DGE applications.

It works much like LCL and VCL TCustomApplication class, so Lazarus and Delphi users should be used to this kind of stuff.

Only one application object should exist. If you create more than one an exception will raise.

You should call Initialize after creation.

See also
Application
Global reference to the A3DGE application object.
TA3DGEApplication.Initialize
Initialize the application.

Hierarchy

  • TCustomApplication
  • TA3DGEApplication

Overview

Methods

Protected procedure DoLog (aEventType: TEventType; const aMessage: AnsiString); override;
Protected procedure PrintCommandLineOptions; virtual;
Protected procedure ParseCommandLineOptions; virtual;
Public constructor Create (aOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure ShowErrorMessage (const aMessage: AnsiString);
Public procedure Initialize; override;
Public procedure AddGameState ( aGameState: TGameState; const aName: AnsiString = '' );
Public function FindGameState (aName: AnsiString): TGameState;
Public procedure PauseUpdates;
Public procedure ResumeUpdates;
Public procedure ClearEventQueue;

Properties

Public property Configuration: TConfigurationFile read fConfigurationFile;
Public property Display: TDisplay read fDisplay;
Public property TicksPerSecond: Integer read fTicksPerSecond write SetTicksPerSecond;
Public property Keyboard: TKeyboard read fKeyboard;
Public property Mouse: TMouse read fMouse;
Public property SysFont: ALLEGRO_FONTptr read fSystemTextFont;
Public property World3D: TWorld3D read fWorld;
Public property Gamestate: TGameStateManager read fGameState;

Description

Methods

Protected procedure DoLog (aEventType: TEventType; const aMessage: AnsiString); override;

Implements log system.

Protected procedure PrintCommandLineOptions; virtual;

Print command line options.

By default it prints information about default command line options.

Note that this information will be printed on the console terminal. On Windows it means you must compile without the -WG option or it will fail with an exception. Another option is to override this method to prevent printing on console.

See also
ParseCommandLineOptions
Parse command line options.
Protected procedure ParseCommandLineOptions; virtual;

Parse command line options.

These are the options parsed by this method:

Note that options `-h` and `–log` won't be overriden as they're hard-wired to the core.

See also
PrintCommandLineOptions
Print command line options.
Public constructor Create (aOwner: TComponent); override;

Create the application object.

Public destructor Destroy; override;

Destructor.

This also destoys all owned components and game states.

See also
TA3DGEApplication.AddGameState
Adds a game state, that will be owned by Application.
Public procedure ShowErrorMessage (const aMessage: AnsiString);

Show an error message on screen.

If the Display is open then it will try to render the message on it. If not it will print it in the standard output (the console or command terminal).

This is used internally to show uncatched exception messages.

Parameters
aMessage
The error message.
Public procedure Initialize; override;

Initialize the application.

You must call this before the game execution.

It will:

  1. Checks and initializes EventLogFilter, Configuration and Display.

  2. Loads configuration file and parses command line options.

  3. Initializes Allegro and base subsystems.

  4. Opens the display.

See also
TA3DGEApplication.ParseCommandLineOptions
Parse command line options.
TDisplay.Open
Open the display.
Public procedure AddGameState ( aGameState: TGameState; const aName: AnsiString = '' );

Adds a game state, that will be owned by Application.

AddGameState adds the given state the list of gamestates in the application. If it is the first game state adde, it will be assigned as the current GameState.

Adding the state after Initialize will log it as etDebug, but adding it before will not.

Parameters
aGameState
The game state to add.
aName
If set, it will assign the name to the state.
See also
TA3DGEApplication.GameState
Manage the current game state.
TA3DGEApplication.FindGameState
Search for an owned state by name.
Public function FindGameState (aName: AnsiString): TGameState;

Search for an owned state by name.

Search is case-insensitive.

Parameters
aName
Name of the state ot search.
Returns

The reference of the state or Nil if it can't find it.

See also
TA3DGEApplication.GameState
Manage the current game state.
TA3DGEApplication.AddGameState
Adds a game state, that will be owned by Application.
Public procedure PauseUpdates;

Pause game updates.

This will stop to update the current game state but other events will be triggered normally. You can use this while loading game data to prevent time jumps.

Do not forget to call ResumeUpdates to restore the normal game execution.

See also
TA3DGEApplication.ResumeUpdates
Resume game updates.
Public procedure ResumeUpdates;

Resume game updates.

See also
TA3DGEApplication.PauseUpdates
Pause game updates.
TA3DGEApplication.TicksPerSecond
How many times to call current state's Update method each second.
Public procedure ClearEventQueue;

Drops all events in system queue and clears keyboard..

Properties

Public property Configuration: TConfigurationFile read fConfigurationFile;

Access to the configuration.

Default configuration file is GetAppConfigFile (False, False). You can override it by assigning the configuration name (TConfigurationFile.FileName) before calling Initialize.

See also
Initialize
Initialize the application.
Public property Display: TDisplay read fDisplay;

Access to display.

Public property TicksPerSecond: Integer read fTicksPerSecond write SetTicksPerSecond;

How many times to call current state's Update method each second.

Default value is FPS.

Public property Keyboard: TKeyboard read fKeyboard;

Access to keyboard.

Public property Mouse: TMouse read fMouse;

Access to mouse.

Public property SysFont: ALLEGRO_FONTptr read fSystemTextFont;

System text font.

Public property World3D: TWorld3D read fWorld;

Global reference to the 3D world.

Public property Gamestate: TGameStateManager read fGameState;

Manage the current game state.

See also
TA3DGEApplication.AddGameState
Adds a game state, that will be owned by Application.
TA3DGEApplication.FindGameState
Search for an owned state by name.

Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.