Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixes and improvements to work with C++ code #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nextgeniuspro
Copy link

Hi @gyrovorbis, initially I wanted to add only one fix related atomic_bool variable declaration that generates compilation error when you compiles library under C++. However, I found it's kind of uncomfortable to use with necessity to use setup_func in start function. So, here are several fixes I made for this wonderful lib

  • Fixed compilation error for atomic_bool under C++
  • Removed setup_func from vmu_profiler_start function and instead I return pointer to vmu_profiler_t in this function
  • I added user_data to vmu_profiler_measurement so that you can get pointer to needed object inside of get_measure_callbacxk
  • I also removed fps_frame and fps_frames[] variables from vmu_profiler_t and code that used them in vmu_profiler_update, since I think this should be made on client side

My changes brake backward compatibility but I believe it's not a big deal. Here is an example how I use this new format in my code

```
vmu_profiler *profiler = vmu_profiler_start(&vmu_config);
if (profiler) {
    auto fps_callback = +[](vmu_profiler_measurement_t *m) {
        Engine* engine = static_cast<Engine*>(m->user_data);
        if (!engine) {
            return;
        }

        m->fstorage = engine->GetRenderContext()->GetFPS();
    };

    vmu_profiler_add_measure(profiler, init_measurement(" FPS", use_float, fps_callback, this));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant