• Register
Post tutorial RSS XNA Basics - Inputs

XNA Basics - Inputs Tutorial on creating Class_Inputs for an XNA Game Mice / Keyboards / GamePads

Posted by on - Basic Client Side Coding

Run Visual Studio 2010 / XNA.
Create a C#(cSharp) XNA 4.0 Game.

Inside Game1.cs
Step ONE:
Create Class_Inputs class_Inputs;
Step TWO:
Initialize class_Inputs = new Class_Inputs();
Step THREE:
Load class_Inputs.Initialize();
Step FOUR:
Update class_Inputs
Step FIVE:
Draw class_Inputs

Step SIX:
ADD a new class to the Solution Explorer. Class_Inputs.

Step ONE:

public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;

Class_Inputs class_Inputs;

Step TWO:

protected override void Initialize()
{

class_Inputs = new Class_Inputs();

Step THREE:

protected override void LoadContent()
{
// spriteBatch
spriteBatch = new SpriteBatch(GraphicsDevice);

Function_Load_Inputs();
}

protected void Function_Load_Inputs()
{
class_Inputs.Initialize();
}

Step FOUR:

protected override void Update(GameTime gameTime)
{
Function_Update_Inputs(gameTime);
}

protected void Function_Update_Inputs(GameTime gameTime)
        {
            class_Inputs.Input_Mouse1_State_Previous = class_Inputs.Input_Mouse1_State_Current;
            class_Inputs.Input_Mouse1_State_Current = Mouse.GetState();
            class_Inputs.Input_Mouse1_State = Mouse.GetState();

            // class_Inputs.Input_Mouse2_State_Previous = class_Inputs.Input_Mouse2_State_Current;
            // class_Inputs.Input_Mouse2_State_Current = Mouse.GetState();
            // class_Inputs.Input_Mouse2_State = Mouse.GetState();

            class_Inputs.Input_Keyboard1_State_Previous = class_Inputs.Input_Keyboard1_State_Current;
            class_Inputs.Input_Keyboard1_State_Current = Keyboard.GetState();
            class_Inputs.Input_Keyboard1_State = Keyboard.GetState();

            // class_Inputs.Input_Keyboard2_State_Previous = class_Inputs.Input_Keyboard2_State_Current;
            // class_Inputs.Input_Keyboard2_State_Current = Keyboard.GetState();
            // class_Inputs.Input_Keyboard2_State = Keyboard.GetState();

            class_Inputs.Input_GamePad1_State_Previous = class_Inputs.Input_GamePad1_State_Current;
                class_Inputs.Input_GamePad2_State_Previous = class_Inputs.Input_GamePad2_State_Current;
                class_Inputs.Input_GamePad3_State_Previous = class_Inputs.Input_GamePad3_State_Current;
                class_Inputs.Input_GamePad4_State_Previous = class_Inputs.Input_GamePad4_State_Current;
            class_Inputs.Input_GamePad1_State_Current = GamePad.GetState(PlayerIndex.One);
                class_Inputs.Input_GamePad2_State_Current = GamePad.GetState(PlayerIndex.Two);
                class_Inputs.Input_GamePad3_State_Current = GamePad.GetState(PlayerIndex.Three);
                class_Inputs.Input_GamePad4_State_Current = GamePad.GetState(PlayerIndex.Four);
            class_Inputs.Input_GamePad1_State = GamePad.GetState(PlayerIndex.One);
                class_Inputs.Input_GamePad2_State = GamePad.GetState(PlayerIndex.Two);
                class_Inputs.Input_GamePad3_State = GamePad.GetState(PlayerIndex.Three);
                class_Inputs.Input_GamePad4_State = GamePad.GetState(PlayerIndex.Four);
    
            if
            (
                // class_Inputs.Input_Mouse1_State.LeftButton == ButtonState.Pressed
                // ||
                // class_Inputs.Input_Mouse1_State.RightButton == ButtonState.Pressed
                // ||
                // class_Inputs.Input_Mouse2_State.LeftButton == ButtonState.Pressed
                // ||
                // class_Inputs.Input_Mouse2_State.RightButton == ButtonState.Pressed
                // ||
                class_Inputs.Input_Keyboard1_State.IsKeyDown(Keys.Escape)
                ||
                // class_Inputs.Input_Keyboard2_State.IsKeyDown(Keys.Escape)
                // ||
                GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed
                ||
                GamePad.GetState(PlayerIndex.Two).Buttons.Back == ButtonState.Pressed
                ||
                GamePad.GetState(PlayerIndex.Three).Buttons.Back == ButtonState.Pressed
                ||
                GamePad.GetState(PlayerIndex.Four).Buttons.Back == ButtonState.Pressed
            )
            {
                this.Exit();
            }
    
            class_Inputs.Update(gameTime);
        }

Step FIVE:

protected override void Draw(GameTime gameTime)
        {
// Background
            GraphicsDevice.Clear(Color.Black);

            // Function_Draw_Input_Mouse1(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_Mouse2(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);



// protected void Function_Draw_Input_Mouse1(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
    // class_Inputs.Draw(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
// }
// protected void Function_Draw_Input_Mouse2(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
    // class_Inputs.Draw(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
// }

Step SIX:
In Solution Explorer:
Right Click the name of your project
It will be just below:
"Solution YourProjectName (2 Projects)

ADD
NEW ITEM

Click C# / XNA Game Studio 4.0 to the left

GAME COMPONENT

Name it: Class_Inputs

Class_Inputs.cs
NOTE: You have to change NAMESPACE XNA_Game
To your project's name

using System;
using System.Collections.Generic;
using System.Linq;
    using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
    #if WINDOWS_PHONE
        // using Microsoft.Xna.Framework.Input.Touch;
    #endif
using Microsoft.Xna.Framework.Media;

namespace XNA_Game
{
/// <summary>
///
/// Class_Inputs
///
/// </summary>
public class Class_Inputs
    {
// Misc
        public Vector2 Input_Y_Flipped;
        public bool Input_Y_Mouse1_Flipped;
        public bool Input_Y_Mouse2_Flipped;
        public bool Input_Y_Keyboard1_Flipped;
        public bool Input_Y_Keyboard1_Left_Flipped;
        public bool Input_Y_Keyboard1_Right_Flipped;
        public bool Input_Y_Keyboard2_Flipped;
        public bool Input_Y_Keyboard2_Left_Flipped;
        public bool Input_Y_Keyboard2_Right_Flipped;
        public bool Input_Y_GamePad1_Left_Flipped;
        public bool Input_Y_GamePad1_Right_Flipped;
        public bool Input_Y_GamePad2_Left_Flipped;
        public bool Input_Y_GamePad2_Right_Flipped;
        public bool Input_Y_GamePad3_Left_Flipped;
        public bool Input_Y_GamePad3_Right_Flipped;
        public bool Input_Y_GamePad4_Left_Flipped;
        public bool Input_Y_GamePad4_Right_Flipped;

        public Vector2 Input_X_Flipped;
        public bool Input_X_Mouse1_Flipped;
        public bool Input_X_Mouse2_Flipped;
        public bool Input_X_Keyboard1_Flipped;
        public bool Input_X_Keyboard1_Left_Flipped;
        public bool Input_X_Keyboard1_Right_Flipped;
        public bool Input_X_Keyboard2_Flipped;
        public bool Input_X_Keyboard2_Left_Flipped;
        public bool Input_X_Keyboard2_Right_Flipped;
        public bool Input_X_GamePad1_Left_Flipped;
        public bool Input_X_GamePad1_Right_Flipped;
        public bool Input_X_GamePad2_Left_Flipped;
        public bool Input_X_GamePad2_Right_Flipped;
        public bool Input_X_GamePad3_Left_Flipped;
        public bool Input_X_GamePad3_Right_Flipped;
        public bool Input_X_GamePad4_Left_Flipped;
        public bool Input_X_GamePad4_Right_Flipped;
    
// Mice
        public MouseState Input_Mouse1_State_Current;
        public MouseState Input_Mouse1_State_Previous;
        public MouseState Input_Mouse1_State;

        public MouseState Input_Mouse2_State_Current;
        public MouseState Input_Mouse2_State_Previous;
        public MouseState Input_Mouse2_State;
    
        public bool Input_Mouse1_Enabled;
        public bool Input_Mouse1_Draw;
        public bool Input_Mouse1_Draw_Translucent;
        public float Input_Mouse1_Draw_Translucency;
        public float Input_Mouse1_Scale;
        public float Input_Mouse1_Scale_X;
        public float Input_Mouse1_Scale_Y;
        public float Input_Mouse1_Scale_Z;
        public Vector2 Input_Mouse1_Position;
        public Vector2 Input_Mouse1_Position_2Dsky;
        public Vector2 Input_Mouse1_Position_2Dside;
        public Vector3 Input_Mouse1_Position_3D;
        public int Input_Mouse1_Position_X;
        public int Input_Mouse1_Position_Y;
        public int Input_Mouse1_Position_Z;
        public Vector2 Input_Mouse1_Size_Width;
        public Vector2 Input_Mouse1_Size_Depth;
        public Vector2 Input_Mouse1_Size_Height;
        public int Input_Mouse1_Size_X;
        public int Input_Mouse1_Size_Y;
        public int Input_Mouse1_Size_Z;
        public Rectangle Input_Mouse1_Rect;
        public Vector2 Input_Mouse1_Rect_Origin;
        public Rectangle Input_Mouse1_Rect_2Dsky;
        public Vector2 Input_Mouse1_Rect_2Dsky_Origin;
        public Rectangle Input_Mouse1_Rect_2Dside;
        public Vector2 Input_Mouse1_Rect_2Dside_Origin;
        public float Input_Mouse1_Rot_PITCH;
        public Vector2 Input_Mouse1_Rot_PITCH_Origin;
        public float Input_Mouse1_Rot_YAW;
        public Vector2 Input_Mouse1_Rot_YAW_Origin;
        public float Input_Mouse1_Rot_ROLL;
        public Vector2 Input_Mouse1_Rot_ROLL_Origin;
    
        public bool Input_Mouse2_Enabled;
        public bool Input_Mouse2_Draw;
        public bool Input_Mouse2_Draw_Translucent;
        public float Input_Mouse2_Draw_Translucency;
        public float Input_Mouse2_Scale;
        public float Input_Mouse2_Scale_X;
        public float Input_Mouse2_Scale_Y;
        public float Input_Mouse2_Scale_Z;
        public Vector2 Input_Mouse2_Position;
        public Vector2 Input_Mouse2_Position_2Dsky;
        public Vector2 Input_Mouse2_Position_2Dside;
        public Vector3 Input_Mouse2_Position_3D;
        public int Input_Mouse2_Position_X;
        public int Input_Mouse2_Position_Y;
        public int Input_Mouse2_Position_Z;
        public Vector2 Input_Mouse2_Size_Width;
        public Vector2 Input_Mouse2_Size_Depth;
        public Vector2 Input_Mouse2_Size_Height;
        public int Input_Mouse2_Size_X;
        public int Input_Mouse2_Size_Y;
        public int Input_Mouse2_Size_Z;
        public Rectangle Input_Mouse2_Rect;
        public Vector2 Input_Mouse2_Rect_Origin;
        public Rectangle Input_Mouse2_Rect_2Dsky;
        public Vector2 Input_Mouse2_Rect_2Dsky_Origin;
        public Rectangle Input_Mouse2_Rect_2Dside;
        public Vector2 Input_Mouse2_Rect_2Dside_Origin;
        public float Input_Mouse2_Rot_PITCH;
        public Vector2 Input_Mouse2_Rot_PITCH_Origin;
        public float Input_Mouse2_Rot_YAW;
        public Vector2 Input_Mouse2_Rot_YAW_Origin;
        public float Input_Mouse2_Rot_ROLL;
        public Vector2 Input_Mouse2_Rot_ROLL_Origin;
    
// Keyboards
        public KeyboardState Input_Keyboard1_State_Current;
        public KeyboardState Input_Keyboard1_State_Previous;
        public KeyboardState Input_Keyboard1_State;
    
// GamePads
        // public GamePadType Input_GamePad1_Type;
            // public GamePadType Input_GamePad2_Type;
            // public GamePadType Input_GamePad3_Type;
            // public GamePadType Input_GamePad4_Type;
        public GamePadState Input_GamePad1_State_Current;
            public GamePadState Input_GamePad2_State_Current;
            public GamePadState Input_GamePad3_State_Current;
            public GamePadState Input_GamePad4_State_Current;
        public GamePadState Input_GamePad1_State_Previous;
            public GamePadState Input_GamePad2_State_Previous;
            public GamePadState Input_GamePad3_State_Previous;
            public GamePadState Input_GamePad4_State_Previous;
        public GamePadState Input_GamePad1_State;
            public GamePadState Input_GamePad2_State;
            public GamePadState Input_GamePad3_State;
            public GamePadState Input_GamePad4_State;
    
        public float Input_GamePad1_Left_X;
        public float Input_GamePad1_Left_Y;
        public float Input_GamePad1_Right_X;
        public float Input_GamePad1_Right_Y;

        public float Input_GamePad1_Left_Trigger;
        public float Input_GamePad1_Right_Trigger;

        public float Input_GamePad2_Left_X;
        public float Input_GamePad2_Left_Y;
        public float Input_GamePad2_Right_X;
        public float Input_GamePad2_Right_Y;

        public float Input_GamePad2_Left_Trigger;
        public float Input_GamePad2_Right_Trigger;

        public float Input_GamePad3_Left_X;
        public float Input_GamePad3_Left_Y;
        public float Input_GamePad3_Right_X;
        public float Input_GamePad3_Right_Y;

        public float Input_GamePad3_Left_Trigger;
        public float Input_GamePad3_Right_Trigger;

        public float Input_GamePad4_Left_X;
        public float Input_GamePad4_Left_Y;
        public float Input_GamePad4_Right_X;
        public float Input_GamePad4_Right_Y;

        public float Input_GamePad4_Left_Trigger;
        public float Input_GamePad4_Right_Trigger;

// Other
        // public TouchCollection Input_Touch1_State;
        // public AccelerometerState Input_Accelerometer1_State;
        // public DisplayOrientation Input_Orientation1_State;
    
    
    
/// <summary>
///
/// Initialize
///
/// </summary>
public void Initialize()
        {
            Mouse.SetPosition(0, 0);
    
    Input_Y_Flipped = new Vector2(1, -1);
    
            Input_Mouse1_Enabled = true;
            Input_Mouse1_Draw = true;
            Input_Mouse1_Draw_Translucent = false;
            Input_Mouse1_Draw_Translucency = 0.000f;
            Input_Mouse1_Scale = 0.000f;
            Input_Mouse1_Scale_X = 0.000f;
            Input_Mouse1_Scale_Y = 0.000f;
            Input_Mouse1_Scale_Z = 0.000f;
            Input_Mouse1_Position = new Vector2(0, 0);
            Input_Mouse1_Position_2Dsky = new Vector2(0, 0);
            Input_Mouse1_Position_2Dside = new Vector2(0, 0);
            Input_Mouse1_Position_3D = new Vector3(0, 0, 0);
            Input_Mouse1_Position_X = 0;
            Input_Mouse1_Position_Y = 0;
            Input_Mouse1_Position_Z = 0;
            Input_Mouse1_Size_Width = new Vector2(0, 0);
            Input_Mouse1_Size_Depth = new Vector2(0, 0);
            Input_Mouse1_Size_Height = new Vector2(0, 0);
            Input_Mouse1_Size_X = 0;
            Input_Mouse1_Size_Y = 0;
            Input_Mouse1_Size_Z = 0;
            Input_Mouse1_Rect = new Rectangle(0, 0, 0, 0);
            Input_Mouse1_Rect_Origin = new Vector2(0, 0);
            Input_Mouse1_Rect_2Dsky = new Rectangle(0, 0, 0, 0);
            Input_Mouse1_Rect_2Dsky_Origin = new Vector2(0, 0);
            Input_Mouse1_Rect_2Dside = new Rectangle(0, 0, 0, 0);
            Input_Mouse1_Rect_2Dside_Origin = new Vector2(0, 0);
            Input_Mouse1_Rot_PITCH = 0.000f;
            Input_Mouse1_Rot_PITCH_Origin = new Vector2(0, 0);
            Input_Mouse1_Rot_YAW = 0.000f;
            Input_Mouse1_Rot_YAW_Origin = new Vector2(0, 0);
            Input_Mouse1_Rot_ROLL = 0.000f;
            Input_Mouse1_Rot_ROLL_Origin = new Vector2(0, 0);

            Input_Mouse2_Enabled = true;
            Input_Mouse2_Draw = true;
            Input_Mouse2_Draw_Translucent = false;
            Input_Mouse2_Draw_Translucency = 0.000f;
            Input_Mouse2_Scale = 0.000f;
            Input_Mouse2_Scale_X = 0.000f;
            Input_Mouse2_Scale_Y = 0.000f;
            Input_Mouse2_Scale_Z = 0.000f;
            Input_Mouse2_Position = new Vector2(0, 0);
            Input_Mouse2_Position_2Dsky = new Vector2(0, 0);
            Input_Mouse2_Position_2Dside = new Vector2(0, 0);
            Input_Mouse2_Position_3D = new Vector3(0, 0, 0);
            Input_Mouse2_Position_X = 0;
            Input_Mouse2_Position_Y = 0;
            Input_Mouse2_Position_Z = 0;
            Input_Mouse2_Size_Width = new Vector2(0, 0);
            Input_Mouse2_Size_Depth = new Vector2(0, 0);
            Input_Mouse2_Size_Height = new Vector2(0, 0);
            Input_Mouse2_Size_X = 0;
            Input_Mouse2_Size_Y = 0;
            Input_Mouse2_Size_Z = 0;
            Input_Mouse2_Rect = new Rectangle(0, 0, 0, 0);
            Input_Mouse2_Rect_Origin = new Vector2(0, 0);
            Input_Mouse2_Rect_2Dsky = new Rectangle(0, 0, 0, 0);
            Input_Mouse2_Rect_2Dsky_Origin = new Vector2(0, 0);
            Input_Mouse2_Rect_2Dside = new Rectangle(0, 0, 0, 0);
            Input_Mouse2_Rect_2Dside_Origin = new Vector2(0, 0);
            Input_Mouse2_Rot_PITCH = 0.000f;
            Input_Mouse2_Rot_PITCH_Origin = new Vector2(0, 0);
            Input_Mouse2_Rot_YAW = 0.000f;
            Input_Mouse2_Rot_YAW_Origin = new Vector2(0, 0);
            Input_Mouse2_Rot_ROLL = 0.000f;
            Input_Mouse2_Rot_ROLL_Origin = new Vector2(0, 0);
    
            Input_GamePad1_Left_X = 0;
            Input_GamePad1_Left_Y = 0;
            Input_GamePad1_Right_X = 0;
            Input_GamePad1_Right_Y = 0;

            Input_GamePad1_Left_Trigger = 0;
            Input_GamePad1_Right_Trigger = 0;
    
            Input_GamePad2_Left_X = 0;
            Input_GamePad2_Left_Y = 0;
            Input_GamePad2_Right_X = 0;
            Input_GamePad2_Right_Y = 0;

            Input_GamePad2_Left_Trigger = 0;
            Input_GamePad2_Right_Trigger = 0;

            Input_GamePad3_Left_X = 0;
            Input_GamePad3_Left_Y = 0;
            Input_GamePad3_Right_X = 0;
            Input_GamePad3_Right_Y = 0;

            Input_GamePad3_Left_Trigger = 0;
            Input_GamePad3_Right_Trigger = 0;

            Input_GamePad4_Left_X = 0;
            Input_GamePad4_Left_Y = 0;
            Input_GamePad4_Right_X = 0;
            Input_GamePad4_Right_Y = 0;

            Input_GamePad4_Left_Trigger = 0;
            Input_GamePad4_Right_Trigger = 0;
        }

/// <summary>
///
/// Load Content
///
/// <summary>
public void LoadContent()
        {
        }

/// <summary>
///
/// Unload Content
///
/// <summary>
public void UnloadContent()
        {
        }
    
/// <summary>
///
/// Update
///
/// </summary>
public void Update(GameTime gameTime)
        {
            Function_Update_Input_Mouse1(gameTime);
            Function_Update_Input_Mouse2(gameTime);
            Function_Update_Input_Keyboard1(gameTime);
            Function_Update_Input_Keyboard2(gameTime);
            Function_Update_Input_GamePad1(gameTime);
            Function_Update_Input_GamePad2(gameTime);
            Function_Update_Input_GamePad3(gameTime);
            Function_Update_Input_GamePad4(gameTime);
        }
public void Function_Update_Input_Mouse1(GameTime gameTime)
{
    Input_Mouse1_Position.X = Input_Mouse1_State.X;
    Input_Mouse1_Position.Y = Input_Mouse1_State.Y;

    if (Input_Mouse1_State.LeftButton == ButtonState.Pressed)
    {
    }
    if (Input_Mouse1_State.RightButton == ButtonState.Pressed)
    {
    }
    if (Input_Mouse1_State.MiddleButton == ButtonState.Pressed)
    {
    }
}
public void Function_Update_Input_Mouse2(GameTime gameTime)
{
    // Mouse 2 ---> Mouse1
    Input_Mouse2_Position.X = Input_Mouse1_State.X;
    Input_Mouse2_Position.Y = Input_Mouse1_State.Y;

    // if (Input_Mouse2_State.LeftButton == ButtonState.Pressed)
    // {
    // }
    // if (Input_Mouse2_State.RightButton == ButtonState.Pressed)
    // {
    // }
    // if (Input_Mouse2_State.MiddleButton == ButtonState.Pressed)
    // {
    // }
}
public void Function_Update_Input_Keyboard1(GameTime gameTime)
{
// Windows Keys
    if (Input_Keyboard1_State.IsKeyDown(Keys.LeftWindows))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.RightWindows))
    {
    }

// F1-12
    if (Input_Keyboard1_State.IsKeyDown(Keys.F1))
    {
    }
    if (Input_Keyboard1_State.IsKeyUp(Keys.F1))
    {
    }
    
    if (Input_Keyboard1_State.IsKeyDown(Keys.F2))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F3))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F4))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F5))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F6))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F7))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F8))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F9))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F10))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F11))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F12))
    {
    }
    
// Numbers / Minus / Plus
    if (Input_Keyboard1_State.IsKeyDown(Keys.D1))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D2))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D3))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D4))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D5))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D6))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D7))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D8))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D9))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D0))
    {
    }

    if (Input_Keyboard1_State.IsKeyDown(Keys.OemMinus))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.OemPlus))
    {
    }
    
// Console / Tab / CapsLOCK / Left Shift / Left Ctrl / Left Alt / Space
    if (Input_Keyboard1_State.IsKeyDown(Keys.OemTilde))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Tab))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.CapsLock))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.LeftShift))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.LeftControl))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.LeftAlt))
    {
    }

// Backspace / Backslash/Pipe / Enter / Right Shift / Right Ctrl / Right Alt
    if (Input_Keyboard1_State.IsKeyDown(Keys.Back))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.OemPipe))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Enter))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.RightShift))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.RightControl))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.RightAlt))
    {
    }

// ASDF
    if (Input_Keyboard1_State.IsKeyDown(Keys.A))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.S))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.D))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.F))
    {
    }

// JKL:
    if (Input_Keyboard1_State.IsKeyDown(Keys.J))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.K))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.L))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.OemSemicolon))
    {
    }
    
// Arrow Keys
    if (Input_Keyboard1_State.IsKeyDown(Keys.Up))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Down))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Left))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Right))
    {
    }

// Print Screen / Scroll Lock / Pause/Break / Insert / Home / PageUP / Delete / End / PageDOWN
    if (Input_Keyboard1_State.IsKeyDown(Keys.PrintScreen))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Scroll))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Pause))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Insert))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Home))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.PageUp))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Delete))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.End))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.PageDown))
    {
    }

// Number Pad
    if (Input_Keyboard1_State.IsKeyDown(Keys.NumLock))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Divide))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Multiply))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Subtract))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Add))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Enter))
    {
    }
    if (Input_Keyboard1_State.IsKeyDown(Keys.Delete))
    {
    }
}
public void Function_Update_Input_Keyboard2(GameTime gameTime)
{
}
public void Function_Update_Input_GamePad1(GameTime gameTime)
{
    Input_GamePad1_Left_X = GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X;
    Input_GamePad1_Left_Y = GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y;
    Input_GamePad1_Right_X = GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.X;
    Input_GamePad1_Right_Y = GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y;

    Input_GamePad1_Left_Trigger = GamePad.GetState(PlayerIndex.One).Triggers.Left;
    Input_GamePad1_Right_Trigger = GamePad.GetState(PlayerIndex.One).Triggers.Right;
    
    if (Input_GamePad1_State.Buttons.LeftStick == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.RightStick == ButtonState.Pressed)
    {
    }
    
    if (Input_GamePad1_State.DPad.Up == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.DPad.Down == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.DPad.Left == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.DPad.Right == ButtonState.Pressed)
    {
    }

    if (Input_GamePad1_State.Buttons.Back == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.Start == ButtonState.Pressed)
    {
    }
    
    if (Input_GamePad1_State.Buttons.LeftShoulder == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.RightShoulder == ButtonState.Pressed)
    {
    }

    if (Input_GamePad1_State.Buttons.A == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.B == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.X == ButtonState.Pressed)
    {
    }
    if (Input_GamePad1_State.Buttons.Y == ButtonState.Pressed)
    {
    }
}
public void Function_Update_Input_GamePad2(GameTime gameTime)
{
    Input_GamePad2_Left_X = GamePad.GetState(PlayerIndex.Two).ThumbSticks.Left.X;
    Input_GamePad2_Left_Y = GamePad.GetState(PlayerIndex.Two).ThumbSticks.Left.Y;
    Input_GamePad2_Right_X = GamePad.GetState(PlayerIndex.Two).ThumbSticks.Right.X;
    Input_GamePad2_Right_Y = GamePad.GetState(PlayerIndex.Two).ThumbSticks.Right.Y;

    Input_GamePad2_Left_Trigger = GamePad.GetState(PlayerIndex.Two).Triggers.Left;
    Input_GamePad2_Right_Trigger = GamePad.GetState(PlayerIndex.Two).Triggers.Right;

    if (Input_GamePad2_State.Buttons.LeftStick == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.RightStick == ButtonState.Pressed)
    {
    }

    if (Input_GamePad2_State.DPad.Up == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.DPad.Down == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.DPad.Left == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.DPad.Right == ButtonState.Pressed)
    {
    }

    if (Input_GamePad2_State.Buttons.Back == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.Start == ButtonState.Pressed)
    {
    }

    if (Input_GamePad2_State.Buttons.LeftShoulder == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.RightShoulder == ButtonState.Pressed)
    {
    }

    if (Input_GamePad2_State.Buttons.A == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.B == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.X == ButtonState.Pressed)
    {
    }
    if (Input_GamePad2_State.Buttons.Y == ButtonState.Pressed)
    {
    }
}
public void Function_Update_Input_GamePad3(GameTime gameTime)
{
    Input_GamePad3_Left_X = GamePad.GetState(PlayerIndex.Three).ThumbSticks.Left.X;
    Input_GamePad3_Left_Y = GamePad.GetState(PlayerIndex.Three).ThumbSticks.Left.Y;
    Input_GamePad3_Right_X = GamePad.GetState(PlayerIndex.Three).ThumbSticks.Right.X;
    Input_GamePad3_Right_Y = GamePad.GetState(PlayerIndex.Three).ThumbSticks.Right.Y;

    Input_GamePad3_Left_Trigger = GamePad.GetState(PlayerIndex.Three).Triggers.Left;
    Input_GamePad3_Right_Trigger = GamePad.GetState(PlayerIndex.Three).Triggers.Right;

    if (Input_GamePad3_State.Buttons.LeftStick == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.RightStick == ButtonState.Pressed)
    {
    }

    if (Input_GamePad3_State.DPad.Up == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.DPad.Down == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.DPad.Left == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.DPad.Right == ButtonState.Pressed)
    {
    }

    if (Input_GamePad3_State.Buttons.Back == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.Start == ButtonState.Pressed)
    {
    }

    if (Input_GamePad3_State.Buttons.LeftShoulder == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.RightShoulder == ButtonState.Pressed)
    {
    }

    if (Input_GamePad3_State.Buttons.A == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.B == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.X == ButtonState.Pressed)
    {
    }
    if (Input_GamePad3_State.Buttons.Y == ButtonState.Pressed)
    {
    }
}
public void Function_Update_Input_GamePad4(GameTime gameTime)
{
    Input_GamePad4_Left_X = GamePad.GetState(PlayerIndex.Four).ThumbSticks.Left.X;
    Input_GamePad4_Left_Y = GamePad.GetState(PlayerIndex.Four).ThumbSticks.Left.Y;
    Input_GamePad4_Right_X = GamePad.GetState(PlayerIndex.Four).ThumbSticks.Right.X;
    Input_GamePad4_Right_Y = GamePad.GetState(PlayerIndex.Four).ThumbSticks.Right.Y;

    Input_GamePad4_Left_Trigger = GamePad.GetState(PlayerIndex.Four).Triggers.Left;
    Input_GamePad4_Right_Trigger = GamePad.GetState(PlayerIndex.Four).Triggers.Right;

    if (Input_GamePad4_State.Buttons.LeftStick == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.RightStick == ButtonState.Pressed)
    {
    }

    if (Input_GamePad4_State.DPad.Up == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.DPad.Down == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.DPad.Left == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.DPad.Right == ButtonState.Pressed)
    {
    }

    if (Input_GamePad4_State.Buttons.Back == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.Start == ButtonState.Pressed)
    {
    }

    if (Input_GamePad4_State.Buttons.LeftShoulder == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.RightShoulder == ButtonState.Pressed)
    {
    }

    if (Input_GamePad4_State.Buttons.A == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.B == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.X == ButtonState.Pressed)
    {
    }
    if (Input_GamePad4_State.Buttons.Y == ButtonState.Pressed)
    {
    }
}
    
    
    
/// <summary>
///
/// Draw
///
/// </summary>
public void Draw(SpriteBatch spriteBatch)
// // // public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
        {
            // Function_Draw_Input_Mouse1(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_Mouse2(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_Keyboard1(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_Keyboard2(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_GamePad1(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_GamePad2(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_GamePad3(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
            // Function_Draw_Input_GamePad4(gameTime, spriteBatch, class_Video, class_Audio, class_Assets);
        }
// public void Function_Draw_Input_Mouse1(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
    // spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    // spriteBatch.Draw(class_Assets.Texture_Input_Mouse1, Input_Mouse1_Position, Color.White);
    // spriteBatch.End();
// }
// public void Function_Draw_Input_Mouse2(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
    // spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    // spriteBatch.Draw(class_Assets.Texture_Input_Mouse2, Input_Mouse2_Position, Color.White);
    // spriteBatch.End();
// }
// public void Function_Draw_Input_Keyboard1(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }
// public void Function_Draw_Input_Keyboard2(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }
// public void Function_Draw_Input_GamePad1(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }
// public void Function_Draw_Input_GamePad2(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }
// public void Function_Draw_Input_GamePad3(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }
// public void Function_Draw_Input_GamePad4(GameTime gameTime, SpriteBatch spriteBatch, Class_Video class_Video, Class_Audio class_Audio, Class_Assets class_Assets)
// {
// }

    }
}
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Tutorial
Browse
Tutorials
Share
Related Games
Related Engines
XNA
XNA Public Domain