(11-14-2021 04:02 AM)Esenthel Wrote: don't compare strings, just check buttons individually
Joypads[0].b(i)
ok ya I see that now, allot less complex
than what I was trying.
OK thats all working now, found joystick/gamepad old 2009 GamePad TOPHAT/PS3 GAMEPAD input link code on here -- user sydbod and barthap.
https://www.esenthel.com/forum/showthrea...t=joystick
https://www.esenthel.com/forum/showthread.php?tid=2946
Incase anyone needs this
for use on the Game Basic Multiple World Example.
Draws All inputs mouse, keyboard, joypad/gamepad/joystick all buttons clicked
to screen. no rumble vibration/ force feedback etc added yet will add when tested and working soon.
And cleanup add more code. I will add the input movement code in the class player when I complete and test it.
**************************************************************************
this block -> commented out
//enum {TRIGGER,BUTTON2,BUTTON3,BUTTON4,BUTTON5,BUTTON6,BUTTON7,BUTTON8};
//enum {JOYPAD1,JOYPAD2,JOYPAD3,JOYPAD4};
note: I could not get the function, Inputbutton JoyButton function to work that was in this old code, says errror no overloaded function takes 4 arguments when trying to compile, I did fine the error on the internet but on just c ++ so I read that, but my understanding is limited, so I am not sure and I could not find any esenthel code that is using the function that worked. so I commented out the function and enum's and used another joy button method instead and built ok. So is there a error in the format on this old code or has the function in api changed?. I like to know on how to fix and use or why it wont work if its a simple fix.
//InputButton JoyButton (INPUT_JOYPAD, TRIGGER, JOYPAD1, NULL); // //InputButton(INPUT_TYPE type, Byte button, Byte device=0, Bool (*req)()=NULL)
********************************************************************
MAIN
******
Add to top of file
**************
Vec2 point , // point position
axis , // x,y joystick values
extra , // rudder,throttle values
tophat; // tophat vectors
int TRIGGERL ;
int TRIGGERR ;
Char c; // character pressed
*****************************************************
void Draw()
{
Renderer(Render);
D.dot(RED ,Ms.pos()); // draw red dot at mouse cursor position
D.dot(GREEN,point ); // draw green dot at 'point' position
if(Ms.b(0))D.dot(BLACK, -0.1,0.4, 0.1); // when 0th mouse button on, draw big black dot
if(Ms.b(1))D.dot(BLACK, 0.1,0.4, 0.1); // when 1st mouse button on, draw big black dot
D.text(0,0.9, S+"character : "+c ); // draw stored character
D.text(0,0.7, S+"mouse : "+Ms.pos()); // draw mouse position
D.text(0,0.6, S+"point : "+point ); // draw point position
axis = Joypads[0].dir_a[0];
D.text(0,0.5, S+"Joystick x : "+axis.x ); // draw joystick x value
D.text(0,0.4, S+"Joystick y : "+axis.y ); // draw joystick y value
extra = Joypads[0].dir_a[1];
D.text(0,0.3, S+"Joystick extraA(rudder) : "+extra.x ); // draw joystick rudder value
D.text(0,0.2, S+"Joystick extraA(throttle) : "+extra.y ); // draw joystick throttle value
tophat = Joypads[0].dir;
D.text(1, 0.7, Joypads[0].name());
Str buttons; FREP(32)buttons+=Joypads[0].b(i); D.text(Rect_C(1, 0.6, 0, 0), S+"Buttons:\n"+buttons);
D.text(0, 0, S+"JoystickTophat/dpad Vec x : "+tophat+ " JoystickTophat/dpad Vec y : "+tophat ); // draw joystick tophat/dpad Vec value
TRIGGERL = Joypads[0].trigger[0];
TRIGGERR = Joypads[0].trigger[1];
//No InputButton JoyButton Function working +JoyButton.on() ) commented out
*******************************************************************
JoyButton.button=button 1;
D.text(0,0.0, S+"Joystick JoyButton(button 0)=Stick(button 1) : "+JoyButton.on() ); // draw trigger state
JoyButton.button=button 8;
D.text(0,-0.1, S+"Joystick JoyButton(button 7)=Stick(button 8) : "+JoyButton.on() ); // draw button state
***********************************************************
//JoyButton.button=TRIGGERL;
// D.text(0,-0.2, S+"Joystick JoyButton(button 0)=Stick(TRIGGERL) : "+TRIGGERL); // draw trigger state
// JoyButton.button=TRIGGERR;
// D.text(0,-0.3, S+"Joystick JoyButton(button 7)=Stick(TRIGGERR) : "+TRIGGERR); // draw button state
D.text(0,-0.2, S+"Joystick JoyButton(button 0)=Stick(TRIGGERL) : "+TRIGGERL+ "Joystick JoyButton(button 7)=Stick(TRIGGERR) : "+TRIGGERR); // draw button state
}