Emergency 20 Dokumentation  4.2.0
em5::Application Class Reference

EMERGENCY 5 application implementation. More...

#include <Application.h>

Inheritance diagram for em5::Application:
qsf::game::GameApplication qsf::UniqueInstance< Application > qsf::WindowApplication qsf::TimedApplication qsf::Application qsf::Object

Classes

struct  StartupSettings
 

Public Member Functions

 Application ()
 Default constructor. More...
 
virtual ~Application ()
 Destructor. More...
 
std::string getUpdaterApplicationName () const
 Get application name sent to the patch server. More...
 
const boost::property_tree::ptreegetCustomizedParametersPTree () const
 Return the customized application parameters. More...
 
GamegetGame () const
 Return the EMERGENCY 5 game instance. More...
 
EmergencyGuigetGui () const
 Return the EMERGENCY 5 GUI instance. More...
 
EmergencyGuitryGetGui () const
 Return the EMERGENCY 5 GUI instance. More...
 
NetworkManagergetNetworkManager () const
 Return the EM5 network manager instance. More...
 
PlayerProgressgetPlayerProgress () const
 Return the EM5 player progress instance. More...
 
AccountManagergetAccountManager () const
 Return the EM5 account manager instance. More...
 
ContentAuthenticationgetContentAuthentication () const
 Return the EM5 content authentication instance. More...
 
qsf::game::StoreManagergetStoreManager () const
 Return the store manager instance. More...
 
bool isInStartMenu () const
 Return whether the application is in start menu ("launcher") right now. More...
 
void triggerGotoLogoScreen ()
 Switch to the logo screen. More...
 
void triggerGotoMainMenu ()
 Switch to the main menu. More...
 
void triggerStartGame ()
 Switch to the game. More...
 
void triggerStopGame ()
 Switch from game to the main menu. More...
 
bool areCheatsEnabled () const
 
void enableCheats ()
 
bool areRewardsEnabled () const
 Check whether the user may submit online highscores or gain achievements. More...
 
std::string getLauncherChecksum () const
 Get md5 checksum from em5_launcher.exe. More...
 
bool getSkipStartMenu () const
 Return the "SkipStartMenu" value from the startup settings. More...
 
void showDebugVersionInformation (bool show)
 
virtual uint32 getId () override
 Return the unique application identifier. More...
 
- Public Member Functions inherited from qsf::game::GameApplication
 GameApplication ()
 Constructor. More...
 
virtual ~GameApplication ()
 Destructor. More...
 
void exit ()
 Ask the application politely to shut down as soon as possible. More...
 
const std::string & getInstallationVersion () const
 Get installation version string, e.g. "1.0.0". More...
 
void saveSettings ()
 Save all settings. More...
 
void realTimeClockUpdate ()
 Call the updateRealTimeClock function. More...
 
- Public Member Functions inherited from qsf::WindowApplication
virtual ~WindowApplication ()
 Destructor. More...
 
RenderWindowgetRenderWindow () const
 Return the QSF render window instance. More...
 
virtual void setWindowToUserSettings ()
 Set the window settings to user user settings. More...
 
- Public Member Functions inherited from qsf::TimedApplication
virtual ~TimedApplication ()
 Destructor. More...
 
RealTimeClockgetRealTimeClock () const
 Return the real-time clock instance. More...
 
float getFpsLimitation () const
 Return the enforced frames per second (FPS) limitation. More...
 
void setFpsLimitation (float fpsLimitation)
 Set enforced frames per second (FPS) limitation. More...
 
- Public Member Functions inherited from qsf::Application
const std::vector< std::string > & getProgramOptions () const
 Return the program options array. More...
 
const boost::property_tree::ptreegetParametersPTree () const
 Return the application parameters. More...
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Static Public Attributes

static const uint32 APPLICATION_ID
 "em5::Application" unique ID More...
 
static const std::string LAUNCHER_EXE_PATH
 "/bin/em5_launcher.exe" More...
 
- Static Public Attributes inherited from qsf::WindowApplication
static const uint32 APPLICATION_ID
 "qsf::WindowApplication" unique ID More...
 
- Static Public Attributes inherited from qsf::TimedApplication
static const uint32 APPLICATION_ID
 "qsf::TimedApplication" unique ID More...
 

