Not sure if all this is needed
This commit is contained in:
parent
619916b025
commit
454c5f7db7
|
@ -107,12 +107,12 @@ public:
|
||||||
GBAVector getPosAsVector() { return GBAVector(getPos()); }
|
GBAVector getPosAsVector() { return GBAVector(getPos()); }
|
||||||
VECTOR getCenter() { return { x + w / 2, y + h / 2 }; }
|
VECTOR getCenter() { return { x + w / 2, y + h / 2 }; }
|
||||||
VECTOR getVelocity() { return { dx, dy}; }
|
VECTOR getVelocity() { return { dx, dy}; }
|
||||||
|
u32 getX() { return x; }
|
||||||
|
u32 getY() { return y; }
|
||||||
u32 getDx() { return dx; }
|
u32 getDx() { return dx; }
|
||||||
u32 getDy() { return dy; }
|
u32 getDy() { return dy; }
|
||||||
u32 getX() { return x; }
|
|
||||||
u32 getHeight() { return h; }
|
|
||||||
u32 getWidth() { return w; }
|
u32 getWidth() { return w; }
|
||||||
u32 getY() { return y; }
|
u32 getHeight() { return h; }
|
||||||
u32 getCurrentFrame() { return currentFrame; }
|
u32 getCurrentFrame() { return currentFrame; }
|
||||||
bool isAnimating() { return animating; };
|
bool isAnimating() { return animating; };
|
||||||
bool isOffScreen();
|
bool isOffScreen();
|
||||||
|
|
|
@ -13,12 +13,12 @@ private:
|
||||||
bool stayWithinBounds = false;
|
bool stayWithinBounds = false;
|
||||||
const void *imageData;
|
const void *imageData;
|
||||||
u32 x, y, dx, dy;
|
u32 x, y, dx, dy;
|
||||||
u32 numberOfFrames, animationDelay;
|
u32 beginFrame, numberOfFrames, animationDelay;
|
||||||
SpriteSize size;
|
SpriteSize size;
|
||||||
|
|
||||||
void setProperties(T* sprite);
|
void setProperties(T* sprite);
|
||||||
void reset() {
|
void reset() {
|
||||||
imageSize = x = y = dx = dy = numberOfFrames = animationDelay = 0;
|
imageSize = x = y = dx = dy = beginFrame = numberOfFrames = animationDelay = 0;
|
||||||
imageData = nullptr;
|
imageData = nullptr;
|
||||||
stayWithinBounds = false;
|
stayWithinBounds = false;
|
||||||
size = SIZE_16_16;
|
size = SIZE_16_16;
|
||||||
|
@ -51,9 +51,16 @@ public:
|
||||||
this->size = size;
|
this->size = size;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
SpriteBuilder& withAnimated(int numberOfFrames, int delay) {
|
SpriteBuilder& withAnimated(int numberOfFrames, int animationDelay) {
|
||||||
|
this->beginFrame = 0;
|
||||||
this->numberOfFrames = numberOfFrames;
|
this->numberOfFrames = numberOfFrames;
|
||||||
this->animationDelay = delay;
|
this->animationDelay = animationDelay;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
SpriteBuilder& withAnimated(int beginFrame, int numberOfFrames, int animationDelay) {
|
||||||
|
this->beginFrame = beginFrame;
|
||||||
|
this->numberOfFrames = numberOfFrames;
|
||||||
|
this->animationDelay = animationDelay;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
T build();
|
T build();
|
||||||
|
@ -73,7 +80,11 @@ template<typename T> std::unique_ptr<T> SpriteBuilder<T>::buildWithDataOf(const
|
||||||
template<typename T> void SpriteBuilder<T>::setProperties(T* s) {
|
template<typename T> void SpriteBuilder<T>::setProperties(T* s) {
|
||||||
s->setVelocity(this->dx, this->dy);
|
s->setVelocity(this->dx, this->dy);
|
||||||
if(this->numberOfFrames > 0) {
|
if(this->numberOfFrames > 0) {
|
||||||
s->makeAnimated(this->numberOfFrames, this->animationDelay);
|
if(this->beginFrame > 0) {
|
||||||
|
s->makeAnimated(this->beginFrame, this->numberOfFrames, this->animationDelay);
|
||||||
|
} else {
|
||||||
|
s->makeAnimated(this->numberOfFrames, this->animationDelay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s->setStayWithinBounds(stayWithinBounds);
|
s->setStayWithinBounds(stayWithinBounds);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue