- Note: Visit the Chroma Animation Guide to find the latest supported plugin for Chroma RGB.
Table of Contents
Docs:
- Chroma Animation Guide - Visual examples of the Chroma Animation API methods
Plugins:
- CChromaEditor - C++ native MFC library for playing and editing Chroma animations
- GameMaker 1.4 download
- Windows
-
Install Synapse
-
Make sure the Chroma Connect module is installed.
- If you don't have Chroma hardware, you can see Chroma effects with the Chroma Emulator
1 Import the GameMakerChromaExtension.gmez extension
2 Double-click the ChromaSDK
extension
3 On the Import Resources
tab, expand Included Files
, select CChromaEditorLibrary.dll
and click Import All
4 CChromaEditorLibrary.dll
should appear in your project's Included Files
folder
5 Double-click a Chroma
animation to associate the .chroma
extension with the CChromaEditor
6 Once associated, double-click a Chroma
animation to bring up the animation editor
7 In order to see the lighting animations play, use the File->Create Application
menu item to create a Windows
application. After the installer completes, the application will play Chroma
animations.
This extension supports the Chroma
animation exports from UE4, Unity, and GameMaker.
Add Chroma
animation files to the project's Included Files
to make the animations accessible from GMS
script.
- ScriptChromaCloseAnimationName
- ScriptChromaCloseComposite
- ScriptChromaCopyKeyColorName
- ScriptChromaGet1DColorName
- ScriptChromaGet2DColorName
- ScriptChromaGetCurrentFrameName
- ScriptChromaGetDeviceName
- ScriptChromaGetDeviceTypeName
- ScriptChromaGetFrameCountName
- ScriptChromaGetKeyColorName
- ScriptChromaGetMaxColumn
- ScriptChromaGetMaxLeds
- ScriptChromaGetMaxRow
- ScriptChromaInit
- ScriptChromaOpenEditorDialog
- ScriptChromaPauseAnimationName
- ScriptChromaPlayAnimationName
- ScriptChromaPlayAnimationFrameName
- ScriptChromaPlayComposite
- ScriptChromaResumeAnimationName
- ScriptChromaSet1DColorName
- ScriptChromaSet2DColorName
- ScriptChromaSetCurrentFrameName
- ScriptChromaSetKeyColorName
- ScriptChromaStopComposite
- ScriptChromaUninit
The extension methods are only available on the Windows
platform. Use GMS
to detect the Windows
os.
if (os_type == os_windows)
{
// do Chroma
}
When the first room loads, run GMS script to set the default global variables. These globals are what connects the Chroma
DLL methods.
See ScriptGlobals.gml.
The API has various methods with the D
suffix where double
return-type/parameters were used. This is to support engines like GameMaker
which have a limited number of data-types.
ScriptChromaCloseAnimationName
The helper script closes an animation to reload from disk. The method takes a string parameter of the animation name.
animation = 'Random_Keyboard.chroma';
ScriptChromaCloseAnimationName(animation);
The helper script copies the key color from a source animation to the target animation for the key of the animation frame. The source and target animation are strings. The frame index is a number from 0 to the frame count. The key is a integer of the key number.
See ScriptGlobals.gml for the list of key values.
sourceAnimation = 'Fire_Keyboard.chroma';
targetAnimation = 'Random_Keyboard.chroma';
frameIndex = 0;
key = gloval.RZKEY_W;
ScriptChromaCopyKeyColorName(sourceAnimation, targetAnimation, frameIndex, key);
The helper script returns the number of animation frames. The animation parameter is a string.
animation = 'Random_Keyboard.chroma';
frameCount = ScriptChromaGetFrameCountName(animation);
The helper script initializes the ChromaSDK
and has no parameters.
ScriptChromaInit();
The helper script opens an edit dialog for the animation. The animation parameter is a string. The edit dialog is modal so only one animation can be edited at a time.
animation = 'Random_Keyboard.chroma';
ScriptChromaOpenEditorDialog(animation);
ScriptChromaPauseAnimationName
The helper script pauses an animation. The animation parameter is a string.
animation = 'Random_Keyboard.chroma';
ScriptChromaPauseAnimationName(animation);
The helper script plays an animation. The animation parameter is a string. The animation can play with loop ON
or OFF
.
animation = 'Random_Keyboard.chroma';
loopOn = 1.0;
loopOff = 0.0;
loop = loopOn;
ScriptChromaPlayAnimationName(animation, loop);
ScriptChromaPlayAnimationFrameName
The helper script plays an animation. The animation parameter is a string. The animation can play with loop ON
or OFF
starting at the frameId
.
animation = 'Random_Keyboard.chroma';
loopOn = 1.0;
loopOff = 0.0;
loop = loopOn;
frameId = 12;
ScriptChromaPlayAnimationFrameName(animation, frameId, loop);
The helper script plays a set of animations. The composite is a string. The animation can play with loop ON
or OFF
. This method will play the set of animations which includes ChromaLink, Headset, Keyboard, Keypad, Mouse, and Mousepad.
composite = "Random";
loopOn = 1.0;
loopOff = 0.0;
loop = loopOn;
ScriptChromaPlayComposite(composite, loop);
ScriptChromaResumeAnimationName
The helper script will resume playing a paused animation. The animation is a string. The animation can resume with loop ON
or OFF
.
animation = 'Random_Keyboard.chroma';
loopOn = 1.0;
loopOff = 0.0;
loop = loopOn;
ScriptChromaResumeAnimationName(animation, loop);
The helper script assigns the key color to the animation frame. The animation is a string. The frame index is a number from 0 to the frame count. The key the integer of the key number. The color is a COLORREF
integer.
See ScriptGlobals.gml for the list of key values.
animation = 'Random_Keyboard.chroma';
frameIndex = 0;
key = global.RZKEY_W;
red = ScriptToBGRInt(255, 0, 0);
green = ScriptToBGRInt(0, 255, 0);
blue = ScriptToBGRInt(0, 0, 255);
color = red;
ScriptChromaSetKeyColorName(animation, frameIndex, key, color);
The helper script gets the key color of the animation frame. The animation is a string. The frame index is a number from 0 to the frame count. The key the integer of the key number. The color is a COLORREF
integer.
See ScriptGlobals.gml for the list of key values.
animation = 'Random_Keyboard.chroma';
frameIndex = 0;
key = global.RZKEY_W;
color = ScriptChromaGetKeyColorName(animation, frameIndex, key);
The helper script stops a set of animations. The composite is a string. This method will stop the set of animations which includes ChromaLink, Headset, Keyboard, Keypad, Mouse, and Mousepad.
composite = "Random";
ScriptChromaStopComposite(composite);
The helper script uninitializes the ChromaSDK
and has no parameters.
ScriptChromaInit();
The helper script closes a set of animations so they can be reloaded from disk. The set of animations will be stopped if playing.
composite = "Random";
ScriptChromaCloseComposite(composite);
The helper script gets the animation color for a frame given the 1D led. The led should be greater than or equal to 0 and less than the MaxLeds.
animation1D = 'Random_ChromaLink.chroma';
frameCount = ScriptChromaGetFrameCountName(animation1D);
device = ScriptChromaGetDeviceName(animation1D);
maxLeds = ScriptChromaGetMaxLeds(device);
for (frameIndex = 0; frameIndex < frameCount; ++frameIndex)
{
for (led = 0; led < maxLeds; ++led)
{
color = ScriptChromaGet1DColorName(animation1D, frameIndex, led);
}
}
The helper script gets the animation color for a frame given the 2D row and column. The row should be greater than or equal to 0 and less than the MaxRow. The column should be greater than or equal to 0 and less than the MaxColumn
animation2D = 'Random_Keyboard.chroma'
frameCount = ScriptChromaGetFrameCountName(animation2D);
device = ScriptChromaGetDeviceName(animation2D);
maxRow = ScriptChromaGetMaxRow(device);
maxColumn = ScriptChromaGetMaxColumn(device);
for (frameIndex = 0; frameIndex < frameCount; ++frameIndex)
{
for (i = 0; i < maxRow; ++i)
{
for (j = 0; j < maxColumn; ++j)
{
rowColumnIndex = i * maxColumn + j; // only 4 params allowed for DLL methods when string is involved
color = ScriptChromaGet2DColorName(animation2D, frameIndex, rowColumnIndex);
}
}
}
ScriptChromaGetCurrentFrameName
The helper script gets the current frame of an animation.
animation2D = 'Random_Keyboard.chroma'
currentFrame = ScriptChromaGetCurrentFrameName(animation2D);
ScriptChromaSetCurrentFrameName
The helper script sets the current frame of an animation.
animation2D = 'Random_Keyboard.chroma'
frameId = 12;
ScriptChromaSetCurrentFrameName(animation2D, frameId);
The helper script returns a number from the EChromaSDKDevice1DEnum or EChromaSDKDevice2DEnum of a Chroma animation respective to the deviceType, as an integer upon success. Returns -1 upon failure.
// 1D device
animation1D = 'Random_ChromaLink.chroma';
device = ScriptChromaGetDeviceName(animation2D);
// 2D device
animation2D = 'Random_Keyboard.chroma'
device = ScriptChromaGetDeviceName(animation2D);
The helper script returns a number from the EChromaSDKDeviceTypeEnum of a Chroma animation as an integer upon success. Returns -1 upon failure.
// 1D device type
animation1D = 'Random_ChromaLink.chroma';
deviceType = ScriptChromaGetDeviceTypeName(animation2D);
// 2D device type
animation2D = 'Random_Keyboard.chroma'
deviceType = ScriptChromaGetDeviceTypeName(animation2D);
The helper script returns the MAX COLUMN given the EChromaSDKDevice2DEnum device as an integer upon success. Returns -1 upon failure.
animation2D = 'Random_Keyboard.chroma'
device = ScriptChromaGetDeviceName(animation2D);
maxColumn = ScriptChromaGetMaxColumn(device);
The helper script returns the MAX LEDS given the EChromaSDKDevice1DEnum device as an integer upon success. Returns -1 upon failure.
animation1D = 'Random_ChromaLink.chroma';
device = ScriptChromaGetDeviceName(animation1D);
maxLeds = ScriptChromaGetMaxLeds(device);
The helper script returns the MAX ROW given the EChromaSDKDevice2DEnum device as an integer upon success. Returns -1 upon failure.
animation2D = 'Random_Keyboard.chroma'
device = ScriptChromaGetDeviceName(animation2D);
maxRow = ScriptChromaGetMaxRow(device);
The helper script sets the animation color for a frame given the 1D led. The led should be greater than or equal to 0 and less than the MaxLeds.
green = ScriptToBGRInt(0, 255, 0);
color = green;
animation1D = 'Random_ChromaLink.chroma';
ScriptChromaCloseAnimationName(animation1D);
frameCount = ScriptChromaGetFrameCountName(animation1D);
device = ScriptChromaGetDeviceName(animation1D);
maxLeds = ScriptChromaGetMaxLeds(device);
for (frameIndex = 0; frameIndex < frameCount; ++frameIndex)
{
for (led = 0; led < maxLeds; ++led)
{
ScriptChromaSet1DColorName(animation1D, frameIndex, led, color);
}
}
ScriptChromaPlayAnimationName(animation1D, 1.0);
The helper script sets the animation color for a frame given the 2D row and column. The row should be greater than or equal to 0 and less than the MaxRow. The column should be greater than or equal to 0 and less than the MaxColumn.
animation2D = 'Random_Keyboard.chroma'
ScriptChromaCloseAnimationName(animation2D);
frameCount = ScriptChromaGetFrameCountName(animation2D);
device = ScriptChromaGetDeviceName(animation2D);
maxRow = ScriptChromaGetMaxRow(device);
maxColumn = ScriptChromaGetMaxColumn(device);
for (frameIndex = 0; frameIndex < frameCount; ++frameIndex)
{
for (i = 0; i < maxRow; ++i)
{
for (j = 0; j < maxColumn; ++j)
{
rowColumnIndex = i * maxColumn + j; // only 4 params allowed for DLL methods when string is involved
ScriptChromaSet2DColorName(animation2D, frameIndex, rowColumnIndex, color);
}
}
}
ScriptChromaPlayAnimationName(animation2D, 1.0);
ScriptAnimateOnKeyRelease.gml - detects key released events to invoke methods. This script is called from the room object released keyboard event.
ScriptDrawUI.gml - displays the keyboard shortcuts for the example. This script is called from the room object draw event.
ScriptGlobals.gml - initializes the globals and sets the DLL extension methods. This script is called from the room object create event. This is also where the keyboard enums are listed.
ScriptToBGRInt.gml - Converts red (0 to 255), green (0 to 255), blue (0 to 255) arguments into a BGR integer COLORREF
.
Helper scripts wrap the Chroma DLL methods to make sure only defined methods are invoked.