Assignment 4 - User Input

Due Date: Thursday February 8th, 11:59PM

Questions? Check out the Assignment 4 FAQ and discussion page.

In this assignment you'll use a gamepad or joystick as input and create a simple user interface. You'll have to implement a small set of fixed functionality, but the rest of the assignment leaves it up to you to come up with creative ways to use the input devices.

Steps

Download and build the starter code

  1. Begin by downloading the Assigment 4 starter code and latest version of the libST source here. Note that you must use the new version of libST, it has been updated since the previous assignment.

  2. Build libST. Building libST should require the same steps on your development system as it did in previous assignments. A number of changes have been made to the code which are significant for this assignment. See the descriptions below for the full details of the changes, which you should look over and understand at a high level.
  3. Build the assignment 4 starter code. The subdirectory /assignment4 contains the starting code for your project. This directory should contain the C++ source file control.cpp. You will provide us your modified version of control.cpp as part of this assignment's handin. The directory also contains a sample texture.

Understanding Changes to libST

There have been some significant changes to libST for this assignment. Make sure you understand these changes before continuing as they'll be helpful and/or necessary to complete the assignment.

Briefly read through the implementation of the STJoystick class to familiarize yourself with its implementation. However, its not necessary to understand all the detail, i.e. you don't need to understand all the low level workings of the platform specific code.

Understand the Types of Joystick Input

Answer These Questions

(Please include answers to the following with your handin)

  1. Describe your exploration of your device - how you did it and what you found - in detail.

Access to Joysticks

We are providing a set of joysticks and gamepads that can be checked out for 2 days at a time. Closer to the deadline we'll reduce the length of time you can check them out for to ensure everybody has access.

If you have a joystick or gamepad of your own, please feel free to use it. However, we also suggest checking out devices that are unlike ones that you already have access to in order to experiment with the entire range of input devices. If you want to buy your own gamepad or joystick the cheapest ones are about $15 at Fry's. If you have a joystick and it isn't working with the STJoystick class, let us know and we may be able to help get it working.

Please start on the assignment early so you'll have enough time to get a joystick multiple times if you don't have one of your own. We want you to have time to experiment with them and don't want access to joysticks to become a problem the night the assignment is due.

Where to Work

Currently the myth computers don't allow you to access the joysticks once they have been plugged in. While we are waiting for that to be fixed you can use any lab computer with Windows and Visual Studio to work on. For example, the computers in Tresidder Lair, Meyer Library, and Green Library should all work fine. Of course working on your own computer is also fine.

Explore Your Device

The first step is to figure out what capabilities your device has and how they are exposed by libST. The skeleton code has a function setup() which initializes the joystick library and sets up a simple scene. Here you'll need to add the code that opens your joystick for use. You'll probably also want to print out some information you can get from the joystick system at this point for debugging purposes.

In order to explore your joystick you'll need to poll the joystick for new state. You need to do this periodically, so we've set up the idle function to be called whenever GLUT has nothing else to do. In that function, add some code to poll the joystick and print out its current state (to the console is fine). Use this to explore the different parts of your joystick and discover how actions are relayed to you.

Create an Interface

Now that you know how input maps to state in an STJoystick you should use that input to create an interface. The skeleton code creates a textured square and your interface should control this object in various ways. Feel free to add to or change the scene, but focus on interaction techniques, not making a great demo scene. No matter what scene you choose, you must include at least the following functionality:

Here are some additional ideas you can implement:

Be creative, we're looking for creative, intuitive controls.

In order to get full credit you must use at least

Hints for Getting Started

Grading

Submission Instructions

We would like submission to be in the form of a single .zip archive. This archive should contain your modified version of control.cpp, and a text file containing answers to assignment questions and details about your control scheme. Also note what joystick you used and what subset of its functionality is necessary to use your interface (e.g. 2 analog sticks, 1 hat, 8 buttons).

Please email this zip file to cs148-win0607-staff@lists.stanford.edu before the deadline. Please make the subject line of this email "CS148 Assignment 4 Handin".

last edited 2007-02-02 20:58:39 by rescomp-03-61109