void TW_CALL UiPropertyGrid::GetCallbackPropertyString( void* value, void* clientData ) { std::string *destPtr = static_cast<std::string *>(value); SceneManager::Property* property ( reinterpret_cast<SceneManager::Property*>(clientData) ); property->GetValue( *(std::string*)value ); TwCopyStdStringToLibrary(*destPtr, *(std::string*)value); // Get: copy the value of s to AntTweakBar }
// Callback function called by AntTweakBar to get the "EditTitle" std::string variable void TW_CALL GetBarTitleCB(void *value, void *clientData) { std::string *destStringPtr = (std::string *)(value); int barIndex = *(int *)(&clientData); // clientData stores the bar index std::string title = g_BarTitles[barIndex]; // Do not assign destStringPtr directly (see TwCopyStdStringToLibrary doc for explanation): // Use TwCopyStdStringToLibrary to copy the bar title string to AntTweakBar TwCopyStdStringToLibrary(*destStringPtr, title); }
void TW_CALL GetMyStdStringCB(void *value, void * /*clientData*/) { // Get: copy the value of s to AntTweakBar std::string *destPtr = static_cast<std::string *>(value); TwCopyStdStringToLibrary(*destPtr, g_leapListener.gestureName); // the use of TwCopyStdStringToLibrary is required here }