public void map(Button button)
        {
            if (button.Pressed && !previousPressed)
            {
                InputInterface.PressKey(keyCode);
            }

            if (!button.Pressed && previousPressed)
            {
                InputInterface.ReleaseKey(keyCode);
            }

            update(button);
        }
Example #2
0
        public void map(AnalogStick stick)
        {
            var currentDirectionStatus = getDirectionStatus(stick);
            var releasedDirections     = getReleasedDirections(currentDirectionStatus);
            var pressedDirections      = getPressedDirections(currentDirectionStatus);

            //s += "Release:\t";
            //foreach (bool b in releasedDirections)
            //{
            //    s += b + "\t";
            //}
            //s += "\n";

            //s += "Pressed:\t";
            //foreach (bool b in pressedDirections)
            //{
            //    s += b + "\t";
            //}
            //s += "\n";

            for (int i = 0; i < releasedDirections.Length; ++i)
            {
                //string t = " ";
                if (releasedDirections[i] == true)
                {
                    InputInterface.ReleaseKey((short)directionsToKeys[(Direction)i]);
                    //t = "rel";
                }
                //s += t + "\t";
            }
            //s += "\n";

            for (int i = 0; i < pressedDirections.Length; ++i)
            {
                //string t = " ";
                if (pressedDirections[i] == true)
                {
                    InputInterface.PressKey((short)directionsToKeys[(Direction)i]);
                    // t = "prs";
                }
                //s += t + "\t";
            }

            update(currentDirectionStatus);
        }