Using Regions: LightGun, TouchScreen, Cursor
These samples demonstrate how to define regions of the screen and associate key codes with them. After that you can treat the regions just like key presses. Samples are included for use with a mouse, a light gun and a touch screen.
Using Mouse Cursor Functionality in DirectRT
DirectRT can receive screen location input using "area" codes that function just like keycodes. The following instructions will work with most standard mice, lightguns and touchscreens. Follow these steps to activate the functionality with DirectRT. First, using the Windows Notepad or other text editor, create a simple text file in your experiment folder called "cursor.txt", "lightgun.txt", or "touchscreen.txt" depending on which input source you are using. This file should be in the same folder as your input file. The presence of this file tells DirectRT that you want to use the screen area functionality. In this file, you can define up to 255 areas on your screen. It's basically a list of rectangle coordinates on your screen which you define based on the screen resolution in which you'll be running your experiment. For example, say you are running your input file in 800x600 display mode (set from "Options" in your Style file). You could create four areas that correspond to the four quadrants of the screen like this:
ID X Y W H
1, 1, 1, 400, 300
2, 401, 1, 400, 300
3, 1, 301, 400, 300
4, 401, 301, 400, 300
Each row is an "area". The first number is the area ID, which will function in your input file like a keycode. The second and third numbers are the x and y positions where the area starts (i.e., the top left corner). Finally, the fourth and fifth numbers are the width and height of the area. These numbers again are based on an 800x600 display--you would change them accordingly for a different display (e.g., 1024x768). Basically this means you can define as many rectangles of any size and location as you like. Importantly, each area gets an ID value--a number from 1 to 255. The ID's are important because you use these just like you would use keycodes in your input file. So if you wanted to specify that areas 1, and 3 (above) are valid for a particular trial and that area 3 is the correct response, then you simply say "rt:3,1"--just like keycodes.
The key benefit of doing it this way is that you will be able to utilize all of the features that are associated with the keycode method, such as skips and jumps and identifying the correct response simply by listing it first, requiring a correct response if desired, etc. Another benefit of doing it this way is that you can create a set of valid areas for any trial and in so doing, you can *exclude* areas from counting as valid areas. An example of this would be a case where you create 5 graphic "areas" on screen and you want the subject to select one. With this new method, you would add 5 areas to your text file that correspond to where these areas will be on screen. You then list those id's on that trial as valid responses, listing the correct one first. Responding to the screen in an area that is not one of these valid areas will not count as a response. In other words, the subject would actually have to select a valid target area.