-
Notifications
You must be signed in to change notification settings - Fork 5
/
Camera.h
55 lines (38 loc) · 1.23 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "SMWTimer.h"
class Player;
class Level;
class Camera
{
public:
Camera(int width, int height, Level* levelPtr);
virtual ~Camera();
Camera(const Camera&) = delete;
Camera& operator=(const Camera&) = delete;
DOUBLE2 GetOffset(Level* levelPtr, double deltaTime);
void CalculateViewMatrix(Level* levelPtr, double deltaTime);
MATRIX3X2 GetViewMatrix();
void Reset();
void DEBUGPaint();
private:
double CalculateXOffset(Level* levelPtr, double deltaTime);
double CalculateYOffset(Level* levelPtr, double deltaTime);
void Clamp(DOUBLE2& posRef, Level* levelPtr);
// How far from the edge the player is from the edge of the screen normally
static const int DISTANCE_FROM_EDGE;
// How far the player can walk backwards before triggering a camera transition
static const int HORIZONTAL_CUSHION_SIZE;
static const int TOP_BOUNDARY;
static const int TOP_BOUNDARY_LOW;
static const int BOTTOM_BOUNDARY;
static const int FRAMES_OF_TRANSITION;
static const int DEFAULT_Y_OFFSET;
const int WIDTH, HEIGHT;
DOUBLE2 m_PrevOffset;
int m_OffsetDirection;
SMWTimer m_TransitionTimer;
// Stores the distance between the player and the camera
double m_XOffset;
double m_YTarget;
MATRIX3X2 m_MatTranslation;
};