The C++ API tries to abstract the interfaces of various platform implementations. This necessitates several custom types that allow identification of the service the data originates from, as well as custom events and classes that allow interaction with the various systems of the platform service.
If you are using a custom CRYENGINE project, you can include the interface directory by adding a line to your project's CMakelists.txt file. Since the CMakelists.txt file is regenerated when a solution for your project is generated, the file has a special section that is copied with each regeneration of the file.
Look for the following block:
#BEGIN-CUSTOM
# Make any custom changes here, modifications outside of the block will be discarded on regeneration.
#END-CUSTOM
And change it to the following:
#BEGIN-CUSTOM
# Make any custom changes here, modifications outside of the block will be discarded on regeneration.
target_include_directories(${THIS_PROJECT}
PRIVATE
"${CRYENGINE_DIR}/Code/CryPlugins/CryGamePlatform/Interface"
"${CRYENGINE_DIR}/Code/CryPlugins/CryGamePlatformNodes/Interface"
)
#END-CUSTOM
The following example demonstrates how to make use of the GamePlatformPlugin and, in fact, any other CryPlugin Modules.
// Include CryGamePlatform core module
#include <IGamePlatform.h>
// Include CryGamePlatformNodes module
#include <IPlugin.h>
// Include Plugin Helper
#include <Utils/PluginUtils.h>
void UseGamePlatformCore()
{
if (auto pGamePlatform = Cry::GamePlatform::CPluginHelper<Cry::GamePlatform::IPlugin>::Get())
{
...
}
}
void UseGamePlatformNodes()
{
if (auto pGamePlatformNodes = Cry::GamePlatform::CPluginHelper<Cry::GamePlatform::IPlugin_GamePlatformNodes>::Get())
{
...
}
}
Each platform service has a unique 128 bit identifier.
Identifiers also allow the usage of integer based, or string based data, depending on the requirements of the platform the identifier is used for.