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
|
|
|
|
2013-06-14 15:48:13 +00:00
|
|
|
#define ANIMATION_TICK_SPEED 16
|
|
|
|
|
2013-07-10 11:29:43 +00:00
|
|
|
//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);
|
|
|
|
|
2013-07-02 23:13:55 +00:00
|
|
|
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;
|
|
|
|
|
2013-07-02 23:13:55 +00:00
|
|
|
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;
|
2013-06-14 15:48:13 +00:00
|
|
|
|
|
|
|
int mAccumulator;
|
2012-10-17 17:15:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|