• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Arcade Encoder Support

P

PieBaron

Guest
I bought a Zero Delay arcade encoder so I can play my game with some big buttons.. but after running this code from the help file, it apparently isn't detected?

gp[0] = 0;
var gp_num = gamepad_get_device_count();
for (var i = 0; i < gp_num; i++;)
{
if gamepad_is_connected(i) gp = true else gp = false;
log("gp: " , gp)
}

in console I get this:

gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0
gp: , 0


Here is a link to the device:
http://www.ebay.co.uk/itm/Zero-Dela...for-MAME-2Pin-Happ-Push-Buttons-/252531159695

Does anyone have any suggestions? is there a different method to detect input for a device like this?
Windows has detected the device as Generic USB joystick but it doesnt have calibration settings or anything like that.
here is an image on how I have wired it up:
https://dl.dropboxusercontent.com/u/24304389/controllerSetup.jpg
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Well why, it is detected - sitting in first slot (#0). Try logging button states of it.
 
P

PieBaron

Guest
Well why, it is detected - sitting in first slot (#0). Try logging button states of it.
I assume 0 means nothing connected?
I tried:
global.cID = 1; // also tried 0
// tried all these:
global.leftInput = gp_face1;
global.centerInput = gp_face2;
global.RightInput = gp_face3;

gamepad_button_check_pressed(global.cID,global.leftInput);
 
Gamepad IDs start at '0', so '0' means Gamepad ID '0' is connected, and you should be using that number with checking your button presses.
 
P

PieBaron

Guest
Gamepad IDs start at '0', so '0' means Gamepad ID '0' is connected, and you should be using that number with checking your button presses.
I already tried ID 0
if you look at the code you will see that 0 means false, "gamepad_is_connected(i) gp = true else gp = false;"
so surely its saying nothing is connected to all ports?
 
Oops. Sorry, I skimmed through your code pretty fast and assumed 'gp' was the variable you used as an iterator. Are you using the most recent Beta channel release of Studio? If you're not, your device is probably picking up as a DirectInput device, and the gamepad functions only detect those with the recent versions.
 
P

PieBaron

Guest
Oops. Sorry, I skimmed through your code pretty fast and assumed 'gp' was the variable you used as an iterator. Are you using the most recent Beta channel release of Studio? If you're not, your device is probably picking up as a DirectInput device, and the gamepad functions only detect those with the recent versions.
No worries!
I am using v1.4.1763 (r41504)
I tried searching DirectInput in the help but couldn't find anything, maybe I should just use that though, can you point me to documentation/reference for DirectInput?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
No worries!
I am using v1.4.1763 (r41504)
I tried searching DirectInput in the help but couldn't find anything, maybe I should just use that though, can you point me to documentation/reference for DirectInput?
Legacy DirectInput functions are joystick_ ones but current versions should be detecting them as devices 4-11.
(and I made the same mistake when looking over your code)
 
P

PieBaron

Guest
I can confirm using joystick_ functions worked successfully with the zero delay encoder, e.g. joystick_check_button(1, 1) works perfectly.
 
Top