sokol icon indicating copy to clipboard operation
sokol copied to clipboard

spine runtime version

Open scemino opened this issue 2 years ago • 2 comments

Is it possible to configure "something" to specify which spine runtime version we want to use ? Let's say I need to read a spine skeleton made with spine v3.8.99, it it possible to configure sokol in order to read this skeleton ?

If it's not possible, can I fork the project, use the "correct" spine-c runtime and I suppose I need to change sokol_spine.h, right?

NB: Thanks for your projects, it's really awesome.

scemino avatar Dec 22 '22 12:12 scemino

sokol_spine.h is written against the Spine 4.1 runtime. You could try to drop in an older spine-c version and see if it works, but if this is not API compatible with 4.1, then sokol_spine.h would need to be changed (if the changes are not too big, we could we could add a configuration define to sokol_spine.h, e.g. SOKOL_SPINE_USE_RUNTIME_V3 vs SOKOL_SPINE_USE_RUNTIME_V4 and put the V3 vs V4 differences into ifdefs.

floooh avatar Dec 22 '22 13:12 floooh

It was expected, the version is not compatible BUT the changes are minor, I made some modifications like this one:

#ifdef SOKOL_SPINE_USE_RUNTIME_V4
        if (desc->override.premul_alpha_enabled) {
            // NOTE: -1 is spine-c convention for 'true'
            page->pma = -1;
        }
        else if (desc->override.premul_alpha_disabled) {
            page->pma = 0;
        }
#endif

and it seems to work as you can see here: https://youtu.be/6KM86QiiNL4

If you're interested I can try to make a PR, I just don't know how to configure SOKOL_SPINE_USE_RUNTIME_V3 or SOKOL_SPINE_USE_RUNTIME_V4.

scemino avatar Dec 22 '22 18:12 scemino