Adn1210's picture

How can I call a Joystick Event?

Hello

I am not an advance user of c# but i'm trying to do an aplication to use OpenGL and Joystick Functions.

I want to use the GL_Control because i'm going to use formulars and so on.

I want to know if i can call or create a Joystick event, i've seen that i can try to read the Joystick in "OnUpdateFrame", but can i manage that with an event?

Best Regards

p.S. I'm working on Visual Studio 10, Win7 64bits & a Xbox 360 controller

My code so far

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        GameWindow hid = new GameWindow();
        JoystickDevice joy;
           private void Form1_Load(object sender, EventArgs e)
        {
 
            joy =  hid.Joysticks[0];
            MessageBox.Show(joy.Description);
            textBox1.Text = joy.Description;
            joy.ButtonDown += new EventHandler<JoystickButtonEventArgs>(Joydown);
 
        }
 
        void Joydown(object sender, JoystickButtonEventArgs e)
        {
            MessageBox.Show("I'm in");
        }
 
    }

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

For this type of game investigate here. Afaik there's no tested XInput driver in trunk, you may have to look in branches or use an emu like x360ce.