-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprite.h
36 lines (29 loc) · 864 Bytes
/
sprite.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
#ifndef SPRITE__H
#define SPRITE__H
#include <string>
#include "drawable.h"
class Sprite : public Drawable {
public:
Sprite(const std::string&);
Sprite(const std::string&, const Vector2f& pos, const Vector2f& vel,
const Image*);
Sprite(const Sprite&);
virtual ~Sprite() { }
Sprite& operator=(const Sprite&);
virtual void draw() const;
virtual void update(Uint32 ticks);
virtual const Image* getImage() const { return image; }
virtual const SDL_Surface* getSurface() const {
return image->getSurface();
}
int getScaledWidth() const { return getScale()*image->getWidth(); }
int getScaledHeight() const { return getScale()*image->getHeight(); }
private:
const Image * image;
protected:
int worldWidth;
int worldHeight;
int getDistance(const Sprite*) const;
Vector2f makeVelocity(int, int) const;
};
#endif