-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.h
More file actions
55 lines (46 loc) · 1.22 KB
/
Camera.h
File metadata and controls
55 lines (46 loc) · 1.22 KB
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
#ifndef HOMEWORK_CAMERA_H
#define HOMEWORK_CAMERA_H
#include "Input.h"
/**
* @file Camera.h
* @brief Structures and information related to the camera system
* @version 0.1
* @date 2019-11-05
*
* @copyright Copyright (c) 2019
*
*/
#include "Graphics.h"
/**
* @brief Stores camera data
*
*/
typedef struct Camera {
Point position; /**< Position */
float zoom; /**< Zoom amount (0 - 1) */
} Camera;
/**
* @brief Zooms in camera to the zoom position
*
* @param camera The camera struct to zoom with
* @param zoomLevels Relatively how much to zoom
* @param zoomPos Position to zoom in to
*/
void camera_zoom(Camera *camera, float zoomLevels, Point zoomPos);
/**
* @brief Moves camera taking the zoom into account
*
* @param camera The camera struct to move with
* @param movement Amount to move
*/
void camera_move(Camera *camera, Vec movement);
/**
* @brief Get screen position relative to the world
*
* @param camera The camera struct to do the calculations with
* @param p The point to transform
* @return Point The resulting point in world space
*/
Point camera_screen_to_view(Camera *camera, Point p);
void camera_update(Camera *camera, Input *input, SDL_Renderer *renderer);
#endif //HOMEWORK_CAMERA_H