-
Notifications
You must be signed in to change notification settings - Fork 1
/
multisprite.h
37 lines (31 loc) · 893 Bytes
/
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
#ifndef MULTISPRITE__H
#define MULTISPRITE__H
#include <string>
#include <iostream>
#include <vector>
#include "drawable.h"
class MultiframeSprite : public Drawable {
public:
MultiframeSprite(const std::string& n, const std::vector<Frame*>& fms, const float sc);
MultiframeSprite(const MultiframeSprite& s);
virtual ~MultiframeSprite() { }
virtual const Frame* getFrame() const { return frames[currentFrame]; }
virtual void draw() const;
virtual void update(Uint32 ticks);
unsigned getPixel(Uint32, Uint32) const;
int getFrameHeight() { return frameHeight;}
int getWorldHeight() { return worldHeight;}
protected:
unsigned currentFrame;
unsigned numberOfFrames;
int frameHeight;
int frameWidth;
int worldWidth;
int worldHeight;
private:
const std::vector<Frame *> frames;
float dt;
unsigned frameInterval;
void advanceFrame(Uint32 ticks);
};
#endif