-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewport.h
39 lines (33 loc) · 954 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 "drawable.h"
#include "gamedata.h"
class Viewport {
public:
static Viewport& getInstance();
~Viewport() { /* std::cout << "Blocking the view ..." << std::endl; */ }
void draw() const;
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; }
int getViewHeight() const { return viewHeight; }
int getViewWidth() const { return viewWidth; }
void setObjectToTrack(const Drawable *obj);
const Drawable* getObjectToTrack() const { return objectToTrack; }
private:
Gamedata* const gdata;
Vector2f position;
unsigned viewWidth;
unsigned viewHeight;
unsigned worldWidth;
unsigned worldHeight;
Uint16 objWidth;
Uint16 objHeight;
const Drawable *objectToTrack;
Viewport();
Viewport(const Viewport&);
Viewport& operator=(const Viewport&);
};
#endif