spacenav - Nim bindings for libspnav, the free 3Dconnexion device driver and SDK.
This file is part of the Nim I/O package collection. See the file LICENSE included in this distribution for licensing details. GitHub pull requests are encouraged. (c) 2015 Headcrash Industries LLC.
The spnav module declares all types and functions exported by the libspnav library. The integration of 3Dconnexion devices using this module typically involves the following three steps:
- On application startup, open a connection to the Spacenav driver daemon using spnavOpen
- In the application's event loop, poll the driver for available input events using spnavPollEvent
- Process any received SpnavEvent events in your application
- Close the connection to the Spacenav driver daemon using spnavClose on application shutdown.
Check the examples directory of this distribution for demonstrations of this approach.
Note: The X11 related Spacenav APIs have been ommitted from this module as they were provided only for backward compatibility with existing 3dxWare based software and are not needed for new applications.
Procs
-
Open a connection to the Spacenav daemon.
- result
- spnavSuccess on success
- spnavError on failure
See also spnavClose
Source -
Close a previously opened connection to the Spacenav daemon.
- result
- spnavSuccess on success
- spnavError on failure
See also spnavOpen
Source -
Retrieve the file descriptor used for communication with the daemon.
- result
- The file descriptor on success
- spnavError on error or if no connection is open
-
Set the sensitivity of the device(s).
- sens
- The sensitivity to set
- result
- spnavSuccess on success
- spnavError on failure
-
Wait for Spacenav events.
- event
- A pointer to a SpnavEvent object that will hold the event data if the call succeeded
- result
- The event type on success
- 0 if an error occured
This function blocks until an event is available. For non-blocking checks use spnavPollEvent instead.
Source -
Check for availability of Spacenav events.
- event
- A pointer to a SpnavEvent object that will hold the event data if the call succeeded
- result
- The event type on success
- SpnavEventTypes.any if no event was available
Unlike spnavWaitEvent, this function returns immediately.
Source -
Remove any pending events of the specified type.
- eventType
- The type of events to remove, or SpnavEventTypes.any to remove all events
- result
- The number of removed events