TweetFollow Us on Twitter

Cubby VR Part II

Volume Number: 16 (2000)
Issue Number: 11
Column Tag: QuickDraw 3D Tricks

Cubby: Multiscreen Desktop VR Part II

by By Maarten Gribnau and Tom Djajadiningrat

How to create an Input Sprocket driver for a 3D input device


In this second part of our 'Cubby: Multiscreen Desktop VR' trilogy, we will introduce you to the art of creating a driver to read an Origin Instruments Dynasight input device. With the Dynasight, the position of the head of the user is established so that Cubby can display the correct images on its screens. The driver is created with InputSprocket, which is part of Apple's Game Sprockets API.


In our previous articles about Desktop VR (Djajadiningrat & Gribnau, 1998; Gribnau & Djajadiningrat, 1998), we used the Pointing Device Manager (PDM) of QuickDraw 3D to serve our input needs. We promoted the PDM because it was intended to support 3D input devices. The PDM and InputSprocket have in common that they both separate the device dependent code from the application. They relieve application programmers from dealing with devices directly and provide an abstraction layer for input programming. The difference between the two is that InputSprocket is actually supported by device manufacturers. There are no QuickDraw 3D drivers available to our knowledge. For InputSprocket on the other hand, lots of drivers are available. In addition, InputSprocket has configuration management built in. A standard interface is provided for connecting devices to applications. For these reasons InputSprocket provides a better solution for Cubby's input needs than the PDM.

In this episode we cover programming with InputSprocket to create a device driver. In the next episode the application side will be covered. Together, the two articles cover the whole of InputSprocket. The driver we describe is for the Dynasight device. If you do not own one or plan to buy one, you might still be interested because the techniques explained here can be used for other input devices as well. Documentation on writing InputSprocket drivers is scarce, so you might pick up some facts here. To compile our code, you will probably need to download the latest version of InputSprocket from the Apple web site (see References section), which is currently version 1.7.3.

If you are familiar with programming drivers for InputSprocket, you can safely skip the next section and proceed with the following section about creating an InputSprocket driver for the Dynasight. If InputSprocket drivers are new to you, you can read the next section and be introduced to the basic concepts. If you have worked with InputSprocket before but not with drivers, you can also read the next section to learn how drivers and applications communicate.

Introduction to InputSprocket

The goal of InputSprocket is to make life easier for game programmers who deal with input devices. There are an immense number of devices on the market with different features. Trying to have a game support all these devices optimally can lead to severe headaches. Most games support input devices through emulation of the keyboard and mouse. But emulation does not suffice when supporting complex devices that have directional pads, levers, wheels, etc. For one, the game cannot take advantage of the extra input controls of complex devices and secondly, configuring the devices and connecting them to game controls is device specific. That means that game programmers should provide configuration capabilities for each device that they need to support.

This is where InputSprocket comes in. It solves these problems through an input device architecture that allows games developers to create games that can use a wide variety of input devices. Input device developers can use InputSprocket to build device drivers that provide a description of input device controls that the game can use to automatically configure its control options. The device driver can also provide a user interface that allows the user to change default control options. Therefore, game programming is made easier because a lot of device dependent code is moved from the application to the device driver.

The communication between InputSprocket drivers and games is based on elements. The element is a building block used to describe the capabilities of a device. Each control of a device is described with an element, so every device can be described with a set of elements. For example, a one-button mouse can be described with an element for the x-axis, an element for the y-axis and a button element. More complex devices may require more elements but are handled in the same way. An element is described by the following three pieces of data.

A human readable identifier is a string that the game can display to identify the element for the user during configuration. Examples of such identifiers are "trigger", "roll" or "move forward".

The element kind is a four-character sequence that indicates the type of data the element produces. For example, button elements will typically produce two-state values while axis elements produce continuous data. InputSprocket currently provides five basic element kinds:

  • Button elements produce two-state data.
  • Directional pad elements are nine state elements with an idle position and eight states corresponding to the eight directions on a typical directional game pad.
  • Axis elements produce continuous data, either with or without a meaningful center. A symmetrical axis has a meaningful center, like the axis of a joystick. Axis elements such as a gas pedal or a brake do not have a meaningful center.
  • Delta elements are like axis elements but instead of an absolute position or orientation, they produce Delta data, which indicates the distance moved relative to the previous position (e.g. mouse axes).
  • Movement elements produce movement data that is given both as x-y axis data and directional pad data, allowing the game to use whichever is suitable. Note that in general you should use axis data instead.

There is a sixth element kind, the virtual element, which we will encounter later.

The label of an element gives the suggested use for an element. For example, a button element may be intended as the start button or the firing button. During configuration, a game uses labels to find the elements it requires for play.

As was mentioned, elements are the way applications communicate with drivers. There are two interfaces to pass data from drivers to applications using elements: the low-level and the high-level interface. In principle, driver programmers can decide which interface to implement. It is tempting to implement the low-level interface only, since it is the easiest to implement. However, drivers should provide both the low and the high-level interface, so that game application programmers can decide which interface they want to use.

Low-level Interface

The low-level interface is the simplest to implement when building drivers. Figure 1 shows a diagram of both the low and the high-level interfaces. The lower parts of the Dynasight Driver and the InputSprocket Extension represent the low-level interface. Cubby uses only the high-level interface and therefore connects the cameras to the high-level axis elements (Head X, Head Y and Head Z) exclusively. When the driver is loaded, it creates elements for every control it has. The driver is responsible for reading the data from the device and, as soon as it is loaded, should update its elements every time the device reports new data. Applications can connect via InputSprocket directly to the elements of the device and update the game state accordingly.

Figure 1. Diagram of the low- and high-level interfaces.

High-level Interface

In Figure 1, the upper parts of the Dynasight Driver and the InputSprocket Extension represent the high-level interface. The high-level interface is somewhat more complicated than the low-level interface but it has all the advantages that InputSprocket was meant to offer. Instead of connecting to the device's elements directly, games read data from the devices through virtual elements. These virtual elements are created by InputSprocket from the needs that the game has. Drivers are responsible for the mapping of needs to virtual elements. The high-level interface is only valid between the driver's Init and Stop callbacks that InputSprocket calls. Only the driver knows exactly how it has been configured, and when it is active, it is responsible for pushing data to those virtual elements for each need for which it is configured.


The majority of driver callbacks are related to the Configure dialog. These function calls will only happen while the high-level is valid (i.e. ISpInit has been called without a subsequent ISpStop). When the application calls ISpConfigure, a dialog is presented with a scrolling list of devices with one device selected. Figure 3 shows this dialog with our Dynasight device selected. The popup menus show the current connection of the Dynasight x- y- and z-axis to a game's roll, pitch and yaw controls. The selected device is responsible for the primary pane of the dialog, handling all events and drawing related to that area. The GetSize function is called to determine the preferred and minimum sizes of the pane area used by the device. If the pane area will not fit on any available display device, then that device is removed from the high-level list. The BeginConfiguration function is then called for each device. The configure dialog is resized and shown. The GetIcon function is called for each device to determine the icon to be shown in the scrolling list. Then the Show function is called for the selected device. This is the time to call AppendDITL for the resources to be displayed in the primary pane. All events returned in the dialog filter are passed to the HandleEvent function to give the device a chance to handle them. If update events are not handled (the recommended option to avoid extra flicker), InputSprocket will make the device Draw function call from within a BeginUpdate/EndUpdate pair. Unhandled mouse clicks will be passed to the Click function. If the device called AppendDITL to add items to the dialog and those items are returned by InputSprocket's ModalDialog call, then it will call the DialogItemHit function.

The device should maintain a 'dirty' variable that is set whenever any configuration information is changed, and returned and cleared when the Dirty call is made. When a different device is selected in the list, the old device receives a Hide function call and the new device a Show function call. When the dialog is closed, every device receives an EndConfiguration call.

Figure 2. InputSprockets's configuration dialog box with the Dynasight device selected.


Figure 3 illustrates the sequence of events when a game is using InputSprocket. The initiating calls are shown on the left and the driver's responses are found on the right. There are four major activities. Low-level initialization is entered when an application calls ISpStartUp. InputSprocket will then load the driver and call its major entry point. In response, the driver should look for devices present on the system and create InputSprocket devices for each active device. If a device was created, InputSprocket will call the driver's Meta handler to find out where the driver's entry points are. If no InputSprocket device was created, the driver is unloaded. High-level initialization is entered when the application calls ISpInit. InputSprocket passes the needs and virtual elements to the driver. In response, the driver stores them and does an auto-configuration. This means that the driver will try to find an optimal match between the needs of the application and the elements the device has. When the high-level interface is valid, the application can call ISpConfigure. This starts the configuration activities explained in the previous section.

There are several guidelines that should be followed during auto-configuration. If a previous device fulfilled a need and the kISpNeedFlag_NoMultiConfig bit is set in the need structure for that need, the device should not attempt to auto-configure to the need. The driver should indicate that it is fulfilling a need so that devices queried later know that the need is taken. More guidelines can be found in Apple's documentation of InputSprocket (see References section). After auto-configuring, the device should immediately push initial values to the corresponding virtual elements and from that point push data to those virtual elements whenever data is pushed to the elements to which they are configured.

When the application calls ISpStop, the validity of the high-level interface ends. The drivers should stop pushing data to the virtual elements and dispose the needs and the virtual elements. Calling ISpShutdown within the application causes InputSprocket to call the driver's termination routine. In response, the driver should stop pushing low-level data and dispose the InputSprocket device.

Figure 3. The sequence of events in communication between driver and game.

Creating an InputSprocket Driver for the Dynasight

Now that we have a basic understanding of how InputSprocket works, we will dive into the coding of a driver and illustrate how we can put this knowledge to use. We take the Dynasight device as example and start with the real driver functionality: the initialization and transfer of data. The configuration of the driver will be covered in the next section. The Dynasight device is an infrared tracking device that is used in Cubby to track the head position of users. The 3D position data is made available on the serial port. In the following discussion, we will not go into the details of reading the position data from the serial port. If you are interested in that part of the driver, you can read our previous article about Desktop VR (Gribnau & Djajadiningrat, 1998) and/or you can have a look at the code accompanying this article.

Before we begin, we should make some general remarks about developing InputSprocket drivers. An InputSprocket driver is a shared library with a specific file type and creator ('shlb' and 'insp'). All drivers must be located in the same folder as the InputSprocket extension, which must be the Extensions folder. Being a shared library, it takes some extra effort to debug a driver. First of all, you should set the output directory of your development environment to the Extensions folder of the System folder on your startup disk, so that the compiled driver ends up there. Secondly, you should set a host application that is used to run the driver.

The Dynasight driver handles the six major tasks that all drivers should handle: shared library initialization, shared library termination, pushing data, 'high-level' Init, 'high-level' Stop, and the configure dialog user interface. The code for shared library initialization is shown in Listing 1. This routine is called when InputSprocket loads the driver. The important parts are that the driver checks whether a certain version of InputSprocket is available. If version 1.2 or greater is not available, the driver returns without creating any InputSprocket devices. In that case, InputSprocket unloads the driver. The other important point in this listing is that the driver retrieves the file specification of the shared library. The file specification is used in the driver initialization routine to locate the resource file.

Listing 1: ISpDriverDynasightMain.cp

OSErr __myinitialize(CFragInitBlockPtr ibp)
   OSErr   err = noErr;
   FSSpec fileSpec = {0,0,0};
   NumVersion version;
   UInt32 inputSprocketVersion;
