diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index c57f517b7..6465cb729 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -154,7 +154,7 @@ You can use the Renderer with the following functions, all of which are in the g ### Sprite Render images on the screen. - Params : ImageParams -- Anim : SpriteAnim +- Anim : SpriteAnim
@@ -271,6 +271,8 @@ Animate Sprites easily with this helper. - SetRotation(float val) - SetOpacity(float val) - SetFade(float val) +- SetWobbleAnimAmount(float val) +- SetWobbleAnimSpeed(float val) - SetRepeatable(boolean val) - SetVelocity(Vector val) - SetScaleX(float val) diff --git a/WickedEngine/wiSpriteAnim_BindLua.cpp b/WickedEngine/wiSpriteAnim_BindLua.cpp index ef72e858a..7184cf4d2 100644 --- a/WickedEngine/wiSpriteAnim_BindLua.cpp +++ b/WickedEngine/wiSpriteAnim_BindLua.cpp @@ -9,6 +9,8 @@ namespace wi::lua lunamethod(SpriteAnim_BindLua, SetRotation), lunamethod(SpriteAnim_BindLua, SetOpacity), lunamethod(SpriteAnim_BindLua, SetFade), + lunamethod(SpriteAnim_BindLua, SetWobbleAnimAmount), + lunamethod(SpriteAnim_BindLua, SetWobbleAnimSpeed), lunamethod(SpriteAnim_BindLua, SetRepeatable), lunamethod(SpriteAnim_BindLua, SetVelocity), lunamethod(SpriteAnim_BindLua, SetScaleX), @@ -51,8 +53,6 @@ namespace wi::lua anim = wi::Sprite::Anim(); } - - int SpriteAnim_BindLua::SetRot(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -96,6 +96,32 @@ namespace wi::lua } return 0; } + int SpriteAnim_BindLua::SetWobbleAnimAmount(lua_State* L) + { + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + anim.wobbleAnim.amount = XMFLOAT2(wi::lua::SGetFloat(L, 1), wi::lua::SGetFloat(L, 1)); + } + else + { + wi::lua::SError(L, "SetWobbleAnimAmount(float val) not enough arguments!"); + } + return 0; + } + int SpriteAnim_BindLua::SetWobbleAnimSpeed(lua_State* L) + { + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + anim.wobbleAnim.speed = wi::lua::SGetFloat(L, 1); + } + else + { + wi::lua::SError(L, "SetWobbleAnimSpeed(float val) not enough arguments!"); + } + return 0; + } int SpriteAnim_BindLua::SetRepeatable(lua_State* L) { int argc = wi::lua::SGetArgCount(L); diff --git a/WickedEngine/wiSpriteAnim_BindLua.h b/WickedEngine/wiSpriteAnim_BindLua.h index 896858f18..a9860af0b 100644 --- a/WickedEngine/wiSpriteAnim_BindLua.h +++ b/WickedEngine/wiSpriteAnim_BindLua.h @@ -22,6 +22,8 @@ namespace wi::lua int SetRotation(lua_State* L); int SetOpacity(lua_State* L); int SetFade(lua_State* L); + int SetWobbleAnimAmount(lua_State* L); + int SetWobbleAnimSpeed(lua_State* L); int SetRepeatable(lua_State* L); int SetVelocity(lua_State* L); int SetScaleX(lua_State* L);