void BlendAnimations(FChromaSDKScene scene, int[] colorsChromaLink, int[] tempColorsChromaLink, int[] colorsHeadset, int[] tempColorsHeadset, int[] colorsKeyboard, int[] tempColorsKeyboard, int[] colorsKeypad, int[] tempColorsKeypad, int[] colorsMouse, int[] tempColorsMouse, int[] colorsMousepad, int[] tempColorsMousepad) { // blend active animations List <FChromaSDKSceneEffect> effects = scene._mEffects; foreach (FChromaSDKSceneEffect effect in effects) { if (effect._mState) { FChromaSDKDeviceFrameIndex deviceFrameIndex = effect._mFrameIndex; //iterate all device types for (int d = (int)Device.ChromaLink; d < (int)Device.MAX; ++d) { string animationName = effect._mAnimation; switch ((Device)d) { case Device.ChromaLink: animationName += "_ChromaLink.chroma"; BlendAnimation1D(effect, deviceFrameIndex, d, Device1D.ChromaLink, animationName, colorsChromaLink, tempColorsChromaLink); break; case Device.Headset: animationName += "_Headset.chroma"; BlendAnimation1D(effect, deviceFrameIndex, d, Device1D.Headset, animationName, colorsHeadset, tempColorsHeadset); break; case Device.Keyboard: animationName += "_Keyboard.chroma"; BlendAnimation2D(effect, deviceFrameIndex, d, Device2D.Keyboard, animationName, colorsKeyboard, tempColorsKeyboard); break; case Device.Keypad: animationName += "_Keypad.chroma"; BlendAnimation2D(effect, deviceFrameIndex, d, Device2D.Keypad, animationName, colorsKeypad, tempColorsKeypad); break; case Device.Mouse: animationName += "_Mouse.chroma"; BlendAnimation2D(effect, deviceFrameIndex, d, Device2D.Mouse, animationName, colorsMouse, tempColorsMouse); break; case Device.Mousepad: animationName += "_Mousepad.chroma"; BlendAnimation1D(effect, deviceFrameIndex, d, Device1D.Mousepad, animationName, colorsMousepad, tempColorsMousepad); break; } } } } }
public void Start() { ChromaSDK.APPINFOTYPE appInfo = new APPINFOTYPE(); appInfo.Title = "Razer Chroma CSharp Game Loop Sample Application"; 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; _mResult = ChromaAnimationAPI.InitSDK(ref appInfo); switch (_mResult) { case RazerErrors.RZRESULT_DLL_NOT_FOUND: Console.Error.WriteLine("Chroma DLL is not found! {0}", RazerErrors.GetResultString(_mResult)); return; case RazerErrors.RZRESULT_DLL_INVALID_SIGNATURE: Console.Error.WriteLine("Chroma DLL has an invalid signature! {0}", RazerErrors.GetResultString(_mResult)); return; case RazerErrors.RZRESULT_SUCCESS: Thread.Sleep(100); break; default: Console.Error.WriteLine("Failed to initialize Chroma! {0}", RazerErrors.GetResultString(_mResult)); return; } // setup scene _mScene = new FChromaSDKScene(); FChromaSDKSceneEffect effect = new FChromaSDKSceneEffect(); effect._mAnimation = "Animations/Landscape"; effect._mSpeed = 1; effect._mBlend = EChromaSDKSceneBlend.SB_None; effect._mState = false; effect._mMode = EChromaSDKSceneMode.SM_Add; _mScene._mEffects.Add(effect); _mIndexLandscape = (int)_mScene._mEffects.Count - 1; effect = new FChromaSDKSceneEffect(); effect._mAnimation = "Animations/Fire"; effect._mSpeed = 1; effect._mBlend = EChromaSDKSceneBlend.SB_None; effect._mState = false; effect._mMode = EChromaSDKSceneMode.SM_Add; _mScene._mEffects.Add(effect); _mIndexFire = (int)_mScene._mEffects.Count - 1; effect = new FChromaSDKSceneEffect(); effect._mAnimation = "Animations/Rainbow"; effect._mSpeed = 1; effect._mBlend = EChromaSDKSceneBlend.SB_None; effect._mState = false; effect._mMode = EChromaSDKSceneMode.SM_Add; _mScene._mEffects.Add(effect); _mIndexRainbow = (int)_mScene._mEffects.Count - 1; effect = new FChromaSDKSceneEffect(); effect._mAnimation = "Animations/Spiral"; effect._mSpeed = 1; effect._mBlend = EChromaSDKSceneBlend.SB_None; effect._mState = false; effect._mMode = EChromaSDKSceneMode.SM_Add; _mScene._mEffects.Add(effect); _mIndexSpiral = (int)_mScene._mEffects.Count - 1; }