示例#1
0
        public void SetJoyState(Key in_Key, bool in_bState)
        {
            byte[] Digital = m_JoyState.Digital;

            if (in_Key.m_eJoyType == Key.eJoyType.eDigital)
            {
                if (in_bState) Digital[in_Key.m_iJoyButton] = 1;
                else Digital[in_Key.m_iJoyButton] = 0;
            }
        }
示例#2
0
        public void SetJoyState(Key in_Key, float in_dValue)
        {
            int[] Analog = m_JoyState.Analog;

            if (in_Key.m_eJoyType == Key.eJoyType.eAnalog)
            {
                Analog[in_Key.m_iJoyButton] = (int)((PPJOY_AXIS_MAX - PPJOY_AXIS_MIN) * (in_dValue + 0.5));
            }
        }
示例#3
0
        private void WriteKey(XmlNodeList in_NodeWiimote, String in_strKey, Key in_Key)
        {
            if (in_Key == null) return;
            if (in_NodeWiimote == null) return;

            XmlElement elem = m_XmlDoc.CreateElement(in_strKey);
            in_NodeWiimote[0].AppendChild(elem);

            XmlNodeList nodeKey = in_NodeWiimote[0].SelectNodes(in_strKey);
            if (nodeKey == null || nodeKey.Count <= 0)
            {
                Debug.WriteLine("noeud introuvable : " + in_strKey);
                return;
            }

            elem = m_XmlDoc.CreateElement("NAME");
            elem.InnerText = in_Key.m_strKeyName;
            nodeKey[0].AppendChild(elem);

            elem = m_XmlDoc.CreateElement("VALUE");
            elem.InnerText = in_Key.m_iKeyVal.ToString();
            nodeKey[0].AppendChild(elem);
        }
示例#4
0
        private void ReadKey(XmlNodeList in_NodeWiimote, String in_strKey, Key in_Key)
        {
            if (in_Key == null) return;
            if (in_NodeWiimote == null) return;

            in_Key.m_iKeyVal = 0;
            in_Key.m_strKeyName = "";
            in_Key.m_bKeyState = false;

            XmlNodeList nodeKey = in_NodeWiimote[0].SelectNodes(in_strKey);
            if (nodeKey == null || nodeKey.Count <= 0)
            {
                Debug.WriteLine("noeud introuvable : " + in_strKey);
                return;
            }

            XmlNodeList nodeName = nodeKey[0].SelectNodes("NAME");
            if (nodeName != null && nodeName.Count > 0)
            {
                in_Key.m_strKeyName = nodeName[0].InnerText;
            }

            XmlNodeList nodeValue = nodeKey[0].SelectNodes("VALUE");
            if (nodeValue != null && nodeValue.Count > 0)
            {
                try
                {
                    in_Key.m_iKeyVal = ushort.Parse(nodeValue[0].InnerText);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e.Message);
                }
            }
        }
示例#5
0
        private void UpdateKeyCode(Key in_key, Keys in_KeyCode, TextBox in_Textbox)
        {
            in_key.m_iKeyVal = m_HE.KeyCodeToScanCode(in_KeyCode);

            KeysConverter kc = new KeysConverter();
            in_key.m_strKeyName = kc.ConvertToString(in_KeyCode);
            in_Textbox.Text = in_key.m_strKeyName;
        }
示例#6
0
 private void SendKey(Key in_key, bool in_bState)
 {
     if (in_bState == false && in_bState == in_key.m_bKeyState) return;
     m_HE.SendKey(in_key.m_iKeyVal, in_bState);
     in_key.m_bKeyState = in_bState;
 }