Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Application

Add this in your code:

#include <engine/application.h>

Description

Class used to manage the application and get information about it.

Static methods


OpenURL

Opens the link in a web browser (Only for Windows).

void OpenURL(const std::string& url)

Code sample:

Application::OpenURL("https://google.com");

Quit

Quits the application.

void Quit()

Code sample:

Application::Quit();

GetPlatform

Returns the current platform the application is running on.

Platform GetPlatform()

Code sample:

if(Application::GetPlatform() == Platform::P_PSP)
{
    Debug::Print("Running on PSP!");
}

GetXenityVersion

Returns the current version of Xenity Engine.

std::string GetXenityVersion()

Code sample:

if(Application::GetXenityVersion() == "1.0.0")
{
    // Special behavior for a specific version of the engine
}
else
{
    // ...
}

GetGameName

Returns the name of the game.

std::string GetGameName()

Code sample:

Debug::Print("Game name: " + Application::GetGameName());

GetCompanyName

Returns the name of the company.

std::string GetCompanyName()

Code sample:

Debug::Print("Company name: " + Application::GetCompanyName());

IsInEditor

Returns if the application is running in the editor.

bool IsInEditor()

Code sample:

if(Application::IsInEditor())
{
    Debug::Print("Running in editor!");
}
else
{
    Debug::Print("Not running in editor!");
}

// For something at compile time
#if defined(EDITOR)
    Debug::Print("Running in editor!");
#else
    Debug::Print("Not running in editor!");
#endif

GetGameDataFolder

Return the game folder (folder where you can write data).

bool GetGameDataFolder()

Code sample:

std::string fileName = Application::GetGameDataFolder() + "my_file.txt";
std::shared_ptr<File> myFile = FileSystem::MakeFile(fileName);
bool isOpened = myFile->Open(FileMode::WriteCreateFile);

GetGameFolder

Returns the game folder (folder where the game is located, may be read-only).

bool GetGameFolder()

Code sample:

std::string fileName = Application::GetGameFolder() + "my_file.txt";
std::shared_ptr<File> myFile = FileSystem::MakeFile(fileName);
bool isOpened = myFile->Open(FileMode::ReadOnly);