Platformer
Platformer
RenderComponent.hpp
1 #ifndef RENDER_COMPONENT_HPP
2 #define RENDER_COMPONENT_HPP
3 
4 #include "CameraComponent.hpp"
5 #include "SDLTextureWrapper.hpp"
6 
7 #include <memory>
8 
13 class RenderComponent : public Component {
14  public:
17 
18  virtual void Update() override;
19 
21  virtual void Render();
22 
24  SDL_RendererFlip renderFlip = SDL_FLIP_NONE;
25 
26  protected:
28  std::shared_ptr<SDLTextureWrapper> texture;
29 
31  std::shared_ptr<SDL_Rect> renderSrc;
32 };
33 
34 #endif
RenderComponent()
Constructs a new RenderComponent.
Definition: RenderComponent.cpp:6
A RenderComponent class.
Definition: RenderComponent.hpp:13
virtual void Update() override
Updates this component.
Definition: RenderComponent.cpp:8
SDL_RendererFlip renderFlip
Whether the renderer should be flipped.
Definition: RenderComponent.hpp:24
virtual void Render()
Renders this component based on the given camera.
Definition: RenderComponent.cpp:10
std::shared_ptr< SDL_Rect > renderSrc
The source rect to be used, null if the whole texture is used.
Definition: RenderComponent.hpp:31
Class representing a component of a GameObject.
Definition: Component.hpp:12
std::shared_ptr< SDLTextureWrapper > texture
The texture for this RenderComponent.
Definition: RenderComponent.hpp:28