-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewport.h
39 lines (33 loc) · 851 Bytes
/
viewport.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
#ifndef VIEWPORT__H
#define VIEWPORT__H
#include "sprite.h"
#include "gamedata.h"
class Viewport {
public:
static Viewport* getInstance();
void update();
float X() const { return position[0]; }
void X(float x) { position[0] = x; }
float Y() const { return position[1]; }
void Y(float y) { position[1] = y; }
void setObjectToTrack(const Sprite *obj);
const Sprite* getObjectToTrack() const { return objectToTrack; }
void freeze() { frozen = true; }
void draw() const;
private:
static Viewport *instance;
bool frozen;
const Gamedata* gdata;
Vector2f position;
unsigned viewWidth;
unsigned viewHeight;
unsigned worldWidth;
unsigned worldHeight;
Uint16 objWidth;
Uint16 objHeight;
const Sprite *objectToTrack;
Viewport();
Viewport(const Viewport&);
Viewport& operator=(const Viewport&);
};
#endif