PixelLightAPI  .
Public Member Functions | Protected Member Functions | Protected Attributes
PLEngine::ScriptApplication Class Reference

Script application class. More...

#include <ScriptApplication.h>

Inheritance diagram for PLEngine::ScriptApplication:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PL_API ScriptApplication (PLCore::Frontend &cFrontend)
 Constructor.
PL_API ScriptApplication (PLCore::Frontend &cFrontend, PLCore::String sScriptFilename)
 Constructor for loading in and executing a scripted stand-alone application using just a single line of C++ code.
PL_API ScriptApplication (PLCore::Frontend &cFrontend, PLCore::String sScriptFilename, PLCore::String sName, PLCore::String sTitle, PLCore::String sAppDataSubdir)
 Constructor for loading in and executing a scripted stand-alone application using just a single line of C++ code.
virtual PL_API ~ScriptApplication ()
 Destructor.
PL_API PLCore::String GetBaseDirectory () const
 Returns the base directory of the application.
PL_API void SetBaseDirectory (const PLCore::String &sBaseDirectory)
 Sets the base directory of the application.

Protected Member Functions

virtual PL_API bool OnStart () override
 Initialization function that is called prior to OnInit()
virtual PL_API void OnStop () override
 De-initialization function that is called after OnDeInit()
virtual PL_API void OnUpdate () override
 Called to let the frontend update it's states.
PL_API bool LoadScript (const PLCore::String &sFilename)
 Loads a script.
PL_API void DestroyScript ()
 Destroys the currently used script.

Protected Attributes

PLCore::String m_sCurrentSceneBaseDirectory
PLCore::String m_sScriptFilename
PLCore::Scriptm_pScript

Detailed Description

Script application class.

Remarks:
This class can load in and execute a given script out of the box.
Note:
  • If a script filename was given to the constructor, the script is started within the "OnInit()"-method
  • Adds the global variable "this" to the script so that it's able to access "this" RTTI class instance

Constructor & Destructor Documentation

Constructor.

Parameters:
[in]cFrontendFrontend this application instance is running in

Constructor for loading in and executing a scripted stand-alone application using just a single line of C++ code.

Parameters:
[in]cFrontendFrontend this application instance is running in
[in]sScriptFilenameFilename of the script to load
Remarks:
		*    Usage example:
		*    int PLMain(const String &sExecutableFilename, const Array<String> &lstArguments)
		*    {
		*        return ScriptApplication("Data/Scripts/45ScriptApplication.lua").Run(sExecutableFilename, lstArguments);
		*    }
		*  
PL_API PLEngine::ScriptApplication::ScriptApplication ( PLCore::Frontend cFrontend,
PLCore::String  sScriptFilename,
PLCore::String  sName,
PLCore::String  sTitle,
PLCore::String  sAppDataSubdir 
)

Constructor for loading in and executing a scripted stand-alone application using just a single line of C++ code.

Parameters:
[in]cFrontendFrontend this application instance is running in
[in]sScriptFilenameFilename of the script to load
[in]sNameOptional name of the application, if empty string a name is constructed automatically by using the filename of the script
[in]sTitleOptional title of the application, if empty string a title is constructed automatically by using the filename of the script
[in]sAppDataSubdirOptional subdirectory for application data files, if empty string a directory is constructed automatically by using the filename of the script
Remarks:
		*    Usage example:
		*    int PLMain(const String &sExecutableFilename, const Array<String> &lstArguments)
		*    {
		*        return ScriptApplication("Data/Scripts/45ScriptApplication.lua").Run(sExecutableFilename, lstArguments);
		*    }
		*  

Destructor.


Member Function Documentation

Returns the base directory of the application.

Returns:
The base directory of the application
PL_API void PLEngine::ScriptApplication::SetBaseDirectory ( const PLCore::String sBaseDirectory)

Sets the base directory of the application.

Parameters:
[in]sBaseDirectoryThe base directory of the application
virtual PL_API bool PLEngine::ScriptApplication::OnStart ( ) [override, protected, virtual]

Initialization function that is called prior to OnInit()

Returns:
'true' if all went fine, else 'false' which will stop the application
Remarks:
The default implementation does the following tasks:

Reimplemented from PLEngine::EngineApplication.

virtual PL_API void PLEngine::ScriptApplication::OnStop ( ) [override, protected, virtual]

De-initialization function that is called after OnDeInit()

Remarks:
The default implementation does the following tasks:

Reimplemented from PLEngine::EngineApplication.

virtual PL_API void PLEngine::ScriptApplication::OnUpdate ( ) [override, protected, virtual]

Called to let the frontend update it's states.

Remarks:
The default implementation does the following tasks:

Reimplemented from PLEngine::EngineApplication.

PL_API bool PLEngine::ScriptApplication::LoadScript ( const PLCore::String sFilename) [protected]

Loads a script.

Parameters:
[in]sFilenameFilename of the script to load
Returns:
'true' if all went fine, else 'false'
Note:
  • Calls the optional script function <OnInitFunction>
PL_API void PLEngine::ScriptApplication::DestroyScript ( ) [protected]

Destroys the currently used script.

Note:
  • Calls the optional script function <OnDeInitFunction>

Member Data Documentation

Base directory of the currently loaded scene

Filename of the used script

Used script instance, can be a null pointer


The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:17
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported