Package URI: spaceball.tar.gz
[this is an export from a larger build environment]
A C++ userspace device driver for the SpaceTec Spaceball 4000 FLX.
2004-01-27 15:58:14 CST (Jan Tue) 1075240694
Author C. Alex. North-Keys
Update 2004-01-27 15:58:14 CST (Jan Tue) 1075240694
Notes:
- Code still shows its C derivation.
- Spatial events returned are in the right-handed cartesian expected by OpenGL
Miscellaneous Features:
- Consistent handling of held buttons for constructing button masks for events
- Interprets left/right hand switchover events from wrist rest sensor
- Supports select and poll by provided file descriptor
- Supports non-blocking input from spaceball
Limitations:
- This code does not address the need to share the spaceball among multiple
apps, either directly or by making it visible via XIE in the X server
Usage (see the test module in spaceball.cc for detail):
Spaceball sb();
if(sb.Open())
{
if(sb.AwaitInput(100)) // use 0 to poll, or sb.Fd() to build select mask
{
SpaceballEvent ev;
while(sb.EventGet(&ev))
{
switch(ev.type)
{
default: break;
case SpaceballEvent::SB_None: break;
case SpaceballEvent::SB_Spatial:
// spatial data is in ev's members x, y, z, rx, ry, and rz
// buttons current down are in ev.buttons_down, and
// counted in ev.buttons_down_count
break;
case SpaceballEvent::SB_ButtonPress:
// which button is in ev.button
break;
case SpaceballEvent::SB_ButtonRelease:
// which button is in ev.button
break;
}
}
}
sb.Close();
}
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eof