Game Engine 2D Platformer
Component.hpp
Go to the documentation of this file.
1 /*
2  * @file Component.hpp
3  * @brief Component class interface
4  * @date 2021-03-12
5  ***********************************************/
6 #ifndef COMPONENT_HPP
7 #define COMPONENT_HPP
8 #include <SDL2/SDL.h>
9 #include "GameEntity.hpp"
10 #include "Constants.hpp"
11 
12 class GameEntity; // Forward Declaration
15 class Component
16 {
17 public:
21  Component() = default;
25  virtual void StartUp() {};
29  virtual void ShutDown() {};
33  virtual void Render(GameEntity& entity) {};
38  virtual void LoadImage(std::string filepath, SDL_Renderer* ren) {};
42  virtual void HandleEvent(GameEntity& entity) {};
46  virtual void Update(GameEntity &entity) = 0;
47 };
48 
49 #endif
The interface class for different components to inherit.
Definition: Component.hpp:16
virtual void HandleEvent(GameEntity &entity)
Handle the events of GameEntity object for children classes.
Definition: Component.hpp:42
Component()=default
Constuctor for Component class.
virtual void Update(GameEntity &entity)=0
To update the attributes for children classes.
virtual void ShutDown()
To destroy and free attributes for children classes.
Definition: Component.hpp:29
virtual void Render(GameEntity &entity)
To render objects for children classes.
Definition: Component.hpp:33
virtual void LoadImage(std::string filepath, SDL_Renderer *ren)
To initalize loadImages for children classes.
Definition: Component.hpp:38
virtual void StartUp()
To initalize attributes for children classes.
Definition: Component.hpp:25
Represents an interactable entity in the game that includes Main Character, NPC, Tiles ,...
Definition: GameEntity.hpp:22