X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgraphics%2FComplexAnimation.cpp;h=95f58692ed67bae11a7cb2187e332c8336b18a57;hb=5f9a1893c0db8f53889a390e4c4b95d57abd4384;hp=b3784dd667c0017ac1d2339e18d63795836930f0;hpb=1907ca03c5e865c4d398170042aa384c67ffff29;p=l2e.git diff --git a/src/graphics/ComplexAnimation.cpp b/src/graphics/ComplexAnimation.cpp index b3784dd..95f5869 100644 --- a/src/graphics/ComplexAnimation.cpp +++ b/src/graphics/ComplexAnimation.cpp @@ -1,21 +1,49 @@ -/* - * ComplexAnimation.cpp - * - * Created on: Sep 5, 2012 - * Author: holy - */ - #include "ComplexAnimation.h" #include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" +using math::Vector; using loader::FieldDescription; using loader::Interpreter; using loader::TypeDescription; namespace graphics { +ComplexAnimation::ComplexAnimation() +: frames(0) +, numFrames(0) { + +} + +ComplexAnimation::ComplexAnimation( + const Sprite *sprite, + int frameTime, + bool repeat) +: Animation(sprite, frameTime, repeat) +, frames(0) +, numFrames(0) { + +} + + +int ComplexAnimation::NumFrames() const { + return numFrames; +} + +int ComplexAnimation::Col(int frame) const { + return frames[frame].col; +} + +int ComplexAnimation::Row(int frame) const { + return frames[frame].row; +} + +Vector ComplexAnimation::Offset(int frame) const { + return frames[frame].disposition; +} + + void ComplexAnimation::CreateTypeDescription() { ComplexAnimation ca; Animation *a(&ca); @@ -27,7 +55,7 @@ void ComplexAnimation::CreateTypeDescription() { td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&ca)); Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca)); - td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), FrameProp::TYPE_ID).SetReferenced().SetAggregate().SetDescription("a variable number of frames")); + td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), FrameProp::TYPE_ID).SetAggregate().SetDescription("a variable number of frames")); FrameProp fp;