Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Created August 13, 2018 22:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PoppyWorks/7e9c79f974c710e56073eb639e58c03e to your computer and use it in GitHub Desktop.
Save PoppyWorks/7e9c79f974c710e56073eb639e58c03e to your computer and use it in GitHub Desktop.
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