Game Engine 2D Platformer
TileComponent.hpp
Go to the documentation of this file.
1 /*
2  * @file TileComponent.hpp
3  * @brief TileComponent class interface
4  * @date 2021-03-12
5  ***********************************************/
6 #ifndef TILECOMPONENT_HPP
7 #define TILECOMPONENT_HPP
8 
9 #include "Component.hpp"
10 #include <map>
11 #include <SDL2_image/SDL_image.h>
12 
15 class TileComponent : public Component
16 {
17 public:
21  TileComponent(SDL_Renderer* ren);
27  void StartUp();
30  void ShutDown();
34  void Update(GameEntity& entity);
38  void Render(GameEntity &entity);
39 
40 private:
41  SDL_Renderer *renderer;
42  SDL_Surface *m_spritesheet;
43  std::map<int, std::vector<int>> map;
44  int widthImg, heightImg, row, col, tempWidth, tempHeight;
45  int tileHeight, tileWidth;
46 };
47 
48 #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
TileComponent class used to make tiles.
Definition: TileComponent.hpp:16
void StartUp()
Initializes the attributes for TileComponent.
Definition: TileComponent.cpp:17
TileComponent(SDL_Renderer *ren)
Constuctor for TileComponent.
Definition: TileComponent.cpp:8
~TileComponent()
Destructor for TileComponent.
Definition: TileComponent.cpp:13
void ShutDown()
Destroys and frees attributes for TileComponent.
Definition: TileComponent.cpp:21
void Render(GameEntity &entity)
Renders the TileComponent.
Definition: TileComponent.cpp:28
void Update(GameEntity &entity)
Updates the TileComponent.
Definition: TileComponent.cpp:33