The available filters are: BUTTON_DPAD_UP Also a "pressed-only" and "released-only" filter is available for buttons. In case of multiple handlers it is possible to use a list of handlers as argument, as well as the add_handler() method and the remove_handler() method to remove them.įilters can be applied to select events of only certain buttons, trigger or stick. It is also possible to filter the inputs for every single handler. The library will automatically check the status of the gamepad and use the appropriate callback for the triggering event. To use this feature, extend the EventHandler to create one or multiple handlers and add them to the thread. With the GamepadThread class it is possible to handle asynchronous events. The following buttons exist: "DPAD_UP" = 1Īll trigger related Events have the following additional members:Įigger (either XInput.LEFT = 0 or XInput.RIGHT = 1) - which trigger was movedĮvent.value (range 0.0 to 1.0) - by how much the trigger is currently pressedĪll thumb stick related Events have the following additional members:Įvent.stick (either XInput.LEFT = 0 or XInput.RIGHT = 1) - which stick was movedĮvent.x (range -1.0 to 1.0) - the position of the stick on the X axisĮvent.y (range -1.0 to 1.0) - the position of the stick on the Y axisĮvent.value (range 0.0 to 1.0) - the distance of the stick from it's center positionĮvent.dir (tuple of X and Y) - the direction the stick is currently pointing Callback events and threading XInput.EVENT_STICK_MOVED = 6 - a thumb stick was moved on the controller user_indexĪll button related Events have the following additional members:Įvent.button_id - the XInput numerical representation of the buttonĮvent.button - a literal representation of the button XInput.EVENT_TRIGGER_MOVED = 5 - a trigger was moved on the controller user_index XInput.EVENT_BUTTON_RELEASED = 4 - a button was released on the controller user_index XInput.EVENT_BUTTON_PRESSED = 3 - a button was pressed on the controller user_index XInput.EVENT_DISCONNECTED = 2 - a controller with this user_index was disconnected XInput.EVENT_CONNECTED = 1 - a controller with this user_index was connected (this event will even occur if the controller was connected before the script was started) The Event class always has the following members:Įer_index (range 0 to 3) - the id of the controller that issued this eventĮvent.type - which type of event was issued Get_events will return a generator that yields instances of the Event class. You can also use the Event-system: events = get_events() XInput.DEADZONE_TRIGGER - (range 0 to 255) Trigger deadzone (default is 30) Using Events XInput.DEADZONE_RIGHT_THUMB - (range 0 to 32767) Right thumb stick deadzone (default is 8689) XInput.DEADZONE_LEFT_THUMB - (range 0 to 32767) Left thumb stick deadzone (default is 7849) Set_deadzone(deadzone, value) -> None Sets the deadzone values for left/right thumb stick and triggers. Get_battery_information(user_index) -> (, ) Returns the battery information for user_index Set_vibration(user_index, left_speed, right_speed) -> bool (Success) Sets the vibration of the left and right motors of user_index to values between 5 or in range 0.0 to 1.0 respectively. Get_thumb_values(state) -> ((LX, LY), (RX, RY)) Returns the values of the thumb sticks, expressed in X and Y ranging from 0.0 to 1.0 Get_trigger_values(state) -> (LT, RT) Returns a tuple with the values of the left and right triggers in range 0.0 to 1.0 ![]() Get_button_values(state) -> dict Returns a dictionary, showing which buttons are currently being pressed. Get_state(user_index) -> State Gets the State of the controller user_index Get_connected() -> (bool, bool, bool, bool) Query which controllers are connected (note: don't query each frame) ![]() It can be inmported like this: import XInput ![]() XInput-Python is available from the PyPI using pip install XInput-Python XInput-Python provides a few simple methods that can be used to query controller information. Just run program, it will recognize ur joystic/pad, run emu and enjoy.XInput-Python A simple to use interface to the XInput API for Python. If they are only drivers for vibration, then no need to install them. If your joystic/pad have drivers, install them first. Im wondering though, does your program detect every joystick/pad ? (03-21-2013 05:52 AM)Thewonderboy Wrote: Still, thanks for this. Just run the XInputTest, it will recongnize ur joystick, run emulator and play with it. You don't need to set up nothing in this program i gave. You can download the updated version here. ![]() It's a lot easier to use and set up since you can just auto download settings for your controller without having to set anything up yourself. (03-20-2013 08:25 PM)nightmesh Wrote: They have updated this program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |