Skip to content

bhaptics/tact-cpp2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tact-CPP2 Project

A C++ library for integrating bHaptics haptic feedback devices.

Platform: Windows only (Windows 10/11)

Requirements

  • Windows 10 or Windows 11
  • Visual Studio 2019 or later
  • bHaptics Player (must be running)

Getting Started

  1. Create a workspace at the bHaptics Developer Portal.

  2. Download and install the bHaptics Player from here.

    • The player must be running for the library to work.

Project Structure

tact-cpp2/
├── lib/
│   ├── bhaptics_library.dll
│   └── bhaptics_library.lib
└── tact-cpp2/
    ├── tact-cpp2.sln
    └── tact-cpp2/
        ├── library.h          # API header
        └── main.cpp           # Usage example

Build

  1. Open tact-cpp2/tact-cpp2.sln in Visual Studio.
  2. Build the solution (F7 or Build > Build Solution).

Usage

To use this library in your project, you need the following files:

  • bhaptics_library.dll (Runtime DLL, from the lib/ directory)
  • bhaptics_library.lib (Link library, from the lib/ directory)
  • library.h (Header file located at tact-cpp2/tact-cpp2/library.h)

Example

#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.

License

See LICENSE file. Use of bHaptics SDK is subject to the bHaptics SDK agreement.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •