-
Notifications
You must be signed in to change notification settings - Fork 0
/
multisprite.h
54 lines (40 loc) · 1.12 KB
/
multisprite.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef MULTISPRITE__H
#define MULTISPRITE__H
#include <string>
#include <vector>
#include <cmath>
#include "drawable.h"
class MultiSprite : public Drawable {
public:
MultiSprite(const std::string&);
MultiSprite(const std::string& name, int worldWidth);
//MultiSprite(const std::string&, int yMinLocRange, int yMaxLocRange);
MultiSprite(const MultiSprite&);
~MultiSprite();
virtual void draw() const;
virtual void update(Uint32 ticks);
virtual const Image* getImage() const {
return images[currentFrame];
}
int getScaledWidth() const {
return getScale()*images[currentFrame]->getWidth();
}
int getScaledHeight() const {
return getScale()*images[currentFrame]->getHeight();
}
virtual const SDL_Surface* getSurface() const {
return images[currentFrame]->getSurface();
}
//virtual void explode();
protected:
std::vector<Image *> images;
unsigned currentFrame;
unsigned numberOfFrames;
unsigned frameInterval;
float timeSinceLastFrame;
int worldWidth;
int worldHeight;
void advanceFrame(Uint32 ticks);
MultiSprite& operator=(const MultiSprite&);
};
#endif