Ejemplo n.º 1
0
        public static void Initialize()
        {
            keys = new KeyP[] { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, space, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, enter, left, right, up, down,
                                leftShift, rightShift, leftControl, rightControl, leftAlt, rightAlt, backSpace, delete, esc, num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, plusNum, minusNum,
                                multiplyNum, divideNum, tab, dot, comma, smaller, sharp, plus, minus, insert, end, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, ä, ö, ü, mbLeft, mbRight, mbMiddle,
                                auto, clear, akut, copy, enlW, sharpS, pipe, quotes, semicolon, tilde };

            keyCollections       = new KeyCollection[] { anyShift, anyControl, anyAlt };
            customKeyCollections = new List <KeyCollection>();

            ClearKeys();

            esc.KeyStringDown      += btn => KeyString.Escape();
            a.KeyStringControlDown += btn => KeyString.SelectAll();
            v.KeyStringControlDown += btn => KeyString.Paste();
            c.KeyStringControlDown += btn => KeyString.Copy();
            x.KeyStringControlDown += btn => KeyString.Cut();

            left.KeyStringDown      += btn => KeyString.CursorMove(-1);
            right.KeyStringDown     += btn => KeyString.CursorMove(1);
            backSpace.KeyStringDown += btn => KeyString.Delete(true);
            delete.KeyStringDown    += btn => KeyString.Delete(false);


            gpStates    = new GamePadState[4];
            gpStates[0] = GamePad.GetState(PlayerIndex.One);
            gpStates[1] = GamePad.GetState(PlayerIndex.Two);
            gpStates[2] = GamePad.GetState(PlayerIndex.Three);
            gpStates[3] = GamePad.GetState(PlayerIndex.Four);

            controllers = new Gamepad[4];
            for (int index = 0; index < 4; index++)
            {
                controllers[index] = new Gamepad(index);
            }

            KeyString.Initialize();
        }
Ejemplo n.º 2
0
 private void AddKeyString()
 {
     if (KeyString.Record)
     {
         KeyString.frame = 0;
         if (KeyString.enterOnEnter && key == Keys.Enter)
         {
             Input.enter.catched = true;
             if (KeyString.KeyStringEntered != null)
             {
                 KeyString.KeyStringEntered(KeyString.keyString);
             }
         }
         else if (Input.leftControl._down && KeyStringControlDown != null)
         {
             KeyStringControlDown(this);
         }
         else if (KeyStringDown != null)
         {
             KeyStringDown(this);
         }
         else if (keyStringLow != "" && !catched)
         {
             if (Input.leftControl._down && Input.leftAlt._down)
             {
                 KeyString.Write(keyStringAltGr);
             }
             else if (Input.leftShift._down)
             {
                 KeyString.Write(keyStringHigh);
             }
             else
             {
                 KeyString.Write(keyStringLow);
             }
         }
     }
 }