Jamie Slowgrove - PGG Assignment 1 - SDL
 All Classes Functions
mapLoader.h
1 #pragma once
2 
3 #include <SDL.h>
4 #include <string>
5 #include <vector>
6 #include <iostream>
7 #include <fstream>
8 #include "texture.h"
9 #include "mapObject.h"
10 #include "block.h"
11 #include "gem.h"
12 #include "enemy.h"
13 
16 class MapLoader
17 {
18 private:
19  /*a structure for use with the map array*/
20  struct id
21  {
22  /*the type of entity*/
23  char type;
24  /*the index of the types array*/
25  int index;
26  };
27  /*vectors for the loaded map*/
28  std::vector<std::vector<id>> entities;
29  std::vector<Block *> blocks;
30  std::vector<Gem *> gems;
31  std::vector<Enemy *> enemies;
32  /*number of entities in a row*/
33  int numberOfEntites;
34  /*number of rows in the map*/
35  int numberOfRows;
36  /*number of blocks in the map*/
37  int numberOfBlocks;
38  /*number of gems in the map*/
39  int numberOfGems;
40  /*number of enemies*/
41  int numberOfEnemies;
42  /*pointer to the spritesheet*/
43  Texture * texture;
44 public:
51  MapLoader(std::string, Texture *, int);
52 
56  ~MapLoader();
57 
62  void loadMap(std::string, int);
63 
70  void sortType(int, int, int, int);
71 
76  void displayBlock(int, SDL_Renderer *);
77 
82  void displayGem(int, SDL_Renderer *);
83 
88  void displayEnemy(int, SDL_Renderer *);
89 
94  int getNumberOfBlocks();
95 
100  int getNumberOfGems();
101 
106  int getNumberOfEnemies();
107 
113  Block * getBlock(int);
114 
120  Gem * getGem(int);
121 
127  Enemy * getEnemy(int);
128 
133  int getNumberOfEntities();
134 
139  int getNumberOfRows();
140 
147  char getType(int, int);
148 
155  int getIndex(int, int);
156 
163  void MapLoader::setEntityBlank(int, int);
164 };
Creates a Gem object that inherits MapObject.
Definition: gem.h:10
void displayBlock(int, SDL_Renderer *)
Definition: mapLoader.cpp:188
Gem * getGem(int)
Definition: mapLoader.cpp:251
MapLoader(std::string, Texture *, int)
Definition: mapLoader.cpp:6
void displayEnemy(int, SDL_Renderer *)
Definition: mapLoader.cpp:206
char getType(int, int)
Definition: mapLoader.cpp:287
int getNumberOfBlocks()
Definition: mapLoader.cpp:215
Block * getBlock(int)
Definition: mapLoader.cpp:242
int getNumberOfEnemies()
Definition: mapLoader.cpp:233
int getNumberOfEntities()
Definition: mapLoader.cpp:269
int getIndex(int, int)
Definition: mapLoader.cpp:296
Creates a Block object that inherits MapObject.
Definition: block.h:10
void setEntityBlank(int, int)
Definition: mapLoader.cpp:305
int getNumberOfRows()
Definition: mapLoader.cpp:278
Creates a Texture for use with a renderer Creates a Texture from an image file, this can then be used...
Definition: texture.h:13
void displayGem(int, SDL_Renderer *)
Definition: mapLoader.cpp:197
a class to load in a map text file
Definition: mapLoader.h:16
void loadMap(std::string, int)
Definition: mapLoader.cpp:28
Creates an Enemy object that inherits MapObject which in turn inherits Creature.
Definition: enemy.h:10
Enemy * getEnemy(int)
Definition: mapLoader.cpp:260
int getNumberOfGems()
Definition: mapLoader.cpp:224
~MapLoader()
Definition: mapLoader.cpp:21
void sortType(int, int, int, int)
Definition: mapLoader.cpp:95