-/*
- * SimpleAnimation.cpp
- *
- * Created on: Sep 5, 2012
- * Author: holy
- */
-
#include "SimpleAnimation.h"
#include "../loader/Interpreter.h"
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);
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));
new (data) SimpleAnimation;
}
+void SimpleAnimation::Initialize(void *data) {
+ new (data) SimpleAnimation(loader::noinit);
+}
+
}