Assignment 4 FAQ and Student Discussion Page

The course staff will post answers to frequently asked questions about assignment 4 here. Feel free to add to this page yourself if you've got information to share with the rest of the class. Remember, the quickest way to get a response from a TA is to post to cs148-win0607-staff@lists.stanford.edu

Return to the Assignment 4 page.

Error Compiling, Missing Symbols (__imp__RegCloseKey, __imp__RegQueryValueExA, __imp__RegOpenKeyExA)

Go to Projects -> control Properties... -> Linker -> Input and add advapi32.lib to "Additional Dependencies" it should link properly.

Question: Program Runs But Exits Immediately

The program requires an argument specifying the texture to be used (which makes it easier to keep track of the orientation of the square). If you run from Visual Studio with Debugging then the command window closes immediately after exiting the program and you can't see the error. See the next question for how to add the command line argument. Use "monet.png" as a default, which is provided in the zip file.

Comment: Command Line Arguments in VS

The skeleton code uses a command line argument to specify the texture to be used. To set the command line argument through Visual Studio (so you can easily debug your program), go to Project -> control Properties... and set the "Command Arguments" option under "Debugging". The option takes only the arguments, without the name of the program.

Question: Drift

Why does my object continue to drift as if I was pushing the analog stick slightly even when I have released it?

The input isn't perfect and sometimes the value being returned to you doesn't reflect exactly what the user is doing. The analog sticks don't always return exactly to (0,0) and this is a case you should handle. Part of handling this is experimenting enough with your controller to figure out what range of values you can safely ignore and still easily control the object.

Question: Non-zero Default Value

I'm using my own controller and one of the analog controls starts at 0 but once I touch the control the default value is something else (e.g. -32768). What do I do?

The STJoystick class forces the values of analog controls to be between SHRT_MIN and SHRT_MAX, making the default value 0. Not all controls move in both directions (e.g. triggers can be analog, but may only be pushed down). However, there's no way for STJoystick to know this so it always performs the scaling. Your best option is to create a special case for your joystick - check against its name and set the default value for the corresponding axes at startup. You can either implement this in the STJoystick code or in your own code. Make sure you include any changes with your submission.

last edited 2007-02-08 22:07:26 by nymphomaniac