getXBox360ControllerState(ControllerID OPTIONAL) : table - Fetches the state of the connected xbox controller. Returns a table containing the following fields on success:
ControllerID : The id of the controller (between 0 and 3)
PacketNumber : The packet id of the state you see. (use to detect changes)
GAMEPAD_DPAD_UP : D-PAD Up (boolean)
GAMEPAD_DPAD_DOWN: D-PAD Down (boolean)
GAMEPAD_DPAD_LEFT: D-PAD Left (boolean)
GAMEPAD_DPAD_RIGHT: D-PAD Right (boolean)
GAMEPAD_START: Start button (boolean)
GAMEPAD_BACK: Back button (boolean)
GAMEPAD_LEFT_THUMB: Left thumb stick down (boolean)
GAMEPAD_RIGHT_THUMB: Right thumb stick down (boolean)
GAMEPAD_LEFT_SHOULDER: Left shoulder button (boolean)
GAMEPAD_RIGHT_SHOULDER: Right shoulder button (boolean)
GAMEPAD_A: A button (boolean)
GAMEPAD_B: B button (boolean)
GAMEPAD_X: X button (boolean)
GAMEPAD_Y: Y button (boolean)
LeftTrigger: Left trigger (integer ranging from 0 to 255)
RightTrigger: Right trigger (integer ranging from 0 to 255)
ThumbLeftX: Horizontal position of the left thumbstick (-32768 to 32767)
ThumbLeftY: Verital position of the left thumbstick (-32768 to 32767)
ThumbRightX: Horizontal position of the right thumbstick (-32768 to 32767)
ThumbRightY: Vertical position of the right thumbstick (-32768 to 32767)
EDIT:
For hot keys just set up with a timer.
But that, and a function for setting vibration, is all I have seen for a game controller with CE lua. _________________
getXBox360ControllerState(ControllerID OPTIONAL) : table - Fetches the state of the connected xbox controller. Returns a table containing the following fields on success:
ControllerID : The id of the controller (between 0 and 3)
PacketNumber : The packet id of the state you see. (use to detect changes)
GAMEPAD_DPAD_UP : D-PAD Up (boolean)
GAMEPAD_DPAD_DOWN: D-PAD Down (boolean)
GAMEPAD_DPAD_LEFT: D-PAD Left (boolean)
GAMEPAD_DPAD_RIGHT: D-PAD Right (boolean)
GAMEPAD_START: Start button (boolean)
GAMEPAD_BACK: Back button (boolean)
GAMEPAD_LEFT_THUMB: Left thumb stick down (boolean)
GAMEPAD_RIGHT_THUMB: Right thumb stick down (boolean)
GAMEPAD_LEFT_SHOULDER: Left shoulder button (boolean)
GAMEPAD_RIGHT_SHOULDER: Right shoulder button (boolean)
GAMEPAD_A: A button (boolean)
GAMEPAD_B: B button (boolean)
GAMEPAD_X: X button (boolean)
GAMEPAD_Y: Y button (boolean)
LeftTrigger: Left trigger (integer ranging from 0 to 255)
RightTrigger: Right trigger (integer ranging from 0 to 255)
ThumbLeftX: Horizontal position of the left thumbstick (-32768 to 32767)
ThumbLeftY: Verital position of the left thumbstick (-32768 to 32767)
ThumbRightX: Horizontal position of the right thumbstick (-32768 to 32767)
ThumbRightY: Vertical position of the right thumbstick (-32768 to 32767)
EDIT:
For hot keys just set up with a timer.
But that, and a function for setting vibration, is all I have seen for a game controller with CE lua.
Thank you very much!
But when I try to Put say local Combo = {GAMEPAD_DPAD_RIGHT, GAMEPAD_X} AND press those keys = Nothing happens _________________
I have never used this, so it's hard to say what to do. But from the documentation on it, it looks like you need to create a timer then in the timer's call back use 'getXBox360ControllerState' to get a table of the controller state, then check the state to see what you need to run.
Code:
local timer = nil
local timerInterval = 100 ---- Timer intervals are in milliseconds
local timerTicks = 0
local function timer_tick(t) ---- Timer tick call back
local tbl = getXBox360ControllerState()
if tbl.GAMEPAD_DPAD_UP then
-- code
elseif tbl.GAMEPAD_A and tbl.GAMEPAD_B and not tbl.GAMEPAD_X then
-- code
end
end
timer = createTimer(getMainForm()) ---- Create timer with the main form as it's parent
timer.Interval = timerInterval ---- Set timer interval
timer.OnTimer = timer_tick ---- Set timer tick call back
To deal with button holds, you need to add a second timer to time the holds.
But there are no global variables for the controller state that I have seen. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum