コード例 #1
0
        private void Init()
        {
            // TODO: Check synapse version. https://chromasdk.io:54236/razer/chromasdk Version must be >= 3.X
            int status = 0;

            try
            {
                status = ChromaAnimationAPI.Init();
                if (status != 0)
                {
                    throw new InvalidOperationException("Chroma SDK exception. Status " + status);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error initializing Razer Chroma controller. Is Razer Synapse installed? Status=" + status);
                throw new InvalidOperationException("Error initializing Razer Chroma controller. Is Razer Synapse installed?", e);
            }
            baseKeyboardAnim = ChromaAnimationAPI.CreateAnimationInMemory((int)ChromaAnimationAPI.DeviceType.DE_2D, (int)ChromaAnimationAPI.Device2D.Keyboard);
            if (baseKeyboardAnim == -1)
            { // TODO: Returns -1 if the keyboard is not connected? Check how it works
                MessageBox.Show("Error initializing Razer Chroma controller. Check that your keyboard is connected and Razer Synapse is installed");
                throw new InvalidOperationException("CreateAnimationInMemory ChromaSDK returned -1");
            }
            // is AddFrame needed?
            ChromaAnimationAPI.AddFrame(baseKeyboardAnim, 1, new int[MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS], MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS);
        }
コード例 #2
0
    void SetupAnimation2D(string path, Device2D device)
    {
        int animationId = ChromaAnimationAPI.GetAnimation(path);

        if (animationId == -1)
        {
            animationId = ChromaAnimationAPI.CreateAnimationInMemory((int)DeviceType.DE_2D, (int)device);
            ChromaAnimationAPI.CopyAnimation(animationId, path);
            ChromaAnimationAPI.CloseAnimation(animationId);
            ChromaAnimationAPI.MakeBlankFramesName(path, 1, 0.1f, 0);
        }
    }
コード例 #3
0
        private int CreateAnimation(ChromaAnimationAPI.DeviceType deviceType, int device)
        {
            int anim = ChromaAnimationAPI.CreateAnimationInMemory((int)deviceType, device);

            if (anim == -1)
            {
                MessageBox.Show("Error initializing Razer Chroma controller. CreateAnimationInMemory returned -1. " +
                                "Check that your mouse is connected and Razer Synapse is installed");
                throw new InvalidOperationException("CreateAnimationInMemory ChromaSDK returned -1");
            }
            return(anim);
        }