Beispiel #1
0
        protected override VirtualKey Read(ContentReader input, VirtualKey existingInstance)
        {
            uint            vk    = input.ReadUInt32();
            uint            sc    = input.ReadUInt32();
            VirtualKeyFlags flags = (VirtualKeyFlags)input.ReadUInt32();

            VirtualKeyValue[] shiftStates = input.ReadObject <VirtualKeyValue[]>();
            return(new VirtualKey(flags, vk, sc, shiftStates));
        }
Beispiel #2
0
 public VirtualKey(VirtualKeyFlags flags, uint virtualKey, uint scanCode, VirtualKeyValue[] shiftStateValues)
 {
     this.flags            = flags;
     this.vk               = virtualKey;
     this.sc               = scanCode;
     this.shiftStateValues = new VirtualKeyValue[shiftStateValues.Length];
     for (int i = 0; i < shiftStateValues.Length; i++)
     {
         this.shiftStateValues[i] = new VirtualKeyValue(scanCode, shiftStateValues[i]);
     }
 }
        VirtualKey ReadVirtualKey(ContentReader input)
        {
            uint            vk    = input.ReadUInt32();
            uint            sc    = input.ReadUInt32();
            VirtualKeyFlags flags = (VirtualKeyFlags)input.ReadUInt32();

            VirtualKeyValue[] shiftStates = new VirtualKeyValue[((int)ShiftState.ShftSpcl + 1) * 2];
            for (int i = 0; i < shiftStates.Length; i++)
            {
                bool hasValue = input.ReadBoolean();
                if (hasValue == true)
                {
                    shiftStates[i] = ReadVirtualKeyValue(input);
                }
            }
            return(new VirtualKey(flags, vk, sc, shiftStates));
        }