A C++ library for integrating bHaptics haptic feedback devices.
Platform: Windows only (Windows 10/11)
- Windows 10 or Windows 11
- Visual Studio 2019 or later
- bHaptics Player (must be running)
-
Create a workspace at the bHaptics Developer Portal.
- For documentation, refer to the bHaptics Documentation Portal.
-
Download and install the bHaptics Player from here.
- The player must be running for the library to work.
tact-cpp2/
├── lib/
│ ├── bhaptics_library.dll
│ └── bhaptics_library.lib
└── tact-cpp2/
├── tact-cpp2.sln
└── tact-cpp2/
├── library.h # API header
└── main.cpp # Usage example
- Open
tact-cpp2/tact-cpp2.slnin Visual Studio. - Build the solution (F7 or Build > Build Solution).
To use this library in your project, you need the following files:
bhaptics_library.dll(Runtime DLL, from thelib/directory)bhaptics_library.lib(Link library, from thelib/directory)library.h(Header file located attact-cpp2/tact-cpp2/library.h)
#include "library.h"
int main() {
// TODO: Replace these placeholder values with your own from the bHaptics Developer Portal.
const char* sdkKey = "YOUR_SDK_KEY_HERE"; // Obtain from your workspace at https://developer.bhaptics.com
const char* appId = "YOUR_APP_ID_HERE"; // App ID from the same workspace
const char* mappingJson = "{}"; // JSON string with your haptic mappings
// Initialize connection
bool connected = registryAndInit(sdkKey, appId, mappingJson);
if (!connected) {
return -1;
}
// Play haptic event
// "eventName" must match the name of an event defined in your bHaptics Developer Portal workspace (or in your mapping JSON).
int requestId = play("eventName");
// Check if playing
bool playing = isPlayingByRequestId(requestId);
// Stop event
stop(requestId);
// Close connection
wsClose();
return 0;
}For more detailed usage, refer to tact-cpp2/tact-cpp2/main.cpp.
See LICENSE file. Use of bHaptics SDK is subject to the bHaptics SDK agreement.