Add Animation2D Lua binding.

This commit is contained in:
aster2013 2014-02-28 13:52:06 +08:00
parent a6f18c41ea
commit f9ad7c439f
3 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,23 @@
$#include "AnimatedSprite2D.h"
enum CycleMode
{
CM_LOOP = 0,
CM_CLAMP,
CM_PINGPONG,
};
class AnimatedSprite2D : public StaticSprite2D
{
void SetSpeed(float speed);
void SetCycleMode(CycleMode cycleMode);
void SetAnimation(Animation2D* animation, float startTime = 0.0f);
float GetSpeed() const;
CycleMode GetCycleMode() const;
Animation2D* GetAnimation() const;
tolua_property__get_set float speed;
tolua_property__get_set CycleMode cycleMode;
tolua_property__get_set Animation2D* animation;
};

View File

@ -0,0 +1,16 @@
$#include "Animation2D.h"
struct KeyFrame2D
{
};
class Animation2D : public Resource
{
float GetTotalTime() const;
unsigned GetNumKeyFrames() const;
const KeyFrame2D* GetKeyFrameByTime(float time) const;
const KeyFrame2D* GetKeyFrameByIndex(unsigned index) const;
tolua_readonly tolua_property__get_set float totalTime;
tolua_readonly tolua_property__get_set unsigned numKeyFrames;
};

View File

@ -1,9 +1,11 @@
$pfile "Urho2D/Drawable2D.pkg"
$pfile "Urho2D/ParticleModel2D.pkg"
$pfile "Urho2D/ParticleEmitter2D.pkg"
$pfile "Urho2D/Sprite2D.pkg"
$pfile "Urho2D/SpriteSheet2D.pkg"
$pfile "Urho2D/StaticSprite2D.pkg"
$pfile "Urho2D/Animation2D.pkg"
$pfile "Urho2D/AnimatedSprite2D.pkg"
$pfile "Urho2D/ParticleModel2D.pkg"
$pfile "Urho2D/ParticleEmitter2D.pkg"
$using namespace Urho3D;
$#pragma warning(disable:4800)