#if __MWERKS__
   err = __initialize(ibp);
   if (err != noErr) {
      return err;
   // Require InputSprocket 1.2.0
   version = ISpGetVersion();
   inputSprocketVersion = * (UInt32 *) &(version);   
   if (inputSprocketVersion < 0x01200000) {
      return err;
   // Grab the file spec
   if (ibp->fragLocator.where == kDataForkCFragLocator) {
      // The shared library should always be located in the data fork
      fileSpec = *ibp->fragLocator.u.onDisk.fileSpec;
   // Create IS device for each Dynasight device found on the system
   // If we don't create an IS device, IS will unload us
   return err;   

In Listing 2, it is shown what happens inside the initialization routine. The routine looks at all available serial ports for a Dynasight. If one is found, the driver's resource file is opened and a structure in a global array (fDynas) is filled with all the information for the device on the current port. After setting some default values in the structure, the InputSprocket device is actually created (by calling CreateDevice) and the Dynasight is put into action. Finally, after all ports have been checked, the resource file of the driver is closed.

Listing 2: ISpDriverDynasight.cp

OSErr DynasightInit(FSSpec fileSpec)
   OSErr err;
   short resourceRef = -1;                  // ref to our resource file
   Boolean resourceFileOpen = false;   // true if our resource file is open
   SerialPort port;
   UInt16 portID, numPortIDs;
   Boolean   portWithDynasight;
   fNumDynas = 0;
   numPortIDs = port.GetNumSerialPorts();
   for (portID = 0; portID < numPortIDs; portID++) {
         Dynasight dynasight;
         portWithDynasight = 
      if (portWithDynasight) {
         // Open the resource file and check for errors
         if (!resourceFileOpen) { 
            resourceRef   = FSpOpenResFile(&fileSpec, fsRdPerm);
            err = ResError();
            if (err != noErr) {
               return err;
            resourceFileOpen = true;
         fDynas[fNumDynas].dynasight = new Dynasight (portID);
         fDynas[fNumDynas].fileSpec = fileSpec;
         fDynas[fNumDynas].oldLLState.xAxis = kISpAxisMiddle;
         fDynas[fNumDynas].oldLLState.yAxis = kISpAxisMiddle;
         fDynas[fNumDynas].oldLLState.zAxis = kISpAxisMiddle;
         fDynas[fNumDynas].virtualElementsValid = false;
         fDynas[fNumDynas].active = false;
         // Create the device and store its reference
         fDynas[fNumDynas].active = true;
            MyDynasightCompletionProc, &fDynas[fNumDynas]);
   // Close the resource file
   if (resourceFileOpen) {
   return err;

The CreateDevice routine actually creates the device and elements for the low-level interface. The driver provides three axis elements, corresponding to the x-, y- and z-axis of the Dynasight device. In our driver we chose to set up the device using a resource (of type 'isdv'), as shown in Listing 3. This resource contains all the information of an ISpDeviceDefinition structure that is passed to the InputSprocket. Listing 4 shows the creation of an axis element. Again, we chose to set up the axis elements from a resource (of type 'isel') that contains the information in an ISpElementDefinitionStruct structure which is needed to set up an element. After retrieving the element resource, yet another resource is retrieved. This is the element configuration resource (of type 'isei') that is used to configure the element. This part is optional. If the resource is not available or invalid, the element is still created in the subsequent ISpElement_New call.

Listing 3: ISpDriverDynasight.cp

OSErr CreateDeviceFromResource(
   short resId, 
   UInt32 refCon,
   ISpDeviceReference *device)
   Handle h;
   OSErr err;
   ISpDeviceDefinition def;
   // Read the device resource from the res file
   h = Get1Resource('isdv', resId);
   err = ResError();
   if (err != noErr) { return err; }
   if (h == nil) { err = -1; }
   if (err != noErr) { return err; }
   // Copy the handle to a structure and release the handle   
   BlockMoveData(*h, &def, sizeof(def));
   // Create the InputSprocket device
   err = ISpDevice_New(&def, (ISpDriverFunctionPtr_MetaHandler) DeviceMetaHandler, refCon, device);
   return err;

Listing 4: ISpDriverDynasight.cp

OSErr CreateElementFromResource(
   short elementResId,
   short configResID,
   ISpDeviceReference device,
   ISpElementReference *element)
   Handle h1;                  // handle to resource based element definition structure
   Handle h2;                  // handle to resource based element configuration info
   OSErr err;      
   ISpElementDefinitionStruct def;   // actual element definition structure
   // Read the element definition struct from a resource
   h1 = Get1Resource('isel', elementResId);
   err = ResError();
   if (err != noErr) { return err; }
   if (h1 == nil) { err = -1; }
   if (err != noErr) { return err; }
   // Copy the handle to a structure
   BlockMoveData(*h1, &def, sizeof(def));
   // Read the configuration information from a resource (this may fail)
   h2 = Get1Resource('isei', configResID);
   err = ResError();
   if (h2 && (err == noErr)) {
      def.configInfo = *h2;
      def.configInfoLength = GetHandleSize(h2);
   // Create the InputSprocket element
   def.device = device;
   err = ISpElement_New(&def, element);
   // Release resources
   return err;

When creating the device in Listing 2, a pointer to DeviceMetaHandler was passed to the ISpDevice_New routine. This routine is called by InputSprocket to retrieve pointers to all the callbacks in our driver. It is called after the initialization of the driver. Listing 5 shows a part of the DeviceMetaHandler. InputSprocket calls the routine with a selector. The routine selects the appropriate callback and returns it. This example returns only the pointers to our Init and Stop callbacks. In our driver, the Meta handler returns pointers dealing with the configuration as well. These will be listed in the next section.

Listing 5: Example of a device Meta handler

ISpDriverFunctionPtr_Generic DeviceMetaHandler(
   UInt32 refCon,
   ISpMetaHandlerSelector selector)
   ISpDriverFunctionPtr_Generic function = NULL;
   ISpDriverFunctionPtr_Init funcInit;
   ISpDriverFunctionPtr_Stop funcStop;
   switch(selector) {
      case kISpSelector_Init:
         funcInit = (ISpDriverFunctionPtr_Init) Init;
         function = (ISpDriverFunctionPtr_Generic) funcInit;
      case kISpSelector_Stop:
         funcStop = (ISpDriverFunctionPtr_Stop) Stop;
         function = (ISpDriverFunctionPtr_Generic) funcStop;
   return function;

The beating hart of the driver is listed in Listing 6. This is the routine that is called whenever there is new data available from the Dynasight. We passed a pointer to this routine when we started the Dynasight in Listing 2. In the routine, it is first checked whether the low-level interface is active and whether the Dynasight is producing reliable data. Then, the position read from the Dynasight is scaled between 0 and 1 and subsequently scaled between InputSprocket axis values kISpAxisMinimum and kISpAxisMaximum. This is a requirement of InputSprocket. The convention is to scale coordinates of devices between those boundaries. For instance, with a joystick, kISpAxisMinimum should be sent when the joystick is fully rotated to one end and kISpAxisMaximum when it is fully rotated the other way.

The scaled coordinates are pushed to the low-level elements with the three ISpElement_PushSimpleData calls but only when a coordinate has changed. Then, the low-level data is converted to high-level data (in our case copied) and send to the virtual elements when the high-level interface is valid.

Listing 6: ISpDriverDynasight.cp

void MyDynasightCompletionProc(
   DynasightCompletionProcData* data)
   OSStatus err;
   AbsoluteTime time;
   TDynasightRecPtr dyna = (TDynasightRecPtr)data->data;
   TISpLowLevelState llState;
   TISpHighLevelState hlState;
   float xf, yf, zf;
   if ((dyna->active) && (data->dynasightStatus ==
         dynasightStatus_Track)) {
      time = ISpUptime();

      // Scale Dynasight coordinates between 0 and 1
      NormalizeDynasightPosition(&data->position, &xf, &yf, &zf);
      // Put point between kISpAxisMinimum and kISpAxisMaximum
      scale = kISpAxisMaximum - kISpAxisMinimum;
      xf = kISpAxisMinimum + xf * scale;
      yf = kISpAxisMinimum + yf * scale;
      zf = kISpAxisMinimum + zf * scale;
      llState.xAxis = (UInt32)xf;
      llState.yAxis = (UInt32)yf;
      llState.zAxis = (UInt32)zf;
      // Push low-level data for low-level interface
      if (llState.xAxis != dyna->oldLLState.xAxis) {
         err = ISpElement_PushSimpleData(
                     dyna->deviceXAxis, llState.xAxis, &time);
      if (llState.yAxis != dyna->oldLLState.yAxis) {
         err = ISpElement_PushSimpleData(
                     dyna->deviceYAxis, llState.yAxis, &time);
      if (llState.zAxis != dyna->oldLLState.zAxis) {
         err = ISpElement_PushSimpleData(
                     dyna->deviceZAxis, llState.zAxis, &time);
      // Push high-level data for high-level interface
      LowToHighLevelState(&llState, &hlState);
      if (dyna->virtualElementsValid) {
         SetVirtualsData(dyna, &hlState);
      dyna->oldLLState = llState;
      dyna->oldHLState = hlState;

InputSprocket Driver Configuration

We will now show the important parts of the driver relating to the configuration dialog. For our Dynasight driver this part is relatively easy since we have only three popup menus in the dialog box (see Figure 2). Each menu can be used to change the function of a Dynasight axis. For example, a user might select the menu and change the function of the x-axis from need 'pitch' to need 'move forward'. The driver maintains the list of total needs of the application and a mapping of needs to axes. A selection in the dialog might change this mapping.

As was mentioned above, the first routine InputSprocket calls when starting configuration is the GetSize routine. The driver returns the minimal and optimal size we need, as shown in Listing 7. The next routine called is the GetIcon routine shown in Listing 8. The driver returns the resource identifier of the icon suite of the Dynasight driver.

Listing 7: ISpDriverDynasight.cp

OSStatus GetSize(
   UInt32 refCon,
   Point *minimum,
   Point *best)
   best->h = minimum->h = 200;
   best->v = minimum->v = 120;   
   return noErr;

Listing 8: ISpDriverDynasight.cp
OSStatus GetIcon(
   UInt32 refCon,
   short *iconSuiteResourceId)
   *iconSuiteResourceId = kIconSuiteDynasight;
   return noErr;

When the Dynasight device is selected is the dialog box, InputSprocket calls the driver's Show routine listed in Listing 9. This is the time to have our dialog items added to the main dialog pane. First, some information about the dialog is stored for later use (in the Hide routine for instance). Then, the 'DITL' resource is retrieved from the resource file and appended at the end. Listing 10 shows how the reverse takes place. The Hide routine is called when another device is selected in the dialog or when the dialog is closed. Then, the driver removes its dialog items from the 'DITL'.

Listing 9: ISpDriverDynasight.cp

OSStatus Show(
   UInt32 refCon,
   DialogPtr theDialog, 
   short dialogItemNumber,
   Rect *r)
   OSStatus err;
   TDynasightRecPtr dyna = (TDynasightRecPtr) refCon;
   Handle ditl;
   dyna->dialogRect = *r;   
   dyna->dialogPtr = theDialog;
   dyna->dialogBaseDITLCount = CountDITL(theDialog);

   // Open the resource file, get our DITL and append it
   dyna->resFileRef = FSpOpenResFile(&dyna->fileSpec, 
   err = ResError();
   if (err != noErr) { return err; }
   ditl = Get1Resource('DITL', kDITLID_Config);
   err = ResError();
   if (err != noErr) {
      return err;
   AppendDITL(theDialog, ditl, -dialogItemNumber);
   // Free our DITL

   return noErr;

Listing 10: ISpDriverDynasight.cp

OSStatus Hide(
   UInt32 refCon)
   TDynasightRecPtr dyna = (TDynasightRecPtr) refCon;
   // Restore to original count of items
   ShortenDITL(dyna->dialogPtr, CountDITL(dyna->dialogPtr) - 
   dyna->dialogPtr = nil;
   return noErr;

When the dialog is on the screen, the driver needs to respond to events to track whether there are changes in the configuration. In our case, the driver has only popup menus that it can handle by responding to mouse click events. Therefore, our driver ignores all other events that InputSprocket passes. In Listing 11, it is shown how the driver handles mouse clicks. First the position of the click is established. Then we iterate through our popup menus and call HandleAxisClick for each axis. This routine checks whether the current need of an axis changes as a result of the click.

Listing 11: ISpDriverDynasight.cp

OSStatus Click(
   UInt32 refCon, 
   const EventRecord *event)
   TDynasightRecPtr dyna = (TDynasightRecPtr) refCon;
   Point where;
   UInt32 itr;
   short itemNo;
   UInt32 oldNeed;

   where = event->where;

   for (itr = kDialogItem_FirstPopup;
         itr <= kDialogItem_NumPopups;
         itr++) {
      itemNo = itr + dyna->dialogBaseDITLCount;
      oldNeed = dyna->axisIndexToNeeds[itr-1];
      switch (itr) {
         case kDialogItem_XAxis:
            HandleAxisClick(dyna, where, itemNo,
               kISpElementLabel_Axis_XAxis, kAxisIndex_XAxis,
         case kDialogItem_YAxis:
            HandleAxisClick(dyna, where, itemNo,
               kISpElementLabel_Axis_YAxis, kAxisIndex_YAxis,
         case kDialogItem_ZAxis:
            HandleAxisClick(dyna, where, itemNo,
               kISpElementLabel_Axis_ZAxis, kAxisIndex_ZAxis,
   return noErr;

Listing 12 shows the HandleAxisClick routine. First, it is checked whether the popup is actually hit and if the need for the current axis changed as a result of the click. If the need changed, the need for that axis is first cleared. Then, the new need is activated. The current configuration is marked 'dirty' as InputSprocket requires. Finally, the popup menu is drawn with the new need setting to reflect the change in need for this axis.

Listing 12: ISpDriverDynasight.cp

void HandleAxisClick(
   TDynasightRecPtr dyna,
   Point where,
   short itemNo,
   ISpElementLabel elementLabel,
   TAxisIndex axisIndex,
   UInt32 oldNeed)
   UInt32 itemIndex = itemNo - dyna->dialogBaseDITLCount;
   UInt32 newNeed;
   if (CheckPopUpHit(dyna, where, itemNo,
         kISpElementKind_Axis, elementLabel, validAxisKinds,
         validAxisKindsCount, oldNeed, newNeed) &&
         (oldNeed != newNeed)) {
      dynasightPtr->axisIndexToNeeds[axisIndex] = newNeed;
      dynasightPtr->configurationDirty = true;
      PlotPopupIcon(dynasightPtr,axisIndex + 1 + 
         dynasightPtr->dialogBaseDITLCount, ttNone);

This concludes our coverage of the driver's code for the configuration dialog. There are some parts of the driver that we could not cover such as auto-configuration. The interested reader can look at the full source code of the driver to see how this is accomplished.


In this month's episode, you have discovered how InputSprocket can be used to create a driver for the Dynasight device. We hope that this episode has illustrated the power of InputSprocket. To connect Cubby with the Dynasight, we could have used parts of the driver code and pasted them directly into the Cubby application code. That would have saved the time to write and debug the driver. However, now that we have a driver, we can use the same device with other InputSprocket-savvy applications (imagine looking around in a game with the Dynasight as head-tracking device...). Moreover, making Cubby support InputSprocket, we can use any 3D device with an InputSprocket driver for Cubby.

In next month's episode, we will cover the integration of Cubby with InputSprocket. We will show you how Cubby uses InputSprocket to move the cameras from part I. In addition, we will cover calibrating Cubby so that Cubby positions the cameras such that the correct images are generated.

Bibliography and References

  • Apple Game Sprockets web site. The place to download Apple Game Sprockets software, documentation and example software. Available as:
  • Configuring Game Input Devices with InputSprocket. Available as:
  • Djajadiningrat, J. P. & Gribnau, M. W. (1998). Desktop VR using QuickDraw 3D, Part I. MacTech Magazine 14(7), 32-43.
  • Gribnau, M. W. & Djajadiningrat, J. P. (1998). Desktop VR using QuickDraw 3D, Part II. MacTech Magazine 14(8), 26-34.
  • Djajadiningrat, J.P. & Gribnau, M.W. (2000). Cubby: Multiscreen Desktop VR Part I. MacTech Magazine 16(10).

Maarten is always jealous of his co-author. The ease with which Tom creates a funny 'about the author' piece starts to become almost traumatic. He is now on the verge of refusing to finish his contribution to the final episode. You might try to inspire him with an email at:

There are some striking similarities between Tom and his Wallstreet PoBo. You need to push them really hard to wake them from sleep, if you persist it still takes ages before they finally get into action, and sometimes it appears as if they've woken up but really all they do is zombie around in some undefined state in which it is impossible to get anything sensible out of them. If they're up and running you can reach them at


Community Search:
MacTech Search:

Software Updates via MacUpdate

Kodi 17.1. - Powerful media center tool...
Kodi (was XBMC) is an award-winning free and open-source (GPL) software media player and entertainment hub that can be installed on Linux, OS X, Windows, iOS, and Android, featuring a 10-foot user... Read more
Bookends 12.8 - Reference management and...
Bookends is a full-featured bibliography/reference and information-management system for students and professionals. Bookends uses the cloud to sync reference libraries on all the Macs you use.... Read more
Apple iTunes 12.6 - Play Apple Music and...
Apple iTunes lets you organize and stream Apple Music, download and watch video and listen to Podcasts. It can automatically download new music, app, and book purchases across all your devices and... Read more
Default Folder X 5.1.4 - Enhances Open a...
Default Folder X attaches a toolbar to the right side of the Open and Save dialogs in any OS X-native application. The toolbar gives you fast access to various folders and commands. You just click on... Read more
Amazon Chime 4.1.5587 - Amazon-based com...
Amazon Chime is a communications service that transforms online meetings with a secure, easy-to-use application that you can trust. Amazon Chime works seamlessly across your devices so that you can... Read more
CrossOver 16.2 - Run Windows apps on you...
CrossOver can get your Windows productivity applications and PC games up and running on your Mac quickly and easily. CrossOver runs the Windows software that you need on Mac at home, in the office,... Read more
Adobe Creative Cloud - Access...
Adobe Creative Cloud costs $19.99/month for a single app, or $49.99/month for the entire suite. Introducing Adobe Creative Cloud desktop applications, including Adobe Photoshop CC and Illustrator CC... Read more
MegaSeg 6.0.2 - Professional DJ and radi...
MegaSeg is a complete solution for pro audio/video DJ mixing, radio automation, and music scheduling with rock-solid performance and an easy-to-use design. Mix with visual waveforms and Magic... Read more
Bookends 12.8 - Reference management and...
Bookends is a full-featured bibliography/reference and information-management system for students and professionals. Bookends uses the cloud to sync reference libraries on all the Macs you use.... Read more
Adobe Creative Cloud - Access...
Adobe Creative Cloud costs $19.99/month for a single app, or $49.99/month for the entire suite. Introducing Adobe Creative Cloud desktop applications, including Adobe Photoshop CC and Illustrator CC... Read more

The best deals on the App Store this wee...
Deals, deals, deals. We're all about a good bargain here on 148Apps, and luckily this was another fine week in App Store discounts. There's a big board game sale happening right now, and a few fine indies are still discounted through the weekend.... | Read more »
The best new games we played this week
It's been quite the week, but now that all of that business is out of the way, it's time to hunker down with some of the excellent games that were released over the past few days. There's a fair few to help you relax in your down time or if you're... | Read more »
Orphan Black: The Game (Games)
Orphan Black: The Game 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: Dive into a dark and twisted puzzle-adventure that retells the pivotal events of Orphan Black. | Read more »
The Elder Scrolls: Legends is now availa...
| Read more »
Ticket to Earth beginner's guide: H...
Robot Circus launched Ticket to Earth as part of the App Store's indie games event last week. If you're not quite digging the space operatics Mass Effect: Andromeda is serving up, you'll be pleased to know that there's a surprising alternative on... | Read more »
Leap to victory in Nexx Studios new plat...
You’re always a hop, skip, and a jump away from a fiery death in Temple Jump, a new platformer-cum-endless runner from Nexx Studio. It’s out now on both iOS and Android if you’re an adventurer seeking treasure in a crumbling, pixel-laden temple. | Read more »
Failbetter Games details changes coming...
Sunless Sea, Failbetter Games' dark and gloomy sea explorer, sets sail for the iPad tomorrow. Ahead of the game's launch, Failbetter took to Twitter to discuss what will be different in the mobile version of the game. Many of the changes make... | Read more »
Splish, splash! The Pokémon GO Water Fes...
Niantic is back with a new festival for dedicated Pokémon GO collectors. The Water Festival officially kicks off today at 1 P.M. PDT and runs through March 29. Magikarp, Squirtle, Totodile, and their assorted evolved forms will be appearing at... | Read more »
Death Road to Canada (Games)
Death Road to Canada 1.0 Device: iOS Universal Category: Games Price: $7.99, Version: 1.0 (iTunes) Description: Get it now at the low launch price! Price will go up a dollar every major update. Update news at the bottom of this... | Read more »
Bean's Quest Beginner's Guide:...
Bean's Quest is a new take on both the classic platformer and the endless runner, and it's free on the App Store for the time being. Instead of running constantly, you can't stop jumping. That adds a surprising new level of challenge to the game... | Read more »

Price Scanner via

Updated iPad Price Trackers
Scan our Apple iPad (and iPod touch) Price Trackers for the latest information on sales, bundles, and availability on systems from Apple’s authorized internet/catalog resellers. We update the... Read more
12-inch 32GB Space Gray iPad Pro on sale for...
B&H Photo has 12″ Space Gray 32GB WiFi Apple iPad Pros on sale for $50 off MSRP including free shipping. B&H charges sales tax in NY only: - 12″ Space Gray 32GB WiFi iPad Pro: $749 $50 off... Read more
2.6GHz Mac mini on sale for $559, $140 off MS...
Guitar Center has the 2.6GHz Mac mini (MGEN2LL/A) on sale for $559 including free shipping. Their price is $140 off MSRP, and it’s the lowest price available for this model. Read more
SSD Speeder RAM Disk SSD Life Extender App Fo...
Fehraltorf, Switzerland based B-Eng has announced they are making their SSD Speeder app for macOS publicly available for purchase on their website. SSD Speeder is a RAM disk utility that prevents... Read more
iPhone Scores Highest Overall in Smartphone D...
Customer satisfaction is much higher among smartphone owners who use their device to operate other connected home services such as smart thermostats and smart appliances, according to the J.D. Power... Read more
Swipe CRM Free Photo-Centric CRM Sales DEal C...
Swipe CRM LLC has introduced Swipe CRM: Visual Sales 1.0 for iPad, an app for creating, managing, and sharing visually stunning sales deals. Swipe CRM is targeted to small-and-medium creative... Read more
13-inch 2.0GHz Apple MacBook Pros on sale for...
B&H has the non-Touch Bar 13″ 2.0GHz MacBook Pros in stock today and on sale for $150 off MSRP. Shipping is free, and B&H charges NY sales tax only: - 13″ 2.0GHz MacBook Pro Space Gray (... Read more
15-inch Touch Bar MacBook Pros on sale for up...
B&H Photo has the new 2016 15″ Apple Touch Bar MacBook Pros in stock today and on sale for up to $150 off MSRP. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.7GHz Touch Bar... Read more
Apple’s iPhone 6s Tops Best-Selling Smartphon...
In terms of shipments, the iPhone 6s from Apple bested all competitors for sales in 2016, according to new analysis from IHS Markit, a world leader in critical information, analytics and solutions.... Read more
Logitech Rugged Combo Protective iPad Case an...
Logitech has announced its Logitech Rugged Combo, Logitech Rugged Case, and Logitech Add-on Keyboard for Rugged Case for Apple’s new, more affordable $329 9.7-inch iPad, a complete solution designed... Read more

Jobs Board

*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Fulltime aan de slag als shopmanager in een h...
Ben jij helemaal gek van Apple -producten en vind je het helemaal super om fulltime shopmanager te zijn in een jonge en hippe elektronicazaak? Wil jij werken in Read more
*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Fulltime aan de slag als shopmanager in een h...
Ben jij helemaal gek van Apple -producten en vind je het helemaal super om fulltime shopmanager te zijn in een jonge en hippe elektronicazaak? Wil jij werken in Read more
Starte Dein Karriere-Abenteuer in den Hauptst...
…mehrsprachigen Teams betreust Du Kunden von bekannten globale Marken wie Apple , Mercedes, Facebook, Expedia, und vielen anderen! Funktion Du wolltest schon Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.