Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GML script. Sets up our globals for all input functions in other scripts posted here.
///setup_input(run in a create event!)
//gamepads
var gp_num = gamepad_get_device_count();
for (var i = 0; i < gp_num; i++;)
{
if gamepad_is_connected(i)
{
alert("DEBUG: "+ string(gamepad_get_description(i)),0)
}
else
{
alert("DEBUG: No Gamepad Connected",0);
}
}
//joysticks
if joystick_exists(1)
{
alert("DEBUG: HID device 1 connected",0)
}
if joystick_exists(2)
{
alert("DEBUG: HID device 2 connected",0)
}
//Gamepad Deadzone
gamepad_get_axis_deadzone(0)
gamepad_set_axis_deadzone(0,.43)
//Input Globals
//=============
global.KBMuser = true;
global.mouse = true;
global.dp_up = noone;
global.dp_down = noone;
global.dp_left = noone;
global.dp_right = noone;
global.confirm = noone;
global.cancel = noone;
global.button3 = noone;
global.button4 = noone;
global.triggerr = noone;
global.bumperr = noone;
global.triggerl = noone;
global.bumperl = noone;
global.start = noone;
global.select = noone;
global.gpadConnected = false;
global.gpDevice = 0;
global.gpColor = c_blue;
global.gpColorFader = 0;
global.gpVib = 0;
if gamepad_is_connected(0)
{
global.gpadConnected = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment