#include "StarScriptedAnimatorLuaBindings.hpp" #include "StarJsonExtra.hpp" #include "StarLuaGameConverters.hpp" namespace Star { LuaCallbacks LuaBindings::makeScriptedAnimatorCallbacks(NetworkedAnimator* networkedAnimator, function getParameter) { LuaCallbacks callbacks; callbacks.registerCallback("animationParameter", getParameter); callbacks.registerCallbackWithSignature, String, String>("partPoint", bind(&NetworkedAnimator::partPoint, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature, String, String>("partPoly", bind(&NetworkedAnimator::partPoly, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature("partProperty", bind(&NetworkedAnimator::partProperty, networkedAnimator, _1, _2)); callbacks.registerCallback("transformPoint", [networkedAnimator] (Vec2F point, String const& part) -> Vec2F { return networkedAnimator->partTransformation(part).transformVec2(point); }); callbacks.registerCallback("transformPoly", [networkedAnimator] (PolyF poly, String const& part) -> PolyF { poly.transform(networkedAnimator->partTransformation(part)); return poly; }); callbacks.registerCallbackWithSignature( "setLocalAnimationState", bind(&NetworkedAnimator::setLocalState, networkedAnimator, _1, _2, _3, _4)); callbacks.registerCallbackWithSignature( "animationStateProperty", bind(&NetworkedAnimator::stateProperty, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature( "animationStateNextProperty", bind(&NetworkedAnimator::stateNextProperty, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature( "animationState", bind(&NetworkedAnimator::state, networkedAnimator, _1)); callbacks.registerCallbackWithSignature( "animationStateFrame", bind(&NetworkedAnimator::stateFrame, networkedAnimator, _1)); callbacks.registerCallbackWithSignature( "animationStateFrameProgress", bind(&NetworkedAnimator::stateFrameProgress, networkedAnimator, _1)); callbacks.registerCallbackWithSignature( "animationStateTimer", bind(&NetworkedAnimator::stateTimer, networkedAnimator, _1)); callbacks.registerCallbackWithSignature( "animationStateReverse", bind(&NetworkedAnimator::stateReverse, networkedAnimator, _1)); callbacks.registerCallbackWithSignature( "hasTransformationGroup", bind(&NetworkedAnimator::hasTransformationGroup, networkedAnimator, _1)); callbacks.registerCallbackWithSignature("translateLocalTransformationGroup", bind(&NetworkedAnimator::translateLocalTransformationGroup, networkedAnimator, _1, _2)); callbacks.registerCallback("rotateLocalTransformationGroup", [networkedAnimator](String const& transformationGroup, float rotation, Maybe const& rotationCenter) { networkedAnimator->rotateLocalTransformationGroup(transformationGroup, rotation, rotationCenter.value()); }); callbacks.registerCallback("scaleLocalTransformationGroup", [networkedAnimator](LuaEngine& engine, String const& transformationGroup, LuaValue scale, Maybe const& scaleCenter) { if (auto cs = engine.luaMaybeTo(scale)) networkedAnimator->scaleLocalTransformationGroup(transformationGroup, *cs, scaleCenter.value()); else networkedAnimator->scaleLocalTransformationGroup(transformationGroup, engine.luaTo(scale), scaleCenter.value()); }); callbacks.registerCallbackWithSignature( "transformLocalTransformationGroup", bind(&NetworkedAnimator::transformLocalTransformationGroup, networkedAnimator, _1, _2, _3, _4, _5, _6, _7)); callbacks.registerCallbackWithSignature( "resetLocalTransformationGroup", bind(&NetworkedAnimator::resetLocalTransformationGroup, networkedAnimator, _1)); callbacks.registerCallbackWithSignature>( "addPartDrawables", bind(&NetworkedAnimator::addPartDrawables, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature>( "setPartDrawables", bind(&NetworkedAnimator::setPartDrawables, networkedAnimator, _1, _2)); callbacks.registerCallbackWithSignature( "applyPartTags", bind(&NetworkedAnimator::applyPartTags, networkedAnimator, _1, _2)); return callbacks; } }