Contact me to be added to this repository. Push the creations you make for D&D, and they will be displayed in a nice website. See the website for how to contribute.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
1.0 KiB

#pragma once
#include <string>
#include <iostream>
#include <SDL2/SDL.h>
#include <opencv2/opencv.hpp>
#include "Texture.h"
extern const int S_W; //screen dimensions
extern const int S_H;
extern int L_W; //level dimensions
extern int L_H;
extern const int TILE_SIZE;
static const int NUM_TILE_IDs = 3;
enum Tile {
WALL,
STONE,
GRASS,
WATER,
PIT,
UNUSED1,
UNUSED2,
UNUSED3
};
class Quad {
private:
SDL_Rect bound;
Tile data;
inline bool inbounds(int,int);
void boundstring();
Quad *tl,*tr,*bl,*br;
public:
Quad();
void init(int,int);
//~Quad(){free();}
void free();
void insert(int,int,Tile);
Tile lookup(int,int); //defaults to wall
void print(int);
};
class Map {
private:
int numTilesX,numTilesY;
Quad* tiles;
Texture textures[NUM_TILE_IDs];
public:
Map();
~Map();
void loadFromFile(std::string fpath);
void render(SDL_Rect camera);
//DEBUG
void print();
int getW(){ return numTilesX; }
int getH(){ return numTilesY; }
};