The TanvasTouch Engine C API manages haptic resources, which are used by the TanvasTouch Engine to direct the TanvasTouch Controller and touchscreen to render haptic textures. The TanvasTouch hardware renders textures by modulating friction under the operator's fingers.
All C API functions return a status code; status codes are documented in tanvastouch_errors.h. Most C API functions have one or more out-parameters that return resource IDs or attributes.
To use the C API, first open a context:
if (rc) { ... }
) is not correct.With this context, you can create haptic resources. Each process has its own collection of haptic resources; these cannot be shared across processes.
Finally, close the context when it's no longer needed:
The coordinate system for haptic resources is provided by the window system. Details for supported systems are given below. The Engine works in either logical or physical pixels depending on what is most convenient for mapping touch inputs to positions on the virtual desktop.
It is recommended that applications interacting with the Engine also use Per-Monitor V2 or Per-Monitor DPI awareness modes. For more information, see the MSDN article "High DPI Desktop Application Development on Windows": https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows
API calls that set or fetch properties of haptic resources typically return the following values:
Most of the API calls that write data to out-parameters will write data if and only if the return value of the call is TANVASTOUCH_OK. On failure, the original contents of the pointed-to storage will not be modified.
Destructor functions do not clear application-side copies of resource IDs. It is safe to keep these IDs around, but any modifications or queries done with those IDs will return TANVASTOUCH_ERROR_RESOURCE_UNKNOWN.