예제 #1
0
        public iOSGameControllerState WithButton(iOSButton button, bool value = true, float rawValue = 1.0f)
        {
            buttonValues[(int)button] = rawValue;

            if (value)
            {
                buttons |= (uint)1 << (int)button;
            }
            else
            {
                buttons &= ~(uint)1 << (int)button;
            }

            return(this);
        }
예제 #2
0
        public iOSGameControllerState WithButton(iOSButton button, bool value = true, float rawValue = 1.0f)
        {
            buttonValues[(int)button] = rawValue;

            Debug.Assert((int)button < 32, $"Expected button < 32, so we fit into the 32 bit wide bitmask");
            var bit = 1U << (int)button;

            if (value)
            {
                buttons |= bit;
            }
            else
            {
                buttons &= ~bit;
            }

            return(this);
        }
예제 #3
0
        public iOSGameControllerRemoteState WithButton(iOSButton button, bool value = true, float rawValue = 1.0f)
        {
            fixed(float *buttonsPtr = buttonValues)
            {
                buttonsPtr[(int)button] = rawValue;
            }

            if (value)
            {
                buttons |= (uint)1 << (int)button;
            }
            else
            {
                buttons &= ~(uint)1 << (int)button;
            }

            return(this);
        }