Game Engine 2D Platformer
LifeDisplayComponent.hpp
Go to the documentation of this file.
1 /*
2  * @file LifeDisplayComponent.hpp
3  * @brief LifeDisplayComponent class interface
4  * @date 2021-03-12
5  ***********************************************/
6 #ifndef LIFEDISPLAYCOMPONENT_HPP
7 #define LIFEDISPLAYCOMPONENT_HPP
8 
9 #include "Component.hpp"
10 #include <map>
11 #include <math.h>
12 #include <string>
13 #include <memory>
14 #include <iterator>
15 #include <SDL2_image/SDL_image.h>
16 #include <SDL2/SDL.h>
17 #include "ResourceManager.hpp"
18 
22 {
23 public:
28  LifeDisplayComponent(SDL_Renderer* ren, std::string path);
34  void StartUp();
37  void ShutDown();
41  void Update(GameEntity& entity);
45  void Render(GameEntity &entity);
46  SDL_Rect rect1;
47  SDL_Rect rect2;
48  SDL_Rect rect3;
49 
50 private:
51  SDL_Texture *lifeTexture;
52  SDL_Renderer *renderer;
53  //Create a ResourceManager instance
55 };
56 
57 #endif
The interface class for different components to inherit.
Definition: Component.hpp:16
Represents an interactable entity in the game that includes Main Character, NPC, Tiles ,...
Definition: GameEntity.hpp:22
LifeDisplayComponent class used to show character's HP.
Definition: LifeDisplayComponent.hpp:22
~LifeDisplayComponent()
Destructor for LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:28
void ShutDown()
Destroys and frees attributes for LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:36
SDL_Rect rect1
Definition: LifeDisplayComponent.hpp:46
void Render(GameEntity &entity)
Renders the LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:43
void StartUp()
Initializes the attributes for LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:32
SDL_Rect rect2
Definition: LifeDisplayComponent.hpp:47
SDL_Rect rect3
Definition: LifeDisplayComponent.hpp:48
void Update(GameEntity &entity)
Updates the LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:62
LifeDisplayComponent(SDL_Renderer *ren, std::string path)
Constuctor for LifeDisplayComponent.
Definition: LifeDisplayComponent.cpp:8
The resource manager is responsible for handling and managing resources regarding the game.
Definition: ResourceManager.hpp:23
static ResourceManager & getInstance()
Method used to get instance of ResourceManager class.
Definition: ResourceManager.cpp:8