rive-app / rive-cpp-legacy

C++ runtime for Rive
MIT License
287 stars 43 forks source link

ArtboardInstance its own type? #248

Closed mikerreed closed 2 years ago

mikerreed commented 2 years ago

Thought -- will our API be clearer if we make ArtboardInstance its own type?

For now, there is no separate impl -- though that could change (as we wish).

The real change (pending) would be to change the recent API around passing an "artboard instance" to statemachine and animation instances -- and rather than asserting that the artboard is an instance, we change those signature to be an instance.

    LinearAnimationInstance(const LinearAnimation*, Artboard* instance);

becomes

    LinearAnimationInstance(const LinearAnimation*, ArtboardInstance* instance);
luigi-rosso commented 2 years ago

I've been thinking about this one too as we reviewed the whole "isInstance field". Seems like just a bad pattern. Separating concerns and complexity (also for code editing) in this way seems really desirable.