|
|
|
@ -13,7 +13,6 @@ |
|
|
|
|
namespace fs = std::filesystem; |
|
|
|
|
constexpr const int TILE_COUNT=10; |
|
|
|
|
constexpr const sf::Color DEFAULT_COLOR{255, 255, 255, 255}; |
|
|
|
|
constexpr const size_t DEFAULT_DIM=64; |
|
|
|
|
using namespace nlohmann; |
|
|
|
|
|
|
|
|
|
using namespace shiterator; |
|
|
|
@ -85,7 +84,6 @@ struct MapTileBuilder { |
|
|
|
|
|
|
|
|
|
void run_real_textures(MapConfig &config) { |
|
|
|
|
sf::Vector2u crop{$size.x * (unsigned int)config.it.width, ($size.y) * ((unsigned int)config.it.y + 1)}; |
|
|
|
|
fmt::println("TEXTURE CROP: {},{}; size: {},{}", $size.x, $size.y, crop.x, crop.y); |
|
|
|
|
$render = std::make_shared<sf::RenderTexture>(crop); |
|
|
|
|
$render->clear({0,0,0,0}); |
|
|
|
|
|
|
|
|
@ -154,9 +152,6 @@ struct MapTileBuilder { |
|
|
|
|
dbc::check($size.x - t_size.x >= 0, "font too big on x"); |
|
|
|
|
dbc::check($size.y - t_size.y >= 0, "font too big on y"); |
|
|
|
|
|
|
|
|
|
fmt::println("display: {}, bg: {},{},{},{}; fg: {},{},{},{}", |
|
|
|
|
(int)display_char, bg.r, bg.g, bg.b, bg.a, fg.r, fg.g, fg.b, fg.a); |
|
|
|
|
|
|
|
|
|
// draw the background first
|
|
|
|
|
background.setFillColor(bg); |
|
|
|
|
|
|
|
|
@ -223,20 +218,16 @@ void load_config(MapConfig& config, bool is_centered, std::string path, std::fun |
|
|
|
|
if(data.contains("foreground")) { |
|
|
|
|
auto fg_color = data["foreground"]; |
|
|
|
|
sf::Color fg{fg_color[0], fg_color[1], fg_color[2]}; |
|
|
|
|
fmt::println("TILE {}, display: {} has foreground: {},{},{}", key, (int)display, fg.r, fg.g, fg.b); |
|
|
|
|
config.colors.insert_or_assign(display, fg); |
|
|
|
|
} else { |
|
|
|
|
fmt::println("TILE {}, {} has DEFAULT COLOR", key, (int)display); |
|
|
|
|
config.colors.insert_or_assign(display, DEFAULT_COLOR); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(data.contains("background")) { |
|
|
|
|
auto bg_color = data["background"]; |
|
|
|
|
sf::Color bg{bg_color[0], bg_color[1], bg_color[2]}; |
|
|
|
|
fmt::println("TILE {} display: {} has background: {},{},{}", key, (int)display, bg.r, bg.g, bg.b); |
|
|
|
|
config.backgrounds.insert_or_assign(display, bg); |
|
|
|
|
} else { |
|
|
|
|
fmt::println("TILE {} display: {} has transparent background", key, (int)display); |
|
|
|
|
sf::Color bg{0, 0, 0, 0}; |
|
|
|
|
config.backgrounds.insert_or_assign(display, bg); |
|
|
|
|
} |
|
|
|
@ -269,7 +260,7 @@ int main() { |
|
|
|
|
load_config(config, true, "./assets/enemies.json", component_display); |
|
|
|
|
|
|
|
|
|
fmt::println("-----------------------------------------"); |
|
|
|
|
MapTileBuilder builder(DEFAULT_DIM, DEFAULT_DIM); |
|
|
|
|
MapTileBuilder builder(ICONGEN_MAP_TILE_DIM, ICONGEN_MAP_TILE_DIM); |
|
|
|
|
builder.run(config); |
|
|
|
|
|
|
|
|
|
builder.save_image("./assets/map_tiles.png"); |
|
|
|
|