C API function callbacks into C++ member function code

前端 未结 5 2035
旧巷少年郎
旧巷少年郎 2020-12-10 14:37

So, I\'m using the FMOD api and it really is a C api.

Not that that\'s bad or anything. Its just it doesn\'t interface well with C++ code.

For example, usin

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 14:49

    I guess it supposed to work like this:
    You can assign some user data to channel by calling FMOD_Channel_SetUserData. This user data should be a pointer to your C++ object that handles events. Then you should write C-style callback that extracts that object by calling FMOD_Channel_GetUserData and then calls your C++ instance method on that object.

提交回复
热议问题