Forums
This is the online documentation for Colossus Entertainments Pixie Game Engine

Application Class Reference
[Core]

Inheritance diagram for Application:

System

List of all members.


Detailed Description

Base class for the main application or game instance.

Author:
Mattias Gustavsson
In order to implement a game using the engine, you needed to create a class (ie MyGame), that derives from Application and has the macro SYSTEM_IMPLEMENTATION(MyGame) in the public section of the interface. You will also have to implement a function SetupSystems like this:

   void SetupSystems()
      {
      siEngine->AddSystem("Platform_FileSystem","Platform_Win32_FileSystem");
      siEngine->AddSystem("Platform_Time","Platform_Win32_Time");
      siEngine->AddSystem("Platform_Input","Platform_Win32_Input");
      siEngine->AddSystem("Platform_Sound","Platform_Win32_Sound");
      siEngine->AddSystem("Platform_Screen","Platform_Win32_Screen");
   
      siEngine->AddSystem("InputManager");
      siEngine->AddSystem("Audio");
      siEngine->AddSystem("GameStateManager");
      siEngine->AddSystem("SpriteControllerManager");
      siEngine->AddSystem("ResourceManager");
   
      MyGame::Register();
      siEngine->AddSystem("Application","MyGame");
      }

This function will be called by the engine, and this is where you select which systems you want to use, and for those which have multiple implementations, you can specify which implementation to use. This is also where you register your own application class (MyGame), and specify it as the implementation for the "Application" system.

After all of this, you are good to go, and the Initialize, Start, Stop, Terminate and Update methods of your class MyGame will be automatically called by the engine at the appropriate times, and it is within these functions you start to implement your game.

Definition at line 56 of file Application.h.


Public Member Functions

virtual void Initialize ()
virtual void Start ()
virtual void Stop ()
virtual void Terminate ()
virtual void Update (float deltaTime)=0

Member Function Documentation

virtual void Application::Initialize (  )  [virtual]

This method is called by the engine after all other systems have been initialized. You can re-implement this in your main game class, and you can do any necessary initialization here. Avoid making use of other systems at this point, as they are not started yet. Generally, you would mostly initialize member variables in this method, and leave any advanced setup to the Start method

Reimplemented from System.

Definition at line 67 of file Application.h.

virtual void Application::Start (  )  [virtual]

This method is called by the engine after all other systems have been started. You can re-implement this in your main game class, and you can do any necessary setup here. All the things you can't do in Initialize, you may do here, since all other systems will be started at this point, and the engine is fully up and running.

Reimplemented from System.

Definition at line 76 of file Application.h.

virtual void Application::Stop (  )  [virtual]

Did you create any objects in the Start method? Or allocate some memory? If you did anything at all in Start that requires clean up, you need to do that here. This method is called before any other system is Stopped.

Reimplemented from System.

Definition at line 83 of file Application.h.

virtual void Application::Terminate (  )  [virtual]

Most often you wouldn't do much in this method. Most, if not all, of the setup done in Initialize won't require cleanup, but if something does, this is the place to put it. This method is called before any other system is Terminated, but after all systems have been Stopped.

Reimplemented from System.

Definition at line 91 of file Application.h.

virtual void Application::Update ( float  deltaTime  )  [pure virtual]

In this method, you perform the per frame update of your game. This includes calling Update on any systems you are using. This method is called by the engine every frame, and the time that has elapsed since it was last called is passed as a parameter. This value should be used in all relevant calculations, to ensure things run at the same logical speed regardless of the frame rate.

Parameters:
deltaTime  The time elapsed since last frame