gamepad

Psychopy IO Gamepad

为君一笑 提交于 2020-05-17 06:32:06
问题 I am using Builder in standalone PsychoPy 1.80.07 in Windows. I'm trying to figure out how to create a Code Component to receive responses from a Logitech F310 Gamepad. Ideally, I would like to just use the triggers. I do not get any error code when I run the experiment (which is the Stroop keyboard IO demo with the IO keyboard code component code replaced with the below code). It seems to run fine, but it just shows the first trial and waits for a subject response as thought it isn't hearing

Control vibration motors of game controller in pure Python?

↘锁芯ラ 提交于 2020-04-30 05:39:29
问题 I've bought a standard game controller that has vibration motors. It identifies itself as "SHANWAN Android Gamepad" but seems to be compatible to others as it works well on Linux out of the box. I found a script that enables me to read data from the game controller device path at https://gist.github.com/rdb/8864666 . I am now wondering: How can I control the vibration motors? I could find only XBox API code samples which are not helpful for obvious reasons. Has anyone an idea about how to

pygame: detect Joystick disconnect, and wait for it to be reconnected

旧时模样 提交于 2020-01-14 10:33:15
问题 I'm using a pygame.joystick.Joystick object and want to be able to print a message asking the user to reconnect a usb joystick once it's been unplugged. right now I have (roughly): js = pygame.joystick.Joystick(0) #... some game code and stuff pygame.joystick.quit() pygame.joystick.init() while pygame.joystick.get_count() == 0: print 'please reconnect joystick' pygame.joystick.quit() pygame.joystick.init() js = pygame.joystick.Joystick(0) js.init() but it doesn't reconnect properly, idk what

Gamepad API: Button events not firing

孤街浪徒 提交于 2020-01-05 03:59:28
问题 I have a bluetooth controller in which I've tested all the numbers of the buttons with this Gamepad tester: http://html5gamepad.com/, so I'm pretty sure the values of the buttons are correct. However, nothing seems to fire, the Gamepad is shown to be "connected", just the button events not working. Below is the code: function gameLoop() { if (navigator.webkitGetGamepads) { var wgp = navigator.webkitGetGamepads()[0]; if (wgp.buttons[12] == 1 || wgp.buttons[4] == 1) { console.log('move'); } };

Is there a way to use the HTML5 Gamepad API with multiple windows or tabs in Firefox?

試著忘記壹切 提交于 2020-01-01 15:03:23
问题 I'm designing an app that utilizes input from a gamepad using the HTML5 Gamepad API. I have the app working in both Firefox and Chrome, however Firefox does not seem to allow a second Window or Tab to access the gamepad after a previous tab has accessed it. I don't need both to access the api at the same time, I only need one to be able to access the api after the other. Chrome does not have this problem. I also tested using html5gamepad.com with the same results. Does anyone have a way to

Is there a way to use the HTML5 Gamepad API with multiple windows or tabs in Firefox?

試著忘記壹切 提交于 2020-01-01 15:03:22
问题 I'm designing an app that utilizes input from a gamepad using the HTML5 Gamepad API. I have the app working in both Firefox and Chrome, however Firefox does not seem to allow a second Window or Tab to access the gamepad after a previous tab has accessed it. I don't need both to access the api at the same time, I only need one to be able to access the api after the other. Chrome does not have this problem. I also tested using html5gamepad.com with the same results. Does anyone have a way to

How to differentiate a D-pad movement from a Joystick movement?

微笑、不失礼 提交于 2019-12-23 09:56:10
问题 I need to have two different behaviors, one for D-pad and another for the analog Joystick (on the same gamepad). The problem is that on the onGenericMotionEvent callback, both have the same information on the MotionEvent and I am not able to distinguish them. // d-pad MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=-1.5259255E-5, y[0]=-1.5259255E-5, toolType[0]=TOOL_TYPE_UNKNOWN, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=151637936, downTime

Toggle an input

随声附和 提交于 2019-12-20 07:25:41
问题 I am using SlimDX to use my Xbox 360 controller and I would like a way of when pressing a button on the controller the state changes to on and stays on but when I press it again it becomes off. Sort of like a toggle. But I have been unable to do one so far(Just a beginner really). Thanks for any help. Thomas. 回答1: You may use a bool to determine if the button is toggled on or off. You will also need to know the gamepad's previous state, so the bool won't toggle all the time, just because you

Xbox One Controller input to UWP App

只谈情不闲聊 提交于 2019-12-20 04:59:26
问题 I have been trying to make an Xbox One controller interact with a UWP application and have looked into the Gamepad class (based on the suggestions mentioned in the comments - Controller support for Xbox one in Windows UWP). I have 2 issues: 1) Gamepad.Gamepads.Count returns 0 for me even when I have my Xbox One controller switched on while the application is running on Xbox. 2) I do not know, how exactly can I assess when the A, B, X and Y buttons are pressed and also access the coordinates

How to record state of xbox/gamepad controller in Python?

别等时光非礼了梦想. 提交于 2019-12-11 07:05:49
问题 I need to know at a specific time the value of all buttons of an xbox controller. The reason being that I'm building a training set for a neural network, and I'm trying to simultaneously take a snapshot of the screen and take a "snapshot" of the controller state. Note that I was able to successfully do this for a keyboard version of this project, but the xbox controller is giving me difficulty. What I've tried is creating a dictionary of buttons and values, and updating the dictionary every