public bool Start()
        {
            // try
            // {
            var appInfo = new APPINFOTYPE
            {
                Title           = "RainbowKnight",
                Description     = "Hollow Knight RainbowKnight mod",
                Author_Name     = "Webcretaire",
                Author_Contact  = "https://github.com/Webcretaire/HollowKnight.RainbowKnight",
                SupportedDevice = (int)ChromaAnimationAPI.Device.Keyboard |
                                  (int)ChromaAnimationAPI.Device.Mouse |
                                  (int)ChromaAnimationAPI.Device.ChromaLink,
                Category = 0x02     // 0x01 = Utility ; 0x02 = Game
            };

            _mResult = ChromaAnimationAPI.InitSDK(ref appInfo);
            switch (_mResult)
            {
            case RazerErrors.RZRESULT_DLL_NOT_FOUND:
                LogError("Chroma DLL is not found! " + RazerErrors.GetResultString(_mResult));
                return(false);

            case RazerErrors.RZRESULT_DLL_INVALID_SIGNATURE:
                LogError("Chroma DLL has an invalid signature! " + RazerErrors.GetResultString(_mResult));
                return(false);

            case RazerErrors.RZRESULT_SUCCESS:
                return(true);

            default:
                LogError("Failed to initialize Chroma! " + RazerErrors.GetResultString(_mResult));
                return(false);
            }
            // }
            // catch (Exception e)
            // {
            //     LogError("Error during Chroma Helper Start: " + e.Message);
            //     return false;
            // }
        }
    public IEnumerator Start()
    {
        ChromaAnimationAPI._sStreamingAssetPath = Application.streamingAssetsPath;

        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);
        appInfo.Category        = 1;
        int result = ChromaAnimationAPI.InitSDK(ref appInfo);

        switch (result)
        {
        case RazerErrors.RZRESULT_DLL_NOT_FOUND:
            Debug.LogError(string.Format("Chroma DLL is not found! {0}", RazerErrors.GetResultString(result)));
            yield break;

        case RazerErrors.RZRESULT_DLL_INVALID_SIGNATURE:
            Debug.LogError(string.Format("Chroma DLL has an invalid signature! {0}", RazerErrors.GetResultString(result)));
            yield break;

        case RazerErrors.RZRESULT_SUCCESS:
            Debug.Log("ChromaSDK initialized!");
            yield return(new WaitForSeconds(0.1f));

            break;

        default:
            Debug.LogError(string.Format("Failed to initialize Chroma! {0}", RazerErrors.GetResultString(result)));
            yield break;
        }

        // setup scene
        _mScene = new Scene();

        Effect effect = new Effect();

        effect._mAnimation = "Animations/Landscape";
        effect._mSpeed     = 1;
        effect._mBlend     = "none";
        effect._mState     = false;
        effect._mMode      = "replace";
        _mScene._mEffects.Add(effect);
        _mIndexLandscape = (int)_mScene._mEffects.Count - 1;

        effect             = new Effect();
        effect._mAnimation = "Animations/Fire";
        effect._mSpeed     = 1;
        effect._mBlend     = "none";
        effect._mState     = false;
        effect._mMode      = "replace";
        _mScene._mEffects.Add(effect);
        _mIndexFire = (int)_mScene._mEffects.Count - 1;

        effect             = new Effect();
        effect._mAnimation = "Animations/Rainbow";
        effect._mSpeed     = 1;
        effect._mBlend     = "none";
        effect._mState     = false;
        effect._mMode      = "replace";
        _mScene._mEffects.Add(effect);
        _mIndexRainbow = (int)_mScene._mEffects.Count - 1;

        effect             = new Effect();
        effect._mAnimation = "Animations/Spiral";
        effect._mSpeed     = 1;
        effect._mBlend     = "none";
        effect._mState     = false;
        effect._mMode      = "replace";
        _mScene._mEffects.Add(effect);
        _mIndexSpiral = (int)_mScene._mEffects.Count - 1;

        ThreadStart ts = new ThreadStart(GameLoop);

        _mThread = new Thread(ts);
        _mThread.Start();
    }
Esempio n. 3
0
        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;
        }