ES-DE/src/components/AnimationComponent.h

40 lines
837 B
C
Raw Normal View History

2013-06-02 15:08:32 +00:00
#ifndef _ANIMATIONCOMPONENT_H_
#define _ANIMATIONCOMPONENT_H_
2012-10-17 17:15:58 +00:00
2013-06-02 15:08:32 +00:00
#include "../GuiComponent.h"
2013-04-08 16:52:40 +00:00
#include <vector>
2012-10-17 17:15:58 +00:00
#define ANIMATION_TICK_SPEED 16
//just fyi, this is easily the worst animation system i've ever written.
//it was mostly written during a single lecture and it really shows in how un-thought-out it is
//it also hasn't been converted to use floats or vectors yet
2013-06-02 15:08:32 +00:00
class AnimationComponent
2012-10-17 17:15:58 +00:00
{
public:
2013-06-02 15:08:32 +00:00
AnimationComponent();
2012-10-17 17:15:58 +00:00
void move(int x, int y, int speed);
void fadeIn(int time);
void fadeOut(int time);
2013-04-08 16:52:40 +00:00
void update(int deltaTime);
void addChild(GuiComponent* gui);
2013-04-08 16:52:40 +00:00
2012-10-17 17:15:58 +00:00
private:
2013-04-08 16:52:40 +00:00
unsigned char mOpacity;
std::vector<GuiComponent*> mChildren;
2013-04-08 16:52:40 +00:00
2012-10-17 17:15:58 +00:00
void moveChildren(int offsetx, int offsety);
void setChildrenOpacity(unsigned char opacity);
int mFadeRate;
int mMoveX, mMoveY, mMoveSpeed;
int mAccumulator;
2012-10-17 17:15:58 +00:00
};
#endif