Basically, to use bbTablet once you've installed it
, you include the bbtablet header
with "#include <bbtablet.h>" in your C++ program and call a few lines
To use the tablet you should first initialize the bbTablet library with this
bit of code:
HWND wnd = << get the window's device somehow!* >>
bbTabletDevice &td = bbTabletDevice::getInstance( );
td.initTablet( wnd, bbTabletDevice::SYSTEM_POINTER );
The above code will make it so your system mouse is controlled by the tablet.
If you want to continue to use the mouse separately (e.g. for bi-manual input),
pass in 'bbTabletDevice::SEPARATE_POINTER' instead.
Getting the HWND can be a non-trivial task if you're using a higher level
toolkit that doesn't readily give you that sort of information, but there
are ways. For instance a call to GetForegroundWindow() at the right
time often seems to do the trick. If you're working with GLUT or OpenGL
this little bit of code does the trick:
static void* getCurrentHWND()
// get current DC from wgl
You just need to be sure your GLUT window's GL context is current when you
call the above function.
Once initialized, you just have to periodically check for new tablet events
in your code:
bbTabletDevice &td = bbTabletDevice::getInstance();
<< use evt >>
Where an evt has the following members:
evt.x // [0,1] x coord
evt.y // [0,1] y coord
evt.z // [0,1] z coord (usually not supported)
evt.pressure // [0,1] pressure value
evt.angle // angle&axis give 3D rotation
evt.id // unique physical id if supported
evt.buttons // bitmask of pressed buttons
evt.type // cursor type
The angle and axis parameters define a 3D transformation for the stylus.
This uses the tilt information from the stylus whenever available. Otherwise
it just acts like the pen is standing straight up.
More information may also be available in the README.txt in the zips below.
There is also a test program or two in the distribution you can play
with. Project files are available for MSVC++ 6.0 only.