Initialize the Chroma SDK in order to utilize the API. The InitSDK
method takes an AppInfo
parameter which defines the application or game details that will appear in the Chroma App
within the Chroma Apps
tab. The expected return result should be zero for success which indicates the API is ready for use. If a non-zero result is returned, the Chroma implementation should be disabled until the next time the application or game is launched. Reasons for failure are likely to be the user does not have the Synapse
or the Chroma App
installed. After successfully initializing the Chroma SDK, wait approximately 100 ms before playing Chroma Animations.
FChromaSDKAppInfoType appInfo;
appInfo.Title = "Unreal Sample Scene - Chromatic";
appInfo.Description = "A sample application using Razer Chroma SDK";
appInfo.Author_Name = "Razer";
appInfo.Author_Contact = "https://developer.razer.com/chroma";
//appInfo.SupportedDevice =
// 0x01 | // Keyboards
// 0x02 | // Mice
// 0x04 | // Headset
// 0x08 | // Mousepads
// 0x10 | // Keypads
// 0x20 // ChromaLink devices
// ;
appInfo.SupportedDevice = (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20);
// 0x01 | // Utility. (To specifiy this is an utility application)
// 0x02 // Game. (To specifiy this is a game);
appInfo.Category = 1;
int result = UChromaSDKPluginBPLibrary::ChromaSDKInitSDK(appInfo);
if (result == 0)
{
// Init Success! Ready to use the Chroma SDK!
}
else
{
// Init Failed! Stop using the Chroma SDK until the next game launch!";
}
Applications should uninitialize the Chroma SDK with Uninit() for a clean exit. Uninitialization is only needed if the Chroma SDK was successfully initialized.
int result = UChromaSDKPluginBPLibrary::ChromaSDKUnInit();
if (result == 0)
{
// Chroma has been uninitialized!
}
else
{
// Uninitialization was unsuccessful!
}