Protected Member Functions

virtual bool onStartup () override
 Startup the application. More...
 
virtual int onRun () override
 Run the application. More...
 
virtual void onShutdown () override
 Shutdown the application. More...
 
virtual void getWindowSize (bool &fullscreen, uint32 &width, uint32 &height) override
 Get the window size and fullscreen flag. More...
 
virtual void onRenderWindowFirstPreShow () override
 This method is called when the render window is about to be shown for the first time. More...
 
virtual void setDefaultWindowIcon () override
 Set a default window icon. More...
 
virtual void onVersionJsonLoaded (const boost::property_tree::ptree &pTree) override
 
- Protected Member Functions inherited from qsf::game::GameApplication
std::string getAbsoluteSettingsPrefix () const
 
void initInstallationVersion (const std::string &applicationName, const std::string &binariesVersion)
 
void loadApplicationProperties ()
 
bool loadDeveloperParameters (const std::string &filename, boost::property_tree::ptree &parametersPTree) const
 
- Protected Member Functions inherited from qsf::WindowApplication
virtual bool getModifySystemCursorVisibilityOnFullscreenToggleAllowed () const
 Return if the visibility of the system mouse cursor should be modified on fullscreen toggle. More...
 
 WindowApplication ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::TimedApplication
 TimedApplication ()
 Default constructor. More...
 
void updateRealTimeClock ()
 Update real-time clock. More...
 
- Protected Member Functions inherited from qsf::Application
 Application ()
 Default constructor. More...
 
void initializeOptionsAndParameters (const std::vector< std::string > &programOptions, const boost::property_tree::ptree &parametersPTree)
 Initialization call after construction. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::UniqueInstance< Application >
 UniqueInstance ()
 Default constructor. More...
 
virtual ~UniqueInstance ()
 Destructor. More...
 

Friends

class StartMenuInstalled
 

Additional Inherited Members

- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 
- Static Public Member Functions inherited from qsf::UniqueInstance< Application >
static ApplicationgetInstance ()
 Return the global unique instance. More...
 
static ApplicationgetInstanceSafe ()
 Return the global unique instance. More...
 
- Protected Attributes inherited from qsf::game::GameApplication
bool mExit
 If "true", shut down the application as soon as possible, else keep on running. More...
 
std::string mInstallationVersion
 Installed version of either application or content - whatever is newer. More...
 
- Protected Attributes inherited from qsf::TimedApplication
RealTimeClockmRealTimeClock
 Real-time clock used to update the job system, always valid, we have to destroy the instance in case we no longer need it. More...
 

Detailed Description

EMERGENCY 5 application implementation.

Constructor & Destructor Documentation

em5::Application::Application ( )

Default constructor.

virtual em5::Application::~Application ( )
virtual

Destructor.

Reimplemented from qsf::Application.

Member Function Documentation

bool em5::Application::areCheatsEnabled ( ) const
inline
bool em5::Application::areRewardsEnabled ( ) const

Check whether the user may submit online highscores or gain achievements.

void em5::Application::enableCheats ( )
AccountManager & em5::Application::getAccountManager ( ) const
inline

Return the EM5 account manager instance.

Returns
Reference to the EM5 account manager instance, do not destroy the instance
ContentAuthentication & em5::Application::getContentAuthentication ( ) const
inline

Return the EM5 content authentication instance.

Returns
Reference to the EM5 content authentication instance, do not destroy the instance
const boost::property_tree::ptree & em5::Application::getCustomizedParametersPTree ( ) const
inline

Return the customized application parameters.

Returns
Customized application-specific parameters as a generic Boost property tree
Game & em5::Application::getGame ( ) const
inline

Return the EMERGENCY 5 game instance.

Returns
Reference to the EM5 game instance, do not destroy the instance
EmergencyGui & em5::Application::getGui ( ) const
inline

Return the EMERGENCY 5 GUI instance.

Returns
Reference to the EMERGENCY 5 GUI instance, do not destroy the instance
virtual uint32 em5::Application::getId ( )
overridevirtual

Return the unique application identifier.

Returns
The unique application identifier
Note
  • The unique application identifier is generated by "qsf::StringHash" by using the class name (e.g. qsf::StringHash("qsf::MetadataComponent") generating the hash value 483975945)

