XBox 360 Controller

Posted By: Feindbild

XBox 360 Controller - 03/30/14 13:00

Do we have support for the xbox 360 controller? I can't find anything in the manual about it.
This would be (another) major drawback for Acknex if it didn't have controller support... Yes I know about joy_*, wiimotes, the support of 3D mice, but nothing about xbox controller support.
Posted By: MasterQ32

Re: XBox 360 Controller - 03/30/14 13:23

Can be used with the DirectInput API
http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
Posted By: Superku

Re: XBox 360 Controller - 03/30/14 13:31

joy_* pretty much includes all types of gamepads (I'm using those variables to play my game with an XBox 360, PS4 and even a Nintendo 64 controller).
Posted By: oliver2s

Re: XBox 360 Controller - 03/30/14 16:06

You can just use the predefined engine variables (joy_*), like Spuperku said. Maybe this will help you:

Code:
//XBOX 360 CONTROLLER INPUT////////////////////////////////////
var XBOX360_get_deadzone(var axis)
{
	if(axis < -0.5){ return((axis+0.5)*2); }
	else if(axis > 0.5){ return((axis-0.5)*2); }
	else { return(0); }
}

#define XBOX360_BUTTON_X 258
#define XBOX360_BUTTON_Y 259
#define XBOX360_BUTTON_B 257
#define XBOX360_BUTTON_A 256
#define XBOX360_BUTTON_LB 260
#define XBOX360_BUTTON_RB 261
#define XBOX360_BUTTON_BACK 262
#define XBOX360_BUTTON_START 263
#define XBOX360_BUTTON_LEFT_STICK 264 
#define XBOX360_BUTTON_RIGHT_STICK 265
#define XBOX360_TRIGGER_LEFT maxv(joy_raw.z/255,0)
#define XBOX360_TRIGGER_RIGHT abs(minv(joy_raw.z/255,0))
#define XBOX360_STICK_LEFT_HORIZONTAL XBOX360_get_deadzone(joy_raw.x/255)
#define XBOX360_STICK_LEFT_VERTICAL XBOX360_get_deadzone(joy_raw.y*(-1)/255)
#define XBOX360_STICK_RIGHT_HORIZONTAL XBOX360_get_deadzone(joy_rot.y/255)
#define XBOX360_STICK_RIGHT_VERTICAL XBOX360_get_deadzone(joy_rot.x*(-1)/255)

Posted By: Feindbild

Re: XBox 360 Controller - 03/31/14 14:42

Hey, thank you for your helpful answers!! laugh
My problem with the default joy_* functions were
1) no vibration and
2) you can't press both triggers at once, one of the most important functions of them (zoom then shoot for example)

I will look into the DirectInput API, that looks promising but complicated.
Posted By: oliver2s

Re: XBox 360 Controller - 03/31/14 14:57

Originally Posted By: Feindbild
2) you can't press both triggers at once, one of the most important functions of them (zoom then shoot for example)


Ah yes, that's right.
Posted By: DLively

Re: XBox 360 Controller - 04/02/14 02:47

@ Feindbild: did you get any more info on the triggers? I recently purchased a wired 360 controller only to find such a disapointment
Posted By: DLively

Re: XBox 360 Controller - 04/02/14 05:51

This allows for the triggers to operate. If anyone finds an algorithm for both triggers, I, Feindbild, and many others would appreciate it very much, until then Here is how you can get started with the triggers laugh

Code:
var left_trigger;
var right_trigger;

var left_trigger_press;
var right_trigger_press;

function hold_triggers(){
    left_trigger = maxv(joy_raw.z/255,0);
    right_trigger = abs(minv(joy_raw.z/255,0));

    left_trigger_press = (left_trigger>0);
    right_trigger_press = (right_trigger>0);
}

action suchandsuch(){

    while(comparison){wait(1);
        if(left_trigger_press == 1 && right_trigger_press == 0){this();}
        if(right_trigger_press == 1 && left_trigger_press == 0){this();}
    }

}


Thank you for the contributiono Oliver2s laugh
I hope this is helpful for anyone else
Posted By: DLively

Re: XBox 360 Controller - 04/02/14 19:28

Middle console button for the 360 remote.
Anyone know the joy_code for this?
Posted By: Superku

Re: XBox 360 Controller - 04/02/14 20:00

Draw (DEBUG_VAR) key_lastpressed in a loop and find it out yourself the easy way!
Posted By: DLively

Re: XBox 360 Controller - 04/02/14 20:19

Great thinking!!!!

Tried it.
Its not a defined button..?
Posted By: Superku

Re: XBox 360 Controller - 04/02/14 20:35

From a quick look at google it seems like the Home button cannot be used as a regular gamepad button but not totally sure yet.
Posted By: DLively

Re: XBox 360 Controller - 04/02/14 23:23

Vibration dll?

Does anyone know anything about vibration support? I've read what I could on dll's in manual and also found that there is a page dedicated to the wiimote. Is there anything for the 360 controller? -> I looked on google for some other codes to see if I could translate them over and so far no good...
© 2024 lite-C Forums