X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FSimpleAnimation.cpp;h=75a327bd786c30a3809953cf39e37da8d0fe3906;hb=5cca794c5b6549b7750c88b5c2217d659fa963dd;hp=baed3419188b2f393e0e27ade3d3b56f7e38f0f3;hpb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;p=l2e.git diff --git a/src/graphics/SimpleAnimation.cpp b/src/graphics/SimpleAnimation.cpp index baed341..75a327b 100644 --- a/src/graphics/SimpleAnimation.cpp +++ b/src/graphics/SimpleAnimation.cpp @@ -9,6 +9,46 @@ using loader::TypeDescription; namespace graphics { +SimpleAnimation::SimpleAnimation() +: numFrames(0) +, col(0) +, row(0) { + +} + +SimpleAnimation::SimpleAnimation( + const Sprite *sprite, + int frameTime, + int numFrames, + int col, + int row, + bool repeat) +: Animation(sprite, frameTime, repeat) +, numFrames(numFrames) +, col(col) +, row(row) { + +} + +SimpleAnimation::SimpleAnimation(loader::noinit_t n) +: Animation(n) { + +} + + +int SimpleAnimation::NumFrames() const { + return numFrames; +} + +int SimpleAnimation::Col(int frame) const { + return col; +} + +int SimpleAnimation::Row(int frame) const { + return row + frame; +} + + void SimpleAnimation::CreateTypeDescription() { SimpleAnimation sa; Animation *a(&sa); @@ -16,6 +56,7 @@ void SimpleAnimation::CreateTypeDescription() { TypeDescription &td(TypeDescription::Create(TYPE_ID, "SimpleAnimation")); td.SetDescription("An animation that uses a fixed column and increasing row of a sprite based on the frame number."); td.SetConstructor(&Construct); + td.SetInitializer(&Initialize); td.SetSize(sizeof(SimpleAnimation)); td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&sa)); @@ -29,4 +70,8 @@ void SimpleAnimation::Construct(void *data) { new (data) SimpleAnimation; } +void SimpleAnimation::Initialize(void *data) { + new (data) SimpleAnimation(loader::noinit); +} + }