Reimplemented from qsf::WindowApplication.

std::string em5::Application::getLauncherChecksum ( ) const

Get md5 checksum from em5_launcher.exe.

NetworkManager & em5::Application::getNetworkManager ( ) const
inline

Return the EM5 network manager instance.

Returns
Reference to the EM5 network manager instance, do not destroy the instance
PlayerProgress & em5::Application::getPlayerProgress ( ) const
inline

Return the EM5 player progress instance.

Returns
Reference to the EM5 player progress instance, do not destroy the instance
bool em5::Application::getSkipStartMenu ( ) const

Return the "SkipStartMenu" value from the startup settings.

qsf::game::StoreManager & em5::Application::getStoreManager ( ) const
inline

Return the store manager instance.

Returns
Reference to the store manager instance, do not destroy the instance
std::string em5::Application::getUpdaterApplicationName ( ) const

Get application name sent to the patch server.

virtual void em5::Application::getWindowSize ( bool &  fullscreen,
uint32 width,
uint32 height 
)
overrideprotectedvirtual

Get the window size and fullscreen flag.

Note
The default implementation returns the default window size and fullscreen mode

Reimplemented from qsf::WindowApplication.

bool em5::Application::isInStartMenu ( ) const
inline

Return whether the application is in start menu ("launcher") right now.

virtual void em5::Application::onRenderWindowFirstPreShow ( )
overrideprotectedvirtual

This method is called when the render window is about to be shown for the first time.

Note
  • The default implementation is empty

Reimplemented from qsf::WindowApplication.

virtual int em5::Application::onRun ( )
overrideprotectedvirtual

Run the application.

Returns
Exit code of the application (usually 0 means no error)
Remarks
The default implementation does the following tasks:
  • Loop until the render window gets closed, updates a realtime clock internally
Note
  • Only called in case "onStartup()" returned successfully

Reimplemented from qsf::WindowApplication.

virtual void em5::Application::onShutdown ( )
overrideprotectedvirtual

Shutdown the application.

Remarks
The default implementation does the following tasks:
  • Destroy the render window
Note
  • Only called in case "onStartup()" returned successfully

Reimplemented from qsf::WindowApplication.

virtual bool em5::Application::onStartup ( )
overrideprotectedvirtual

Startup the application.

Returns
"true" if all went fine, else "false"
Remarks
The default implementation does the following tasks:
  • Create the render window, it stays valid until it's destroyed within "qsf::WindowApplication::onShutdown()"

Reimplemented from qsf::WindowApplication.

virtual void em5::Application::onVersionJsonLoaded ( const boost::property_tree::ptree pTree)
overrideprotectedvirtual

Reimplemented from qsf::game::GameApplication.

virtual void em5::Application::setDefaultWindowIcon ( )
overrideprotectedvirtual

Set a default window icon.

Remarks
The default implementation tries to find a default icon for the window in the following order:
  • First try: Try to use the default icon of the shared library this application instance is in
  • Second try: Use the default process icon... if there's one...
  • Third try: If there's no default process icon, we're using the standard QSF icon MS Windows: As default windows icon resource ID we have chosen "101".

Reimplemented from qsf::WindowApplication.

void em5::Application::showDebugVersionInformation ( bool  show)
void em5::Application::triggerGotoLogoScreen ( )

Switch to the logo screen.

void em5::Application::triggerGotoMainMenu ( )

Switch to the main menu.

void em5::Application::triggerStartGame ( )

Switch to the game.

Note
  • Make sure to set everything needed inside "EM5_GAME.getGameSessionConfiguration()" before calling this
void em5::Application::triggerStopGame ( )

Switch from game to the main menu.

EmergencyGui * em5::Application::tryGetGui ( ) const
inline

Return the EMERGENCY 5 GUI instance.

Returns
Pointer to the EMERGENCY 5 GUI instance, null pointer if there's no GUI instance, do not destroy the instance

Friends And Related Function Documentation

friend class StartMenuInstalled
friend

Member Data Documentation

const uint32 em5::Application::APPLICATION_ID
static

"em5::Application" unique ID

const std::string em5::Application::LAUNCHER_EXE_PATH
static

"/bin/em5_launcher.exe"


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