EchoesOfFate
A game for our COMP315 Project
 
Loading...
Searching...
No Matches
Map.h
Go to the documentation of this file.
1#ifndef MAP_H
2#define MAP_H
3
4#include <SFML/Graphics.hpp>
5#include <vector>
6#include <string>
7#include <fstream>
8#include <sstream>
9#include <cerrno>
10#include <filesystem>
11#include <iostream>
12#include <algorithm>
13
14using namespace sf;
15
16class Camera;
17
18typedef struct {
19 Sprite tileSprite;
21 int w, h;
23} Tile;
24
25void get_file_contents(const char* filePath, std::vector<std::vector<int>>& tileTypeArray);
26void load_textures(const char* dirPath, std::vector<Texture>& tileTextures);
27
28class Map
29{
30 private:
31 int mapWidth;
32 int mapHeight;
33 std::vector<std::vector<Tile>> tiles;
34 Texture mapTextureSheet;
35 static constexpr int tileSize = 32;
36
37 void loadTiles();
38 void setMapDimensions(int width, int height);
39
40 public:
41 Map(const char* tileTextureSheet);
42
43 void drawVisibleMap(RenderWindow& window, const Camera& camera);
44 int getMapWidth() const;
45 int getMapHeight() const;
46};
47
48#endif
void get_file_contents(const char *filePath, std::vector< std::vector< int > > &tileTypeArray)
Definition Map.cpp:4
void load_textures(const char *dirPath, std::vector< Texture > &tileTextures)
Definition Map.cpp:29
Definition Camera.h:10
void drawVisibleMap(RenderWindow &window, const Camera &camera)
Definition Map.cpp:88
int getMapHeight() const
Definition Map.cpp:100
Map(const char *tileTextureSheet)
Definition Map.cpp:52
int getMapWidth() const
Definition Map.cpp:105
Definition Map.h:18
Sprite tileSprite
Definition Map.h:19
int h
Definition Map.h:21
bool collidable
Definition Map.h:22
int w
w and h not in use
Definition Map.h:21