|
[A5] Joystick Input (lag) vs Keyboard input (no lag) |
SilverTES
Member #16,572
October 2016
|
I have a problem with joystick/gamepad input, I tested with many gamepad (logitech , x360, ...) I always have a lag with gamepad controller. you can test the test program : {"name":"827681screenshotmugenEngine.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fc0afba584383ee01f0f5e00e73ea5a8.png","w":2560,"h":1440,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fc0afba584383ee01f0f5e00e73ea5a8"} I don't know why, how do you get the Joystick input ? I want to say the best way, with the best performance. Control: Keyboard : Arrow key (UP , DOWN , LEFT , RIGHT) NOTE : use joyToKey ( http://joytokey.net/en/download )for control Keyboard & Gamepad at the same time, for test the synchronisation. |
Neil Roy
Member #2,229
April 2002
|
In my own code I just check the events (Allegro 5) like I do for keyboard and mouse. Code inside my event loop looks similar to... else if(event.type == ALLEGRO_EVENT_JOYSTICK_BUTTON_UP) { if(event.joystick.button == 0) done = true; // Button 0 = A (green, like pressing ENTER) if(event.joystick.button == 1) return true; // Button 1 = B (red, used like pressing ESC) // Button 7 = Start (unused here) } else if(event.type == ALLEGRO_EVENT_JOYSTICK_AXIS) { done = true; } else if(event.type == ALLEGRO_EVENT_JOYSTICK_CONFIGURATION) { al_reconfigure_joysticks(); //... etc... Though right now, I have this commented out. I had it in my Deluxe Pacman 2 game code, but there was a reason why I removed support for joysticks and I honestly cannot remember why. Could be a problem with it, I forget now. I'll have to check my notes. (checked notes)Yeah, there seemed to be some sort of bug with the joystick support in Allegro 5 which I couldn't resolved. In my notes I noted that the digital input is flaky and I was getting random crashes. I ended up removing joystick support. I think the digital input was laggy or something and other problems I forget now, it's been a while. --- |
SilverTES
Member #16,572
October 2016
|
In my case, I use al_get_joystick_state(_joystick[0], &_joyState) for getting joystick state, I already used joystick event and I have the same lag. Well, it's possible to use another library for manage joystick input, |
|