I'm coming from Javascript like language where I can make functions like this.
function tween(obj, tweenParams, time, tweenOptions);
This is used like:
tween(mySprite, {x: 10, y: 10}, 1, {startDelay: 1, loops: 5});
If it's not clear, this lerps mySprite's x and y property to 10 over the course of 1 second, looping 5 times with a 1 second delay. tweenParams can contain any values that the obj might have, and tweenOptions is a fixed struct.
I want to know how terse this can reasonable be in C++, struct and array initializes don't seem flexible enough to express this. My best guess involves calling multiple tween functions one property at a time, something like.
TweenOptions opts = {};
opts.startDelay = 1;
opts.loops = 5;
tween(&mySprite.x, 10, 1, opts);
tween(&mySprite.y, 10, 1, opts);
I don't know much about C++ advanced features, maybe operator overloading or custom initializes could help me here?
EDIT: To be clear, I don't expect it to exactly match the Javascript example, I just want to know how terse this can reasonably be.