-
Notifications
You must be signed in to change notification settings - Fork 0
/
twowaysprite.h
37 lines (31 loc) · 896 Bytes
/
twowaysprite.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef TWOWAYSPRITE__H
#define TWOWAYSPRITE__H
#include <string>
#include <vector>
#include "drawable.h"
class TwoWaySprite : public Drawable {
public:
TwoWaySprite(const std::string&);
TwoWaySprite(const TwoWaySprite&);
virtual ~TwoWaySprite() { }
virtual void draw() const;
virtual void update(Uint32 ticks);
virtual const Frame* getFrame() const {
return frames[currentFrame];
}
virtual void handleKeyStroke(const Uint8 *) {}
virtual unsigned getCurrentFrame() const { return currentFrame;}
virtual void setCurrentFrame(unsigned frameNumber) { currentFrame = frameNumber; }
protected:
const std::vector<Frame *> frames;
int worldWidth;
int worldHeight;
unsigned currentFrame;
unsigned numberOfFrames;
unsigned frameInterval;
float timeSinceLastFrame;
int frameWidth;
int frameHeight;
virtual void advanceFrame(Uint32 ticks);
};
#endif