|
allegro 4 button mapping for xbox 360 controller? |
Shadowblitz16
Member #16,818
March 2018
|
does anybody have an idea of what the allegro 4 button mapping are for a xbox 360 controller? me and @ZoriaRPG were discussing problems with detecting things like triggers, dpad, and joypad directions. |
ZoriaRPG
Member #16,714
July 2017
|
The question is: Does anyone here have one, who can confirm what values AG4 reads for its buttons, and its analogue stick(s)? I do not own one of those controllers--or anything XBox, at all, for that matter--so, I'ven't a way to test it, or otherwise to read from it to see what it outputs, that we can read. To clarify, what I don't know, is how that specific controller wants to be mapped to joy[] As a reference: typedef struct JOYSTICK_INFO { int flags; - status flags for this joystick int num_sticks; - how many stick inputs? int num_buttons; - how many buttons? JOYSTICK_STICK_INFO stick[n]; - stick state information JOYSTICK_BUTTON_INFO button[n]; - button state information } JOYSTICK_INFO; We use 18 total buttons, and we have config values for the joystick axis as follows: 1 control_state[0]=key[DUkey]||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset < -STICK_PRECISION : joybtn(DUbtn));
2 control_state[1]=key[DDkey]||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn));
3 control_state[2]=key[DLkey]||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn));
4 control_state[3]=key[DRkey]||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn));
5 control_state[4]=key[Akey]||joybtn(Abtn);
6 control_state[5]=key[Bkey]||joybtn(Bbtn);
7 control_state[6]=key[Skey]||joybtn(Sbtn);
8 control_state[7]=key[Lkey]||joybtn(Lbtn);
9 control_state[8]=key[Rkey]||joybtn(Rbtn);
10 control_state[9]=key[Pkey]||joybtn(Pbtn);
11 control_state[10]=key[Exkey1]||joybtn(Exbtn1);
12 control_state[11]=key[Exkey2]||joybtn(Exbtn2);
13 control_state[12]=key[Exkey3]||joybtn(Exbtn3);
14 control_state[13]=key[Exkey4]||joybtn(Exbtn4);
15
16 if(num_joysticks != 0)
17 {
18 control_state[14]= STICK_2_Y.pos - js_stick_2_y_offset < -STICK_PRECISION;
19 control_state[15]= STICK_2_Y.pos - js_stick_2_y_offset > STICK_PRECISION;
20 control_state[16]= STICK_2_X.pos - js_stick_2_x_offset < -STICK_PRECISION;
21 control_state[17]= STICK_2_X.pos - js_stick_2_x_offset > STICK_PRECISION;
22 }
I'm not sure if we need to map more possible buttons, or if the user (shadowblitz) needs to properly map the integer for his stick ID, or both.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Wouldn't the source for allegro 4 have it? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Oscar Giner
Member #2,207
April 2002
|
I've tried an old Allegro 4 game of mine that supports joypad mapping and this is what it reports with XBox One X controller under Win 10: Analog inputs: Dpad is mapped to stick 3. Axis 0 for left/right and axis 1 for up/down. Buttons: A: 0 -- |
|