The next little game in the series where I make a fancy rogue game.
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.
 
 
 
 
 
 
roguish/tilemap.hpp

46 lines
934 B

#pragma once
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <fmt/core.h>
#include "point.hpp"
#include "matrix.hpp"
#include "config.hpp"
#include <ftxui/screen/color.hpp>
struct TileCell {
std::string display;
uint8_t fg_h;
uint8_t fg_s;
uint8_t fg_v;
uint8_t bg_h;
uint8_t bg_s;
uint8_t bg_v;
};
typedef std::vector<TileCell> TileRow;
typedef std::vector<TileRow> TileGrid;
class TileMap {
public:
Config $config;
size_t $width;
size_t $height;
matrix::Matrix $tile_ids;
TileGrid $display;
TileMap(size_t width, size_t height);
// disable copying
TileMap(TileMap &map) = delete;
size_t width() { return $width; }
size_t height() { return $height; }
void load(matrix::Matrix &walls);
const TileCell &at(size_t x, size_t y);
void set_tile(size_t x, size_t y, std::string tile_name);
void dump(int show_x=-1, int show_y=-1);
bool INVARIANT();
};