-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.cpp
More file actions
48 lines (37 loc) · 898 Bytes
/
camera.cpp
File metadata and controls
48 lines (37 loc) · 898 Bytes
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: camera.cpp
* Author: ross
*
* Created on 02 January 2019, 23:39
*/
#include "camera.h"
#include "globals.h"
Camera::Camera()
{
}
Camera::Camera(float worldOriginX, float worldOriginY)
{
//this->_worldPosX = worldOriginX;
//this->_worldPosY = worldOriginY;
}
Camera::~Camera()
{
}
void Camera::updateWorldPos(float playerPosX, float playerPosY)
{
this->_cameraX = (playerPosX + (player_constants::PLAYER_SIZE_X/2))-(globals::SCREEN_WIDTH/2);
this->_cameraY = (playerPosY + (player_constants::PLAYER_SIZE_Y/2))-(globals::SCREEN_HEIGHT/2);
}
float Camera::getCameraX()
{
return this->_cameraX;
}
float Camera::getCameraY()
{
return this->_cameraY;
}