Advertisement
Ed94

Inputkbrd

Apr 2nd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 17.58 KB | None | 0 0
  1. using System;
  2. using Microsoft.Xna.Framework.Input;
  3.  
  4. namespace AbstractRealm.Input
  5. {
  6.     class RegKbrd
  7.     {
  8.         bool p_0 = false; bool c_0 = false;
  9.         bool p_1 = false; bool c_1 = false;
  10.         bool p_2 = false; bool c_2 = false;
  11.         bool p_3 = false; bool c_3 = false;
  12.         bool p_4 = false; bool c_4 = false;
  13.         bool p_5 = false; bool c_5 = false;
  14.         bool p_6 = false; bool c_6 = false;
  15.         bool p_7 = false; bool c_7 = false;
  16.         bool p_8 = false; bool c_8 = false;
  17.         bool p_9 = false; bool c_9 = false;
  18.         bool p_A = false; bool c_A = false;
  19.         bool p_B = false; bool c_B = false;
  20.         bool p_C = false; bool c_C = false;
  21.         bool p_D = false; bool c_D = false;
  22.         bool p_E = false; bool c_E = false;
  23.         bool p_F = false; bool c_F = false;
  24.         bool p_G = false; bool c_G = false;
  25.         bool p_H = false; bool c_H = false;
  26.         bool p_I = false; bool c_I = false;
  27.         bool p_J = false; bool c_J = false;
  28.         bool p_K = false; bool c_K = false;
  29.         bool p_L = false; bool c_L = false;
  30.         bool p_M = false; bool c_M = false;
  31.         bool p_N = false; bool c_N = false;
  32.         bool p_O = false; bool c_O = false;
  33.         bool p_P = false; bool c_P = false;
  34.         bool p_Q = false; bool c_Q = false;
  35.         bool p_R = false; bool c_R = false;
  36.         bool p_S = false; bool c_S = false;
  37.         bool p_T = false; bool c_T = false;
  38.         bool p_U = false; bool c_U = false;
  39.         bool p_V = false; bool c_V = false;
  40.         bool p_W = false; bool c_W = false;
  41.         bool p_X = false; bool c_X = false;
  42.         bool p_Y = false; bool c_Y = false;
  43.         bool p_Z = false; bool c_Z = false;
  44.         bool p_F1  = false; bool c_F1  = false;
  45.         bool p_F2  = false; bool c_F2  = false;
  46.         bool p_F3  = false; bool c_F3  = false;
  47.         bool p_F4  = false; bool c_F4  = false;
  48.         bool p_F5  = false; bool c_F5  = false;
  49.         bool p_F6  = false; bool c_F6  = false;
  50.         bool p_F7  = false; bool c_F7  = false;
  51.         bool p_F8  = false; bool c_F8  = false;
  52.         bool p_F9  = false; bool c_F9  = false;
  53.         bool p_F10 = false; bool c_F10 = false;
  54.         bool p_F11 = false; bool c_F11 = false;
  55.         bool p_F12 = false; bool c_F12 = false;
  56.         bool p_LS = false; bool c_LS = false;
  57.         bool p_LC = false; bool c_LC = false;
  58.         bool p_LA = false; bool c_LA = false;
  59.         bool p_uA = false; bool c_uA = false;
  60.         bool p_lA = false; bool c_lA = false;
  61.         bool p_dA = false; bool c_dA = false;
  62.         bool p_rA = false; bool c_rA = false;
  63.         bool p_end  = false; bool c_end  = false;
  64.         bool p_PgUp = false; bool c_PgUp = false;
  65.         bool p_PgDn = false; bool c_PgDn = false;
  66.  
  67.         public enum keyTime { p, c }
  68.  
  69.         public enum Input
  70.         {
  71.             zero , one  , two  , three, four , five , six  , seven, eight, nine , ten  ,
  72.             A , B , C , D , E , F , G , H , I , J , K , L , M ,
  73.             N , O , P , Q , R , S , T , U , V , W , X , Y , Z ,
  74.             F1 , F2 , F3 , F4 , F5 , F6 ,
  75.             F7 , F8 , F9 , F10, F11, F12,
  76.             LS, LC, LA,
  77.             uA, lA, dA, rA,
  78.             end , PgUp, PgDn,
  79.         }
  80.  
  81.         keyTime time  = new keyTime();
  82.         Input   input = new Input  ();
  83.        
  84.        
  85.         public RegKbrd() {}
  86.  
  87.         public void poll()
  88.         {
  89.             if (Keyboard.GetState().IsKeyDown(Keys.D0)) { c_0 = true; }
  90.             if (Keyboard.GetState().IsKeyDown(Keys.D1)) { c_1 = true; }
  91.             if (Keyboard.GetState().IsKeyDown(Keys.D2)) { c_2 = true; }
  92.             if (Keyboard.GetState().IsKeyDown(Keys.D3)) { c_3 = true; }
  93.             if (Keyboard.GetState().IsKeyDown(Keys.D4)) { c_4 = true; }
  94.             if (Keyboard.GetState().IsKeyDown(Keys.D5)) { c_5 = true; }
  95.             if (Keyboard.GetState().IsKeyDown(Keys.D6)) { c_6 = true; }
  96.             if (Keyboard.GetState().IsKeyDown(Keys.D7)) { c_7 = true; }
  97.             if (Keyboard.GetState().IsKeyDown(Keys.D8)) { c_8 = true; }
  98.             if (Keyboard.GetState().IsKeyDown(Keys.D9)) { c_9 = true; }
  99.             if (Keyboard.GetState().IsKeyDown(Keys.A )) { c_A = true; }
  100.             if (Keyboard.GetState().IsKeyDown(Keys.B )) { c_B = true; }
  101.             if (Keyboard.GetState().IsKeyDown(Keys.C )) { c_C = true; }
  102.             if (Keyboard.GetState().IsKeyDown(Keys.D )) { c_D = true; }
  103.             if (Keyboard.GetState().IsKeyDown(Keys.E )) { c_E = true; }
  104.             if (Keyboard.GetState().IsKeyDown(Keys.F )) { c_F = true; }
  105.             if (Keyboard.GetState().IsKeyDown(Keys.G )) { c_G = true; }
  106.             if (Keyboard.GetState().IsKeyDown(Keys.H )) { c_H = true; }
  107.             if (Keyboard.GetState().IsKeyDown(Keys.I )) { c_I = true; }
  108.             if (Keyboard.GetState().IsKeyDown(Keys.J )) { c_J = true; }
  109.             if (Keyboard.GetState().IsKeyDown(Keys.K )) { c_K = true; }
  110.             if (Keyboard.GetState().IsKeyDown(Keys.L )) { c_L = true; }
  111.             if (Keyboard.GetState().IsKeyDown(Keys.M )) { c_M = true; }
  112.             if (Keyboard.GetState().IsKeyDown(Keys.N )) { c_N = true; }
  113.             if (Keyboard.GetState().IsKeyDown(Keys.O )) { c_O = true; }
  114.             if (Keyboard.GetState().IsKeyDown(Keys.P )) { c_P = true; }
  115.             if (Keyboard.GetState().IsKeyDown(Keys.Q )) { c_Q = true; }
  116.             if (Keyboard.GetState().IsKeyDown(Keys.R )) { c_R = true; }
  117.             if (Keyboard.GetState().IsKeyDown(Keys.S )) { c_S = true; }
  118.             if (Keyboard.GetState().IsKeyDown(Keys.T )) { c_T = true; }
  119.             if (Keyboard.GetState().IsKeyDown(Keys.U )) { c_U = true; }
  120.             if (Keyboard.GetState().IsKeyDown(Keys.V )) { c_V = true; }
  121.             if (Keyboard.GetState().IsKeyDown(Keys.W )) { c_W = true; }
  122.             if (Keyboard.GetState().IsKeyDown(Keys.X )) { c_X = true; }
  123.             if (Keyboard.GetState().IsKeyDown(Keys.Y )) { c_Y = true; }
  124.             if (Keyboard.GetState().IsKeyDown(Keys.Z )) { c_Z = true; }
  125.             if (Keyboard.GetState().IsKeyDown(Keys.F1 )) { c_F1  = true; }
  126.             if (Keyboard.GetState().IsKeyDown(Keys.F2 )) { c_F2  = true; }
  127.             if (Keyboard.GetState().IsKeyDown(Keys.F3 )) { c_F3  = true; }
  128.             if (Keyboard.GetState().IsKeyDown(Keys.F4 )) { c_F4  = true; }
  129.             if (Keyboard.GetState().IsKeyDown(Keys.F5 )) { c_F5  = true; }
  130.             if (Keyboard.GetState().IsKeyDown(Keys.F6 )) { c_F6  = true; }
  131.             if (Keyboard.GetState().IsKeyDown(Keys.F7 )) { c_F7  = true; }
  132.             if (Keyboard.GetState().IsKeyDown(Keys.F8 )) { c_F8  = true; }
  133.             if (Keyboard.GetState().IsKeyDown(Keys.F9 )) { c_F9  = true; }
  134.             if (Keyboard.GetState().IsKeyDown(Keys.F10)) { c_F10 = true; }
  135.             if (Keyboard.GetState().IsKeyDown(Keys.F11)) { c_F11 = true; }
  136.             if (Keyboard.GetState().IsKeyDown(Keys.F12)) { c_F12 = true; }
  137.             if (Keyboard.GetState().IsKeyDown(Keys.LeftShift  )) { c_LS = true; }
  138.             if (Keyboard.GetState().IsKeyDown(Keys.LeftControl)) { c_LC = true; }
  139.             if (Keyboard.GetState().IsKeyDown(Keys.LeftAlt    )) { c_LA = true; }
  140.             if (Keyboard.GetState().IsKeyDown(Keys.Up  ))  { c_uA = true; }
  141.             if (Keyboard.GetState().IsKeyDown(Keys.Left))  { c_lA = true; }
  142.             if (Keyboard.GetState().IsKeyDown(Keys.Down))  { c_dA = true; }
  143.             if (Keyboard.GetState().IsKeyDown(Keys.Right)) { c_rA = true; }
  144.             if (Keyboard.GetState().IsKeyDown(Keys.End     )) { c_end  = true; }
  145.             if (Keyboard.GetState().IsKeyDown(Keys.PageUp  )) { c_PgUp = true; }
  146.             if (Keyboard.GetState().IsKeyDown(Keys.PageDown)) { c_PgDn = true; }
  147.         }
  148.  
  149.         public void setPast()
  150.         {
  151.             p_0 = c_0; c_0 = false;
  152.             p_1 = c_2; c_1 = false;
  153.             p_2 = c_3; c_2 = false;
  154.             p_3 = c_4; c_3 = false;
  155.             p_4 = c_5; c_4 = false;
  156.             p_5 = c_6; c_5 = false;
  157.             p_6 = c_7; c_6 = false;
  158.             p_7 = c_8; c_7 = false;
  159.             p_8 = c_8; c_8 = false;
  160.             p_9 = c_9; c_9 = false;
  161.             p_A = c_A; c_A = false;
  162.             p_B = c_B; c_B = false;
  163.             p_C = c_C; c_C = false;
  164.             p_D = c_D; c_D = false;
  165.             p_E = c_E; c_E = false;
  166.             p_F = c_F; c_F = false;
  167.             p_G = c_G; c_G = false;
  168.             p_H = c_H; c_H = false;
  169.             p_I = c_I; c_I = false;
  170.             p_J = c_J; c_J = false;
  171.             p_K = c_K; c_K = false;
  172.             p_L = c_L; c_L = false;
  173.             p_M = c_M; c_M = false;
  174.             p_N = c_N; c_N = false;
  175.             p_O = c_O; c_O = false;
  176.             p_P = c_P; c_P = false;
  177.             p_Q = c_Q; c_Q = false;
  178.             p_R = c_R; c_R = false;
  179.             p_S = c_S; c_S = false;
  180.             p_T = c_T; c_T = false;
  181.             p_U = c_U; c_U = false;
  182.             p_V = c_V; c_V = false;
  183.             p_W = c_W; c_W = false;
  184.             p_X = c_X; c_X = false;
  185.             p_Y = c_Y; c_Y = false;
  186.             p_Z = c_Z; c_Z = false;
  187.             p_F1  = c_F1 ; c_F1  = false;
  188.             p_F2  = c_F2 ; c_F2  = false;
  189.             p_F3  = c_F3 ; c_F3  = false;
  190.             p_F4  = c_F4 ; c_F4  = false;
  191.             p_F5  = c_F5 ; c_F5  = false;
  192.             p_F6  = c_F6 ; c_F6  = false;
  193.             p_F7  = c_F7 ; c_F7  = false;
  194.             p_F8  = c_F8 ; c_F8  = false;
  195.             p_F9  = c_F9 ; c_F9  = false;
  196.             p_F10 = c_F10; c_F10 = false;
  197.             p_F11 = c_F11; c_F11 = false;
  198.             p_F12 = c_F12; c_F12 = false;
  199.             p_LS = c_LS; c_LS = false;
  200.             p_LC = c_LS; c_LS = false;
  201.             p_LA = c_LA; c_LA = false;
  202.             p_uA = c_uA; c_uA = false;
  203.             p_lA = c_lA; c_lA = false;
  204.             p_dA = c_lA; c_dA = false;
  205.             p_rA = c_rA; c_rA = false;
  206.             p_end  = c_end ; c_end  = false;
  207.             p_PgUp = c_PgUp; c_PgUp = false;
  208.             p_PgDn = c_PgDn; c_PgDn = false;
  209.         }
  210.  
  211.         public bool getInput(keyTime passedTime, Input passedInput)
  212.         {
  213.             if (passedTime == keyTime.p)
  214.             {
  215.  
  216.                 if (passedInput == Input.zero ) { return p_0; }
  217.                 if (passedInput == Input.one  ) { return p_1; }
  218.                 if (passedInput == Input.two  ) { return p_2; }
  219.                 if (passedInput == Input.three) { return p_3; }
  220.                 if (passedInput == Input.four ) { return p_4; }
  221.                 if (passedInput == Input.five ) { return p_5; }
  222.                 if (passedInput == Input.six  ) { return p_6; }
  223.                 if (passedInput == Input.seven) { return p_7; }
  224.                 if (passedInput == Input.eight) { return p_8; }
  225.                 if (passedInput == Input.nine ) { return p_9; }
  226.                 if (passedInput == Input.A) { return p_A; }
  227.                 if (passedInput == Input.B) { return p_B; }
  228.                 if (passedInput == Input.C) { return p_C; }
  229.                 if (passedInput == Input.D) { return p_D; }
  230.                 if (passedInput == Input.E) { return p_E; }
  231.                 if (passedInput == Input.F) { return p_F; }
  232.                 if (passedInput == Input.G) { return p_G; }
  233.                 if (passedInput == Input.H) { return p_H; }
  234.                 if (passedInput == Input.I) { return p_I; }
  235.                 if (passedInput == Input.J) { return p_J; }
  236.                 if (passedInput == Input.K) { return p_K; }
  237.                 if (passedInput == Input.L) { return p_L; }
  238.                 if (passedInput == Input.M) { return p_M; }
  239.                 if (passedInput == Input.N) { return p_N; }
  240.                 if (passedInput == Input.O) { return p_O; }
  241.                 if (passedInput == Input.P) { return p_P; }
  242.                 if (passedInput == Input.Q) { return p_Q; }
  243.                 if (passedInput == Input.R) { return p_R; }
  244.                 if (passedInput == Input.S) { return p_S; }
  245.                 if (passedInput == Input.T) { return p_T; }
  246.                 if (passedInput == Input.U) { return p_U; }
  247.                 if (passedInput == Input.V) { return p_V; }
  248.                 if (passedInput == Input.W) { return p_W; }
  249.                 if (passedInput == Input.X) { return p_X; }
  250.                 if (passedInput == Input.Y) { return p_Y; }
  251.                 if (passedInput == Input.Z) { return p_Z; }
  252.                 if (passedInput == Input.F1) { return p_F1; }
  253.                 if (passedInput == Input.F2) { return p_F2; }
  254.                 if (passedInput == Input.F3) { return p_F3; }
  255.                 if (passedInput == Input.F4) { return p_F4; }
  256.                 if (passedInput == Input.F5) { return p_F5; }
  257.                 if (passedInput == Input.F6) { return p_F6; }
  258.                 if (passedInput == Input.F7) { return p_F7; }
  259.                 if (passedInput == Input.F8) { return p_F8; }
  260.                 if (passedInput == Input.F9) { return p_F9; }
  261.                 if (passedInput == Input.F10) { return p_F10; }
  262.                 if (passedInput == Input.F11) { return p_F11; }
  263.                 if (passedInput == Input.F12) { return p_F12; }
  264.                 if (passedInput == Input.LS) { return p_LS; }
  265.                 if (passedInput == Input.LC) { return p_LC; }
  266.                 if (passedInput == Input.LA) { return p_LA; }
  267.                 if (passedInput == Input.uA) { return p_uA; }
  268.                 if (passedInput == Input.lA) { return p_lA; }
  269.                 if (passedInput == Input.dA) { return p_dA; }
  270.                 if (passedInput == Input.rA) { return p_rA; }
  271.                 if (passedInput == Input.end ) { return p_end ; }
  272.                 if (passedInput == Input.PgUp) { return p_PgUp; }
  273.                 if (passedInput == Input.PgDn) { return p_PgDn; }
  274.                 else
  275.                 { Console.WriteLine("RegKbrd: Something went wrong."); return false; }
  276.             }
  277.             if (passedTime == keyTime.c)
  278.             {
  279.                 if (passedInput == Input.zero ) { return c_0; }
  280.                 if (passedInput == Input.one  ) { return c_1; }
  281.                 if (passedInput == Input.two  ) { return c_2; }
  282.                 if (passedInput == Input.three) { return c_3; }
  283.                 if (passedInput == Input.four ) { return c_4; }
  284.                 if (passedInput == Input.five ) { return c_5; }
  285.                 if (passedInput == Input.six  ) { return c_6; }
  286.                 if (passedInput == Input.seven) { return c_7; }
  287.                 if (passedInput == Input.eight) { return c_8; }
  288.                 if (passedInput == Input.nine ) { return c_9; }
  289.                 if (passedInput == Input.A) { return c_A; }
  290.                 if (passedInput == Input.B) { return c_B; }
  291.                 if (passedInput == Input.C) { return c_C; }
  292.                 if (passedInput == Input.D) { return c_D; }
  293.                 if (passedInput == Input.E) { return c_E; }
  294.                 if (passedInput == Input.F) { return c_F; }
  295.                 if (passedInput == Input.G) { return c_G; }
  296.                 if (passedInput == Input.H) { return c_H; }
  297.                 if (passedInput == Input.I) { return c_I; }
  298.                 if (passedInput == Input.J) { return c_J; }
  299.                 if (passedInput == Input.K) { return c_K; }
  300.                 if (passedInput == Input.L) { return c_L; }
  301.                 if (passedInput == Input.M) { return c_M; }
  302.                 if (passedInput == Input.N) { return c_N; }
  303.                 if (passedInput == Input.O) { return c_O; }
  304.                 if (passedInput == Input.P) { return c_P; }
  305.                 if (passedInput == Input.Q) { return c_Q; }
  306.                 if (passedInput == Input.R) { return c_R; }
  307.                 if (passedInput == Input.S) { return c_S; }
  308.                 if (passedInput == Input.T) { return c_T; }
  309.                 if (passedInput == Input.U) { return c_U; }
  310.                 if (passedInput == Input.V) { return c_V; }
  311.                 if (passedInput == Input.W) { return c_W; }
  312.                 if (passedInput == Input.X) { return c_X; }
  313.                 if (passedInput == Input.Y) { return c_Y; }
  314.                 if (passedInput == Input.Z) { return c_Z; }
  315.                 if (passedInput == Input.F1 ) { return c_F1 ; }
  316.                 if (passedInput == Input.F2 ) { return c_F2 ; }
  317.                 if (passedInput == Input.F3 ) { return c_F3 ; }
  318.                 if (passedInput == Input.F4 ) { return c_F4 ; }
  319.                 if (passedInput == Input.F5 ) { return c_F5 ; }
  320.                 if (passedInput == Input.F6 ) { return c_F6 ; }
  321.                 if (passedInput == Input.F7 ) { return c_F7 ; }
  322.                 if (passedInput == Input.F8 ) { return c_F8 ; }
  323.                 if (passedInput == Input.F9 ) { return c_F9 ; }
  324.                 if (passedInput == Input.F10) { return c_F10; }
  325.                 if (passedInput == Input.F11) { return c_F11; }
  326.                 if (passedInput == Input.F12) { return c_F12; }
  327.                 if (passedInput == Input.LS) { return c_LS; }
  328.                 if (passedInput == Input.LC) { return c_LC; }
  329.                 if (passedInput == Input.LA) { return c_LA; }
  330.                 if (passedInput == Input.uA) { return c_uA; }
  331.                 if (passedInput == Input.lA) { return c_lA; }
  332.                 if (passedInput == Input.dA) { return c_dA; }
  333.                 if (passedInput == Input.rA) { return c_rA; }
  334.                 if (passedInput == Input.end ) { return c_end ; }
  335.                 if (passedInput == Input.PgUp) { return c_PgUp; }
  336.                 if (passedInput == Input.PgDn) { return c_PgDn; }
  337.                 else
  338.                 { Console.WriteLine("RegKbrd: Something went wrong."); return false; }
  339.             }
  340.             else
  341.             { Console.WriteLine("RegKbrd: Something went wrong."); return false; }
  342.         }
  343.     }
  344. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement