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
14public:
18 TileMapComponent(std::string tileSheetFileName, int rows, int cols, int _TileWidth, int _TileHeight, int _mapX,
19 int _mapY, SDL_Renderer *ren);
20
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
58private:
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
Definition: Component.hpp:38
Definition: TileMap.hpp:13
~TileMapComponent()
Definition: TileMap.cpp:58
const char * ComponentTypeName() override
Definition: TileMap.hpp:56
void Update(SDL_Event e, int frame, std::vector< std::string > broadcastList) override
Definition: TileMap.cpp:168
void Render(SDL_Renderer *ren) override
Definition: TileMap.cpp:134
void ShowComponentEditor(bool *showEditor) override
Definition: TileMap.cpp:173
void SetTile(int x, int y, int type)
Definition: TileMap.cpp:122
void GenerateSimpleMap()
Definition: TileMap.cpp:66
void PrintMap()
Definition: TileMap.cpp:109
int GetTileType(int x, int y)
Definition: TileMap.cpp:128