Platformer
Platformer
CameraComponent.hpp
1 #ifndef CAMERA_COMPONENT_HPP
2 #define CAMERA_COMPONENT_HPP
3 
4 #include <SDL2/SDL.h>
5 
6 #include "Component.hpp"
7 
9 class CameraComponent : public Component {
10  public:
13 
16  SDL_Rect renderView);
17 
20  SDL_Rect renderView,
22  SDL_Rect renderArea);
23 
24  void Update() override;
25 
27  void Translate(SDL_Rect& dest);
28 
30  void SetActive();
31 
33  void SetCaptureArea(SDL_Rect r);
34 
35  private:
37  SDL_Rect renderView;
39  SDL_Rect renderArea;
40 };
41 
42 #endif
void Update() override
Updates this component.
Definition: CameraComponent.cpp:18
SDL_Rect renderArea
The render area for this camera.
Definition: CameraComponent.hpp:39
void Translate(SDL_Rect &dest)
Translates the given SDL_Rect based on this camera.
Definition: CameraComponent.cpp:20
void SetActive()
Set this camera as the active camera.
Definition: CameraComponent.cpp:32
CameraComponent()
Constructs a new CameraComponent that renders the whole screen.
Definition: CameraComponent.cpp:6
Class representing a component of a GameObject.
Definition: Component.hpp:12
A class representing a camera within our game.
Definition: CameraComponent.hpp:9
void SetCaptureArea(SDL_Rect r)
Sets the area viewed by the camera to the given rect.
Definition: CameraComponent.cpp:37
SDL_Rect renderView
The area of the game world to capture.
Definition: CameraComponent.hpp:37