-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscaledSprite.h
43 lines (34 loc) · 1.04 KB
/
scaledSprite.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
#ifndef SCALEDSPRITE__H
#define SCALEDSPRITE__H
#include <string>
#include <iostream>
#include "drawable.h"
class ScaledSprite : public Drawable {
public:
ScaledSprite(const std::string&, SDL_Surface*);
ScaledSprite(const ScaledSprite& s);
~ScaledSprite();
ScaledSprite& operator=(const ScaledSprite&);
bool operator<(const ScaledSprite& rhs) const {
return scale < rhs.scale;
}
virtual const Frame* getFrame() const { return frame; }
virtual void draw() const;
virtual void update(Uint32 ticks);
unsigned getPixel(Uint32, Uint32) const;
float getScale() const { return scale; }
void setVelocityFirst() { Vector2f a(1,1); setVelocity( a * getScale() * 0.01*20500); }
void setVelocitySecond() { Vector2f a(1,1); setVelocity( a * getScale() * 0.01*30000); }
Vector2f getCenter() const {
return Vector2f( X()+frame->getWidth()/2, Y()+frame->getHeight()/2 );
}
private:
double scale;
SDL_Surface* scaledSurface;
const Frame * frame;
int frameWidth;
int frameHeight;
int worldWidth;
int worldHeight;
};
#endif