Jagguar Game Engine

Loading...
Searching...
No Matches
TileMap.hpp
1#ifndef TILE_H
2#define TILE_H
3
4#include <string>
5
6#include "IGraphicsEngineRenderer.hpp"
7#include "Component.hpp"
8#include <string>
9
13 class TileMapComponent : public Component {
14 public:
18 TileMapComponent(std::string tileSheetFileName, int rows, int cols, int _TileWidth, int _TileHeight, int _mapX,
19 int _mapY, SDL_Renderer *ren);
20
24 ~TileMapComponent();
25
30 void GenerateSimpleMap();
31
35 void PrintMap();
36
40 void SetTile(int x, int y, int type);
41
45 int GetTileType(int x, int y);
46
50 void Update(SDL_Event e, int frame, std::vector<std::string> broadcastList) override;
51
52 void Render(SDL_Renderer *ren) override;
53
54 void ShowComponentEditor(bool* showEditor) override;
55
56 const char* ComponentTypeName() override {return "Tile Map Component";}
57
58 private:
59 // Dimensions of our TileMapComponent and individual tiles.
60 // Used for spiltting up the sprite sheet
61 int m_Rows;
62 int m_Cols;
63 // How big each tile is.
64 int m_TileWidth;
65 int m_TileHeight;
66 // size of our tilemap
67 int m_MapX;
68 int m_MapY;
69 // Where our TileMapComponent is rendered
70 // An SDL Surface contains pixel data to draw our TileMapComponent
71 SDL_Surface *m_TileSpriteSheet;
72 SDL_Texture *m_Texture;
73 // Stores our tile types
74 int *m_Tiles;
75};
76
77#endif
Component
Definition: Component.hpp:38
TileMapComponent
Definition: TileMap.hpp:13
TileMapComponent::~TileMapComponent
~TileMapComponent()
Definition: TileMap.cpp:58
TileMapComponent::ComponentTypeName
const char * ComponentTypeName() override
Definition: TileMap.hpp:56
TileMapComponent::Update
void Update(SDL_Event e, int frame, std::vector< std::string > broadcastList) override
Definition: TileMap.cpp:168
TileMapComponent::Render
void Render(SDL_Renderer *ren) override
Definition: TileMap.cpp:134
TileMapComponent::ShowComponentEditor
void ShowComponentEditor(bool *showEditor) override
Definition: TileMap.cpp:173
TileMapComponent::SetTile
void SetTile(int x, int y, int type)
Definition: TileMap.cpp:122
TileMapComponent::GenerateSimpleMap
void GenerateSimpleMap()
Definition: TileMap.cpp:66
TileMapComponent::PrintMap
void PrintMap()
Definition: TileMap.cpp:109
TileMapComponent::GetTileType
int GetTileType(int x, int y)
Definition: TileMap.cpp:128