Ejemplo n.º 1
0
        private int CalculateScaledDelay(KeyPressInfo info)
        {
            // Number of miliseconds in a minute divided by the number of commands received numberOfCommands
            // should never be 0 it is 1 by default to prevent division by zero.
            int delay = (int)(timeElapsed*1000 / numberOfCommands);

            if (delay > info.Max || delay == 0)
                return info.Max;
            if (delay < info.Min)
                return info.Min;

            return delay;
        }
Ejemplo n.º 2
0
        private void SetKPPInfo(KeyPressInfo[] keys)
        {
            string[] prefix = new string[18]{"AUp", "ARight", "ADown", "ALeft", "DUp", "DRight", "DDown", "DLeft",
                                             "CUp", "CRight", "CDown", "CLeft", "RTrigger", "LTrigger", "ZTrigger",
                                             "Start", "A", "B"};

            for(int i=0; i<keys.Length; i++){
                // Delay
                NumericUpDown nud = (NumericUpDown)this.Controls.Find(prefix[i]+"Delay", true)[0];
                nud.Value = keys[i].Delay;

                // Same Keys
                RadioButton rb;
                if(keys[i].SameKeyAction)
                    rb = (RadioButton)this.Controls.Find(prefix[i] + "SKC", true)[0];
                else
                    rb = (RadioButton)this.Controls.Find(prefix[i] + "SKD", true)[0];
                rb.Checked = true;

                // Different Keys
                if (keys[i].DifferentKeyAction)
                    rb = (RadioButton)this.Controls.Find(prefix[i] + "DKC", true)[0];
                else
                    rb = (RadioButton)this.Controls.Find(prefix[i] + "DKD", true)[0];
                rb.Checked = true;

                // Scaling Enabled
                CheckBox cb = (CheckBox)this.Controls.Find(prefix[i] + "SDECheckBox", true)[0];
                cb.Checked = keys[i].Scaling;

                // Scaling Min
                nud = (NumericUpDown)this.Controls.Find(prefix[i] + "SDMin", true)[0];
                nud.Value = keys[i].Min;

                // Scaling Max
                nud = (NumericUpDown)this.Controls.Find(prefix[i] + "SDMax", true)[0];
                nud.Value = keys[i].Max;
            }
        }
Ejemplo n.º 3
0
 private void UpdateKey(Key key, KeyPressInfo info)
 {
     keys[(int)key] = info;
 }