-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.h
40 lines (34 loc) · 848 Bytes
/
camera.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
#ifndef CAMERA_H_
#define CAMERA_H_
#include <SFML/Window.hpp>
#include "renderable.h"
#define DEBUG 0
#define NEARCLIP 0.0001
#define FARCLIP 96.0
#define FOV 60
namespace VOX_Mob{
class Player;
}
class Camera{
private:
sf::Window *screen;
float x = 0.0f, y = 0.0f, z = 0.0f;
float rX = 0.0f, rY = 0.0f, rZ = 0.0f;
bool mouseGrabbed;
void gluPerspective(float fov, float aspectRatio, float near, float far);
VOX_Mob::Player *following;
public:
bool focused = true;
int width = 0, height = 0;
Camera(int width, int height);
void setFollowing(VOX_Mob::Player *player);
bool handleEvents();
void preRender();
void postRender();
void pre2DRender();
void windowResized(int width, int height);
void update();
sf::Vector2i getRelativeMousePosition();
~Camera();
};
#endif