Joystick and Mouse Input


…\DirectRT\samples\5- other features\03 joystick and mouse input

Sample Description

The joystick and mouse input functions are fairly intuitive if you've played with the regular keyboard codes. Each 45 degree joystick region has its own code that acts just like a keyboard code. Similarly, each mouse button has its own code. The codes are as follows:



Joystick buttons (if applicable):

Button 1 = 241

Button 2 = 242

Button 3 = 243

Other mouse buttons (if applicable):

Middle button = 254

Fourth button = 255

The "priming with joystick.csv" sample is the standard priming example but instead of hitting the z or / key, you move the joystick up for negative and down for positive (simulating an approach/avoidance reaction). You might have to calibrate your joystick if you haven't already done so. In the Windows control panel, select "gaming options" or "gaming controllers". If you don't see your joystick there you'll have to add it (e.g., by "adding" a 2-axis, 2-button joystick or whatever you have). Then click on "properties" and "settings" and then click on "calibrate". This will let you know that your joystick is working. Then you should then be ready to try the joystick sample. You'll notice in the resulting data file that the joystick response is coded as correct or incorrect depending on what response the subject made. As with regular keycodes, the first code listed tells DirectRT which code is the correct response.

The "priming with mouse.csv" sample is identical except that it uses mouse input. Instead of hitting the z or / key, you click the left or right mouse button.

See also:

joystick continuous sample for details on recording continuous discrete joystick motion